0
votes

The part that causes problems is c[1] = p[0] + g[0] & c0;. What's wrong with it?

module CLA_gen(p, g, c0, c);
input [3:0] p;
input [3:0] g;
input c0;
output reg [4:1] c;
begin
c[1] = p[0] + g[0] & c0;
end
endmodule
4
What problems does it cause? What compiler error(s) do you get? - Gareth McCaughan
Agreed, in general it is good form to include an output errors. - Dr. Watson

4 Answers

4
votes

You're missing your always block and its sensitivity list.

always @(*)
  c[1] = p[0] + g[0] & c0;

In the code you posted above, you don't necessarily need the begin/end since you only have one line. But it doesn't not hurt to add it in there.

2
votes

You most likely want to change:

begin

to:

always @* begin

Every begin/end must be part of another construct, such as always, initial, etc.

0
votes

Remove the begin and end declare c only as an output

follow this

module CLA_gen(p, g, c0, c);
input [3:0] p;
input [3:0] g;
input c0;
output [4:1] c;
assign c[1] = p[0] + g[0] & c0;
endmodule
-1
votes

You might need to use <= instead of = .