32-bit MIPS architecture: how can I read and write register to register file in the same measure?

My books on computer architecture explain that

"Since writing to the register file has a boundary effect, our design can legally read and write the same register to the beat: read will get the value written in an earlier measure, while the written value will be available for reading in the next measure."

This makes sense, and I understand somewhat what happens with the register file. However, I do not understand when each event occurs. Let's say we read from one of 32 register files and write to it in the same loop. When will the register be read? When will it be written? I don’t quite understand how events are triggered around the edges of the clock, so that would also help explain this. Thanks!

+4
source share
2 answers

Reading a register value is asynchronous, whereas in an architecture that you work in your class, registers are written synchronously (i.e., records are triggered at the edges).

This means that you can read the current value of the register, apply some operation to it (for example, add a little immediate) and write the result on the next rising edge of synchronization.

Suppose you want to issue addiu $1, $1, 123 , that is, take the current value of $1 , add 123, and save the result to $1 .

At the beginning of the clock cycle, the control unit must instruct the register file to place the contents of $ 1 on one of the data buses that fall into the ALU. the control unit will also instruct to immediately connect 123 to another data bus, which also falls into the ALU. The appendix, which is a combinatorial circuit implemented inside the ALU, will calculate the addition and put the result on the data bus that connects the register file for storage. All this is done before the rising edge of the clock occurs, and the result of the addition will be presented to the next rising edge. At some point, the rise front arises, and the result of the addition is now written back to the register $1 .

+3
source

The register file is built from triggers. Each trigger has a store, entry, exit, and trigger. An output always represents a stored value, so it can be read all the time. With a rising edge on the trigger, the input value moves to the store.

0
source

Source: https://habr.com/ru/post/1443990/


All Articles