Register
Ports on the 5.0.0 part, from its help text (F44):
| Data (input) | The value stored on a clock trigger. |
|---|---|
| Clock | The value updates on this trigger. |
| Enable | When 0, clock triggers are ineffective. |
| Clear | When 1, the value is set to 0 asynchronously. |
| Output | The register's current value. |
No rows match.
Attributes: Data Bits, Trigger, Label, and a setting to show it in the Registers tab; we did not open the Properties panel for this part, so we give no more.
Our run of an 8-bit register, one row per step of the test (F101):
| 0 | 0xa5 | 1 | 0 | 0x0 |
|---|---|---|---|---|
| 1 | 0xa5 | 1 | 0 | 0xa5 |
| 0 | 0x3c | 0 | 0 | 0xa5 |
| 1 | 0x3c | 0 | 0 | 0xa5 |
| 0 | 0x3c | 0 | 0 | 0xa5 |
| 0 | 0x3c | 1 | 0 | 0xa5 |
| 1 | 0x3c | 1 | 0 | 0x3c |
| 0 | 0x3c | 1 | 0 | 0x3c |
| 0 | 0x3c | 1 | 1 | 0x0 |
| 0 | 0x3c | 1 | 0 | 0x0 |
No rows match.
Download the register and its vector.
Shift Register
The Shift Register part has these ports in its help text: Input (value shifted into the first stage), Shift (shifting is disabled when 0), Clock, Clear (resets all stages to 0 asynchronously), Output (the last stage), and Load (when 1, with Shift at 0, all stages load from the parallel inputs). With Parallel Load on, each stage also has its own input and output. We have not run the part, so we show no table. To build a shift register yourself, chain D flip-flops: see Flip-flops. A bidirectional one can use the TTL 74194, see the TTL library when available.
Build a register file
A register file has several registers, one write port and usually two read ports. Logisim-evolution has no such part in the Memory library. Ours: 4 registers of 8 bits.
Describe this circuit
Components: Input pin CLK; Input pin WE; Input pin WA; Input pin WD; Input pin RA; Input pin RB; Decoder 1; Register R0; Constant 1; Register R1; Constant 2; Register R2; Constant 3; Register R3; Constant 4; Multiplexer 1; Output pin QA; Multiplexer 2; Output pin QB.
- Input pin CLK connects to Register R0, Register R1, Register R2, Register R3 (net CLK, clk).
- Input pin WE connects to Decoder 1 (net WE, we).
- Input pin WA connects to Decoder 1 (net WA, wa), 2 bits wide.
- Input pin WD connects to Register R0, Register R1, Register R2, Register R3 (net WD, wd), 8 bits wide.
- Input pin RA connects to Multiplexer 1 (net RA, ra), 2 bits wide.
- Input pin RB connects to Multiplexer 2 (net RB, rb), 2 bits wide.
- Decoder 1 connects to Register R0 (net en0).
- Decoder 1 connects to Register R1 (net en1).
- Decoder 1 connects to Register R2 (net en2).
- Decoder 1 connects to Register R3 (net en3).
- Register R0 connects to Multiplexer 1, Multiplexer 2 (net q0), 8 bits wide.
- Register R0 connects to Constant 1.
- Register R1 connects to Multiplexer 1, Multiplexer 2 (net q1), 8 bits wide.
- Register R1 connects to Constant 2.
- Register R2 connects to Multiplexer 1, Multiplexer 2 (net q2), 8 bits wide.
- Register R2 connects to Constant 3.
- Register R3 connects to Multiplexer 1, Multiplexer 2 (net q3), 8 bits wide.
- Register R3 connects to Constant 4.
- Multiplexer 1 connects to Output pin QA (net qa, QA), 8 bits wide.
- Multiplexer 2 connects to Output pin QB (net qb, QB), 8 bits wide.
Place four 8-bit registers
Wire the same write-data bus to all four data inputs and the same clock to all four clock inputs.
Check: Each shows Data Bits 8.
Make the write enables
Use a 2-bit Decoder with its Enable input wired to the write-enable signal and its select to the write address. Wire each decoder output to one register’s Enable. Do not gate the clock; use the enable.
Check: Exactly one register enable is 1 when write enable is 1.
Add the read ports
Two 4:1 Multiplexers of width 8, each with the four register outputs as inputs and its own read address as select.
Check: Changing a read address changes the output at once.
Tie off the clears
We wired each register’s Clear to a constant 0.
Check: No input is left floating.
Our sequential test wrote 0x11, 0x22, 0x33 and 0x44 to registers 0 to 3, pulsed the clock with write enable 0 and saw no change, read every register on both ports, and wrote 0xAB to register 2 (F101). It passed all 23 steps.
Download the register file and its vector. See Multiplexers and decoders for those parts.
Common mistakes
- Gating the clock instead of using enable. Feed every register the same clock and control writing with the enable input.
- Different clocks in one datapath. Registers that should update together need the same clock.
- Width mismatch. A register and its bus must have the same Data Bits, or the wire turns orange; see wire colours.
- Expecting Clear to wait for the clock. It acts at once (F101).
- Reading right at the edge. The output changes just after a rising edge, so a read in the same step sees the new value.