stanford-ppl / spatial-lang

Spatial: "Specify Parameterized Accelerators Through Inordinately Abstract Language"
MIT License
99 stars 12 forks source link

Moving to [SGN, WIDTH, OFFSET] Representation for FixPt #261

Open mattfel1 opened 6 years ago

mattfel1 commented 6 years ago

I think we should support this kind of representation instead of/in addition to the current representation. I remember this is how MaxJ represented numbers. Right now, there is no way to represent something like an 4 bit number with the decimal placed somewhere outside of these 4 bits. For example, someone may want to do something like:

binary - . - - - - 1 0 0 0  =  dec 0.03125

It would be nice to represent this as FixPtOfs[TRUE, 4, -8]

I can make this change but it seems like it may become kind of involved so it would be nice to know what people think of this before I spend the time messing with this.

dkoeplin commented 6 years ago

Hm yeah this is a good point, this seems like a superset of the currently supported fixed point types.

We assume the Q format right now for FixPt. If there's enough need/demand for this new type I can make the required changes for it.