stanford-ppl / spatial

Spatial: "Specify Parameterized Accelerators Through Inordinately Abstract Language"
https://spatial.stanford.edu
MIT License
274 stars 32 forks source link

Warning for Const out of range Missing #168

Open mattfel1 opened 5 years ago

mattfel1 commented 5 years ago

We had this case:

local_edges_l(container_begin + edge_iter) & 0x8000000000000000l

where local_edges_l is FixPt[TRUE,_64,_0]. It didn't warn about 0x8000000000000000 being out of range, but the generated verilog had 0x7fffffffffffff secretly, which defeats the whole purpose of this mask. Why were we not warned?

dkoeplin commented 5 years ago

ah... the detection for the warning is percentage based right now... meaning big numbers won't get the warning for small differences like this, even though they're being used as bit masks. Clearly that's not the correct solution to find these cases.

mattfel1 commented 5 years ago

Got it. More concerning is that --synth and --sim don't match up in this case. One or both are doing something suspicious, but either way I will go in and put a warning.