Re: [myhdl-list] Floating Point Libraries
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2011-04-14 13:01:20
|
<snip> > > So why not start with a workaround? We could define an > interface using a_sign, a_mant, a_exp and b_sign, b_mant, b_exp. > Ok, the interface is flattened, but in the code the only > difference would be the underscore instead of dot notation. > But it would teach us if this type of interface is really > what we want to work with. And it works today. And if conversion ever > gets more powerful, an upgrade may be simple. Are you thinking something like the following? If I understand, the proposal would be to have one Signal for a complex structure vs. a structure with multiple Signals. ----------- from myhdl import * class TypeStruct(object): def __init__(self): x = intbv(0)[8:] y = intbv(0)[12:] z = intbv(0)[23:] if __name__ == '__main__': struct = Signal(TypeStruct()) struct.next.x = 1 struct.next.y = 2 struct.next.z = 3 struct._update() # usually happens behind the scenes print struct.x, struct.y, struct.z ----------- This isn't specific to the FP interface proposal. This is the general method to handle grouping of types. And then the conversion proposal would be; that a Signal carrying a class type (and dict?) the internal intbv types would be expanded to struct_x, struct_y, struct_z, for the above example? I follow, that the conversion work would follow the general modeling approach. Or when you said "code" you are referring to the MyHDL code. And for the near-term it is more important to define a working convertible FP module that is support by MyHDL 0.7. The FP unit would be built using the interface you mentioned and in the future it could be replaced by something like the above. Chris Felton |