spatial icon indicating copy to clipboard operation
spatial copied to clipboard

Reg Reset Handling

Open mattfel1 opened this issue 6 years ago • 1 comments

If someone writes this:

Foreach(...){i => 
  val r = Reg[Int](5)
  r.reset
  r := ...
  ... := r
}

In old spatial at least, the reset doesn't get handled in the buffer analysis because I added it as dirty as possible. So r would be double buffered and at least in the chisel backend, a reset on a buffered memory wipes all buffers since we can't figure out which buffer to reset. Is it possible to just have resets transform into writes that take the init value of the reg? Or can we have resets be handled correctly in buffering analysis so we can intelligently reset the correct buffer (in the case of RegFiles, overwriting would take too much time)

mattfel1 avatar May 01 '18 22:05 mattfel1

For registers, reset as a write of the initial value makes sense. For RegFile, yeah you're right, we should handle reset like any other write. It just happens to write the entire memory in one cycle.

dkoeplin avatar May 02 '18 04:05 dkoeplin