R
Ron Smith
Guest
Why does this work:
wire [1:0] foo,bar;
assign {foo,bar}=4'b1000;
at setting foo to 2'b10 and bar to 2'b00, but this gives a syntax error:
wire [1:0] foo,bar;
assign {foo,bar}=4'b0000;
assign {foo,bar}[3]=1'b1;
but this also works:
wire [3:0] foobar;
assign foobar=4'b0000;
assign foobar[3]=1'b1;
Please note that I'm not trying to argue over the finer points of style,
the above is simply a trivial and overly simplistic example of something
I tried that I thought "should" work, but of course it didn't.
wire [1:0] foo,bar;
assign {foo,bar}=4'b1000;
at setting foo to 2'b10 and bar to 2'b00, but this gives a syntax error:
wire [1:0] foo,bar;
assign {foo,bar}=4'b0000;
assign {foo,bar}[3]=1'b1;
but this also works:
wire [3:0] foobar;
assign foobar=4'b0000;
assign foobar[3]=1'b1;
Please note that I'm not trying to argue over the finer points of style,
the above is simply a trivial and overly simplistic example of something
I tried that I thought "should" work, but of course it didn't.