Unfortunately it won't compile up to the size I am using.
Yes, I think the compiler may be building a very deep if-then-else
tree and might have a hard time analysing it.
?
There may be another way to do it: Instead of an if-then-else that is
the size of regfile (NRgs), you could transform that into an multiple
if-then else's the size of the number of simultaneous writes (NRws)
you're trying to support.
?
Generate NRgs rules, one per register. ?In each rule, analyse the NRws
rwires to decide how to update just that register.
?
?
An alternative solution is to mimic a 'store buffer' from CPUs,
assuming there is some 'slack' in the use of the register file, i.e.,
some idle cycles where no writes are attempted.
?
(A) Use an ordinary RegFile, plus a vector (queue of pending writes).
If there is just one write in a clock, write it to the RegFile.
?
If there is >1 write in a clock, write one of them to the RegFile and
enqueue the others as 'pending'.
?
In "idle cycles" (no writes), dequeue and perform the pending writes
into the RegFile, one by one.
?
Note: for every read to reg J, you'd have to check the pending queue
for the most recent write to reg J, if any, and read the RegFile if none.
?
?
(B) At the expense of doubling the register storage, use two RegFiles
RF1 and RF2, where RF2 is used as the 'pending queue' described above,
and copied to RF1 on idle cycles. This avoids 'searching' the pending
queue for more recent writes, it's a direct access to RF2 (you'll need a 'valid'
bit on each RF2 register to know whether it has a pending write or not).