Loading simulatorβ¦
The predefined template already contains the four complete data-storage paths MUX_D3 to MUX_D0 with FF_D3 to FF_D0, including their load/hold wiring, Write_Enable, Clock, nReset, and Data_Out[3:1] connections. MUX_P and FF_P are also placed, with MUX_P.out0 -> FF_P.in0 and the parity DFF clock/reset connections already wired. The bit-0 read path through INJ_XOR is also complete.
The remaining work is to generate the parity bit, complete the unused inputs of MUX_P, and build the parity-checker XOR network. Complete these connections in the following order.
1. Generate the even-parity bit
Connect the input data to the three parity-generator XOR gates:
Data_In3 -> PG_XOR0.in0
Data_In2 -> PG_XOR0.in1
Data_In1 -> PG_XOR1.in0
Data_In0 -> PG_XOR1.in1
PG_XOR0.out -> PG_XOR2.in0
PG_XOR1.out -> PG_XOR2.in1
PG_XOR2.out becomes:
Parity_In = Data_In3 XOR Data_In2 XOR Data_In1 XOR Data_In0
The first two XORs form partial parity values, and the third XOR combines them into the parity bit for the complete 4-bit word.
2. Complete the parity load/hold path
Connect the generated parity to the new-data input of the parity MUX:
PG_XOR2.out -> MUX_P.in1
Connect the stored parity back to the hold input:
FF_P.out0 -> MUX_P.in0
Connect the common write control to the MUX select pin:
Write_Enable -> MUX_P.in8
MUX_P.out0 -> FF_P.in0 is already provided. Therefore, when Write_Enable = 1, MUX_P.in1 is selected and FF_P stores the newly generated parity on the rising clock edge. When Write_Enable = 0, MUX_P.in0 feeds FF_P.out0 back to its input so the stored parity is held. This keeps the parity bit synchronized with the four stored data bits.
3. Use the supplied read-path error injection
The template already contains:
FF_D0.out0 -> INJ_XOR.in0
Inject_Error -> INJ_XOR.in1
INJ_XOR.out -> Data_Out[0]
So:
Data_Out[0] = Stored_Data0 XOR Inject_Error
With Inject_Error = 0, bit 0 passes unchanged. With Inject_Error = 1, only the read value is inverted; FF_D0 itself is not changed. The parity checker must therefore use Data_Out[0] from INJ_XOR.out, otherwise the injected error would be bypassed.
4. Build the parity checker
Connect the four read-data bits into the checker:
Data_Out[3] -> PC_XOR0.in0
Data_Out[2] -> PC_XOR0.in1
Data_Out[1] -> PC_XOR1.in0
Data_Out[0] -> PC_XOR1.in1
PC_XOR0.out -> PC_XOR2.in0
PC_XOR1.out -> PC_XOR2.in1
PC_XOR2.out -> PC_XOR3.in0
FF_P.out0 -> PC_XOR3.in1
PC_XOR3.out -> Error
PC_XOR2.out represents the parity of the four values actually visible at Data_Out[3:0]. PC_XOR3 then compares that read-data parity with Stored_Parity.
Error = Data_Out[3] XOR Data_Out[2] XOR
Data_Out[1] XOR Data_Out[0] XOR Stored_Parity
For a valid stored word, the parity matches and Error = 0. If Inject_Error = 1, the read bit changes while the stored parity does not, so Error = 1.
This circuit detects the defined single-bit read error but does not locate or correct it. In general, parity detects odd numbers of bit flips and may miss an even number of simultaneous bit errors.