Commit 11e25268 authored by Alan Marchiori's avatar Alan Marchiori
Browse files

creation

parents
module evenodd;
reg[0:7] A;
reg C;
initial begin: init
A = 0;
C = 0;
end
always begin: main
integer i;
for (i = 0; i < 8; i = i + 1)
begin
if (A[i] == 1)
begin
C = ~C;
end
end
if (C)
begin
$display ("%4d, %b has ODD parity (%b)", $time, A, C);
end
else
begin
$display ("%4d, %b has EVEN parity (%b)", $time, A, C);
end
#1;
end
always begin: testCases
A = 8'b01110001;
C = 0;
#1; A = 8'b01010001;
C = 0;
#1; A = 8'b11111111;
C = 0;
#1; A = 8'b01111111;
C = 0;
#1; $finish;
end
endmodule
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment