2013-04-10 99 views
0

我已用Verilog模塊定義2D陣列以Verilog

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

。 我如何分配這個二維數組作爲

{{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}}. 

請幫

+0

指定它怎麼樣?作爲默認值,還是在操作過程中? – Tim 2013-04-10 16:39:27

+0

最初分配它 – skjindal93 2013-04-10 16:51:45

+3

你確定你想要一個二維數組,而不是一個多位值的一維數組嗎?例如'reg [7:0] bricks [0:3]' – dwikle 2013-04-10 19:17:06

回答

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 

系統的Verilog提供了更多的靈活性