Electrical – Function of demultiplexers in Register File

cpudigital-logiclogisimmultiplexerregister

What is the function of demultiplexers (DMX) in this Logisim diagram of a Register File design:

enter image description here

Also could you explain the meaning of:

dreg,sreg,treg

dsel,ssel,tsel

dwrite,swrite,twrite

Best Answer

First let me define a simple Register

enter image description here

INPUTS: Write,Data_in[16],CLK

OUTPUTS: Data_out[16]

IF the Write pin is HIGH, the data in the Data_in[16] will be stored in this register the next clock cycle (Rising or falling edge)

The Write pin is connected to the DMUX outputs so you can choose one of the 8 registers to write by providing the proper select value[SEL pin] and a '1' on the Dmux input

So for example if i want to write data in R5

1- Put the data in regval[16]

Since regval[16] is connected to all the 8 registers, we need to select only one of the 8 registers to store this value

How can we make this !

By using a DMUX

enter image description here

2- I`ll set dsel[ 3] to '101' to make sure that the DMUX is selecting the 5th register

3- Then i`ll set dwrite to '1' to make sure that the 5th register 'Write' pin is triggered HIGH and the data in regval will be stored only in this register the next clock cycle edge

Now we are able to Select one of the 8 registers and write the data only to it even though all the registers Data_in[16] pin are connected to the same bus (regval)

Same idea when reading

Connect all the registers Data_out[16] pin to the Mux inputs, then output only one of them by providing the proper value on the select (sel) pin

For example if i want to read the value of R5

enter image description here

1-I`ll put '101' on dsel[ 3]

2- read the register stored value from the Mux output


Why dsel,ssel,tsel

when making an ALU operation for example adding two numbers and storing them in a register

R[d] = R[s] + R[t]

D is the destination register where the result is stored

S and T are the two operands