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.

How to assign value to b,plz....

Status
Not open for further replies.

Sasi Cm

Junior Member level 1
Junior Member level 1
Joined
Aug 22, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
112
Code:
module compare(a,out0,out1,out2,temp,temp1,temp2);
input [0:19]a;
wire [0:4]b;
output [0:1]out0,out1,out2;
reg [0:1]out0,out1,out2;
output [0:4] temp,temp1,temp2;
reg [0:4] temp,temp1,temp2;
always @(a)
begin
assign b[0:4]=a[0:4];
assign temp=b[0:4]^a[5:9];
if(temp[0]!=1&&temp[1]!=1&&temp[2]!=1&&temp[3]!=1&&temp[4]!=1)
begin
out0<=0;
end
else if(temp[0]!=0&&temp[1]!=0&&temp[2]!=0&&temp[3]!=0&&temp[4]!=0)
begin
out0<=10;
b[0:4]<=!a[0:4];
end
else
begin
out0<=11;
b[0:4]<=temp[0:4];
end

assign temp1=a[0:4]^a[10:14];
if(temp1[0]!=1&&temp1[1]!=1&&temp1[2]!=1&&temp1[3]!=1&&temp1[4]!=1)
begin
out1<=0;
end
else if(temp1[0]!=0&&temp1[1]!=0&&temp1[2]!=0&&temp1[3]!=0&&temp1[4]!=0)
begin
out1<=10;
b[0:4]<=!b[0:4];
end
else
begin
out1<=11
b[0:4]<=temp1[0:4];
end

assign temp2=a[0:4]^a[15:19];
if(temp2[0]!=1&&temp2[1]!=1&&temp2[2]!=1&&temp2[3]!=1&&temp2[4]!=1)
begin
out2<=0;
end
else if(temp2[0]!=0&&temp2[1]!=0&&temp2[2]!=0&&temp2[3]!=0&&temp2[4]!=0)
begin
out2<=10;
b[0:4]<=!b[0:4];
end
else
begin
out2<=11
b[0:4]<=temp2[0:4];
end

end
endmodule

I dont know to assign value to b..,Help me to overcome the error....
 

Code:
module compare(a,out0,out1,out2,temp,temp1,temp2);
input [0:19]a;
wire [0:4]b;
output [0:1]out0,out1,out2;
reg [0:1]out0,out1,out2;
output [0:4] temp,temp1,temp2;
reg [0:4] temp,temp1,temp2;
always @(a)
begin
assign b[0:4]=a[0:4];
assign temp=b[0:4]^a[5:9];
if(temp[0]!=1&&temp[1]!=1&&temp[2]!=1&&temp[3]!=1&&temp[4]!=1)
begin
out0<=0;
end
else if(temp[0]!=0&&temp[1]!=0&&temp[2]!=0&&temp[3]!=0&&temp[4]!=0)
begin
out0<=10;
b[0:4]<=!a[0:4];
end
else
begin
out0<=11;
b[0:4]<=temp[0:4];
end

assign temp1=a[0:4]^a[10:14];
if(temp1[0]!=1&&temp1[1]!=1&&temp1[2]!=1&&temp1[3]!=1&&temp1[4]!=1)
begin
out1<=0;
end
else if(temp1[0]!=0&&temp1[1]!=0&&temp1[2]!=0&&temp1[3]!=0&&temp1[4]!=0)
begin
out1<=10;
b[0:4]<=!b[0:4];
end
else
begin
out1<=11
b[0:4]<=temp1[0:4];
end

assign temp2=a[0:4]^a[15:19];
if(temp2[0]!=1&&temp2[1]!=1&&temp2[2]!=1&&temp2[3]!=1&&temp2[4]!=1)
begin
out2<=0;
end
else if(temp2[0]!=0&&temp2[1]!=0&&temp2[2]!=0&&temp2[3]!=0&&temp2[4]!=0)
begin
out2<=10;
b[0:4]<=!b[0:4];
end
else
begin
out2<=11
b[0:4]<=temp2[0:4];
end

end
endmodule

I dont know to assign value to b..,Help me to overcome the error....

Well you need to do a togle operation. So something like a tff is
To be considered and you probebly want to have a clock as well.
If you want to Read back your signal
You got to add it in sensitivity list as well.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top