0

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
2
  • 2
    What problems does it cause? What compiler error(s) do you get? Commented Mar 8, 2011 at 21:43
  • 2
    Agreed, in general it is good form to include an output errors. Commented Mar 8, 2011 at 22:14

4 Answers 4

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

You most likely want to change:

begin

to:

always @* begin

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

Comments

0

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

Comments

-1

You might need to use <= instead of = .

1 Comment

We don't know what he is modeling at this point so we cannot make that judgement yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.