You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are writing code like the following which uses the family closure to generate types, Instructions, and other local objects. When we call family generator, we lose (easy) access to the generated locals, as the closure only returns the peak class.
def gen_pe(family):
alu = gen_alu(family)
Bit = family.Bit
Data = family.BitVector
Inst = gen_inst(family)
#...
class PE(Peak):
#Define peak class using the above generated locals
return PE
Possible solution: Save the generated locals directly in the generated peak class
def gen_pe(family):
alu = gen_alu(family)
Bit = family.Bit
Data = family.BitVector
Inst = gen_inst(family)
#...
local_values = locals()
class PE(Peak):
env = dict_to_obj(local_values)
#Define peak class using the above generated locals
return PE
PE = gen_pe(BitVector)
Data = PE.env.Data
Ideally there is a syntactically more concise way of getting the same effect.
The text was updated successfully, but these errors were encountered:
Whatever the mechanism, after discussing with @cdonovick I think the right path is to somehow pass locals() and globals() to magma (rather than the current logic which only works if the decorator is at the top level).
Problem:
We are writing code like the following which uses the family closure to generate types, Instructions, and other local objects. When we call family generator, we lose (easy) access to the generated locals, as the closure only returns the peak class.
Possible solution: Save the generated locals directly in the generated peak class
Ideally there is a syntactically more concise way of getting the same effect.
The text was updated successfully, but these errors were encountered: