bcdeforest
Newbie level 1
I have an output "SUM". I need to assign 4 values into its array. Here is my attempt.
- - - Updated - - -
The error I get is, "Object "SUM" on left-hand side of assignment must have an net type"
Code:
module part4b(A,B,Cin,S,Cout,SUM,V);
input [3:0]A,B;
input [1:0]S;
input Cin;
output [3:0]SUM;
output Cout,V;
reg [3:0]SUM;
reg Cout,V;
wire w1,w2,x1,x2,y1,y2,z1,z2;//Connecting wires to module
part4a a0(.A(A[0]),.B(B[0]),.Cin(Cin),.S(S),.SUM(w1),.Cout(w2));//Wire w2 connects a0 and a1 C
part4a a1(.A(A[1]),.B(B[1]),.Cin(w2),.S(S),.SUM(x1),.Cout(x2));//Wire x2 connects a1 and a2 C
part4a a2(.A(A[2]),.B(B[2]),.Cin(x2),.S(S),.SUM(y1),.Cout(y2));//Wire y2 connects a2 and a3 C
part4a a3(.A(A[3]),.B(B[3]),.Cin(y2),.S(S),.SUM(z1),.Cout(z2));//Wire w2 is output Cout
assign SUM[0] = w1;//THESE RIGHT HERE<<
assign SUM[1] = x1;
assign SUM[2] = y1;
assign SUM[3] = z1;
endmodule
- - - Updated - - -
The error I get is, "Object "SUM" on left-hand side of assignment must have an net type"