Noise
Noise
module noise_add (
input [7:0] i_data,
input [4:0] i_noise, // the noise is emulated using
output [7:0] o_data
);
// Intermediary logic
reg p1, p2, p4;
reg [6:0] syndrome; // one hot value for the bit to be corrected
wire [6:0] data_decoded;
wire overall_parity;
// Create the logic for the p1, p2, p4 signals (the syndrome)
always @(*) begin
p1 = i_data[0] ^ i_data[2] ^ i_data[4] ^ i_data[6];
p2 = i_data[1] ^ i_data[2] ^ i_data[5] ^ i_data[6];
p4 = i_data[3] ^ i_data[4] ^ i_data[5] ^ i_data[6];
end
endmodule
encoder
module hamming74_enc(
input [3:0] i_data,
output [6:0] o_hamming_code,
output o_parity // optional
);
endmodule
prio
module prio_enc_8to3
(input [7:0] d,
output reg [2:0] q,
output reg v
);
endmodule
led
module hex_7seg_decoder
// Parameters section
#( parameter COMMON_ANODE_CATHODE = 0) // 0 for common Anode / 1 for common
cathode
// Ports section
(
input [3:0]in,
output o_a,
output o_b,
output o_c,
output o_d,
output o_e,
output o_f,
output o_g
//output dot // optional - NOT used on DE1-SoC board
);
// Internal logic
reg a,b,c,d,e,f,g;