0

I have defined

reg bricks[0:3][0:7]

in Verilog Module. How can I assign this 2d array as

{{1,1,1,0,1,1,1},{1,1,1,0,1,1,1},{1,1,1,0,1,1,1},{1,1,1,0,1,1,1}}.

Please help

3
  • Assign it how? As a default value, or during operation? Commented Apr 10, 2013 at 16:39
  • 3
    Are you sure you want a 2d array of bits, and not a 1d array of a multi-bit value? e.g. reg [7:0] bricks[0:3] Commented Apr 10, 2013 at 19:17
  • this link covers some of what you are asking. As mentioned there you cannot do a direct initialization the way you mentioned in verilog. But tools that synthesize system verilog might support the format you have. Commented Aug 13, 2013 at 15:39

1 Answer 1

3
reg bricks [0:3][0:7];     //creates an unpacked array 
                           // It means you can access individual bits

bricks[1][0] = 0 ;         // Assigns 0 to the bit referenced by 1 and 0 

bricks [2] = 0 ;           // Illegal Syntax

bricks [1][0:3] = 0 ;      //Illegal Syntax

System verilog provides much more flexibility

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

Comments

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.