Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] even parity using verilog code!!!

Status
Not open for further replies.

sobella1923

Newbie level 4
Newbie level 4
Joined
Jun 17, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
43
hi!
im trying to write a verilog prog that inserts an even parity at the end of the data. i need some help in debugging it. thx

module parity(data,vparity);
input [4:0] data;
output vparity;

integer i;

reg [4:0] data;
reg parity;
reg vparity;

initial
begin

assign data=5'b10100;
assign parity = 1'b0;

for (i= 0; i < 5; i = i + 1)
begin
assign parity = parity ^ data;
end

assign vparity={data, vparity};
end
endmodule
 

Code:
 vparity = {data,^data};

No loops are required, just use the unary XOR operator as above.

As well as fixing what TrickyDicky said.

r.b.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top