Hi Stephen,
Thanks for your response!
I tried using a sized reg for m as well but I still get the error:
module junk;
integer d, e;
reg [31:0] m;
reg [63:0] a; reg [(512*8)-1:0] b; reg [2:0] c;
initial begin
b = 0;
c = 0;
d = 0;
m = 0;
e = 9'd256 + 9'd32; // This one works
a = b >> {(e - d[4:0] - (9'd8 - c) + {(m - 1'b1),3'o0}),3'o0}; // This one doesn't
a = b >> {(9'd256 + 9'd32 - d[4:0] - (9'd8 - c) + {(m -
1'b1),3'o0}),3'o0}; $display("%m : 0x%h",a);
endendmodule
produces:
[EMAIL PROTECTED] DT_mark_cosim]$ iverilog junk.v
junk.v:22: error: operand of concatenation has indefinite width:
((('d288)-(+d[4:0]))-((9'b000001000)-(c[2:0])))+({(m[31:0])-(1'b1), 3'b000})
1 error(s) during elaboration.Best regards,
Mark
Stephen Williams wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
The problem is "m - 1'b1". The variable "m" is an integer which has an indefinite width. (For example, it can have different widths on different compilers.) Replace that with "reg signed [31:0]" if you want to be explicit about its size.
Yes, other compilers will accept this, but they are all wrong:-)
Mark Schellhorn wrote: | I have the following code snippet that fails compilation under icarus | 0.8.1 with this message: | | [EMAIL PROTECTED] DT_mark_cosim]$ iverilog junk.v | junk.v:20: error: operand of concatenation has indefinite width: | ((('d288)-(+d[4:0]))-((9'b000001000)-(c[2:0])))+({(+m[31:0])-(1'b1), | 3'b000}) | 1 error(s) during elaboration. | | It looks like icarus doesn't like the "9'd256 + 9'd32", but I don't | think there's anything illegal about it? | | module junk; | | integer d, e, m; | | reg [63:0] a; | reg [(512*8)-1:0] b; | reg [2:0] c; | | initial begin | b = 0; | c = 0; | d = 0; | m = 0; | e = 9'd256 + 9'd32; | | // This one works | a = b >> {(e - d[4:0] - (9'd8 - c) + {(m - 1'b1),3'o0}),3'o0}; | | // This one doesn't | a = b >> {(9'd256 + 9'd32 - d[4:0] - (9'd8 - c) + {(m - | 1'b1),3'o0}),3'o0}; | | $display("%m : 0x%h",a); | end | endmodule |
- -- Steve Williams "The woods are lovely, dark and deep. steve at icarus.com But I have promises to keep, http://www.icarus.com and lines to code before I sleep, http://www.picturel.com And lines to code before I sleep." -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFCNv7krPt1Sc2b3ikRAkUnAJ9d60EuVLn0OCgdKILFIVt9JRRsPACfWiHw KQFsefWsV3XkhbsLjUR8L1s= =iDFH -----END PGP SIGNATURE-----
