module paramod(a, b, cin, sum, cout);parameter N=1;input [N-1:0] a, b;input cin;output [N-1:0] sum;output cout;reg [N-1:0] sum;reg [N-1:0] p;reg [N:0] carry;integer i;always @ (a or b or cin) begincarry = cinfor (i=0; i<N; i=i+1) beginp[i] = a[i] ^ b[i];sum[i] = p[i] ^ cin;case(p)0: carry[i+1] = a[i];1: carry[i+1] = cin;endcaseendendassign cout = carry[N];endmodule
module add_6b(a,b,sum,cout);parameter N=6input [5:0] a, b;output [5:0] sum;output cout;paramod # (N) U0 paramod(.a(a), .b(b), .cin(1'b0), sum(sum), .cout(cout));
red = error
Please let me know why the error occurred. With the code, if you can.
Thank you in advance. With your help.
First problem is that you should change:
"module paramod(a, b, cin, sum, cout);parameter N=1;"
Because if you want to say "paramod # (N) U0 paramod(.a(a), .b(b), .cin(1'b0), sum(sum), .cout(cout));", you should write:
"module paramod # (parameter N= 1) (a, b, cin, sum, cout);" and please name your port map without blank spaces like U0 paramod. You can name is as "U0_paramod".
You should put ";" after "parameter N= 6". This is another problem.
For case selection part, you should add "default:" under "1: carry[i+1] = cin;".
Finally, you should not post your code like this, you should also write your errors in the message part. In this way, we can help you faster and better.