Way to initialize synthesizable 2D array with constant values in Verilog

前端 未结 4 1185
陌清茗
陌清茗 2021-01-06 00:58

in VHDL, I can easily do this:

constant    cmdbytes       : bytearray(0 to Total) := (x\"05\", x\"00\", x...};

I want synthesizable constan

4条回答
  •  余生分开走
    2021-01-06 01:27

    module test (
    
       input [7:0]   p1_sa,            // i
       input [7:0]   p1_sb,            // i
       output [7:0]   p3,            // o
       output [7:0]   p3b            // o
    );
    
    logic [7:0] array2d [7:0] = {99,124,119,123,242,107,111,197};
    
       assign p3    = array2d[p1_sa];
       assign p3b   = array2d[p1_sb];
    
    endmodule
    

    I tried the above system verilog code and it is working fine in modelsim and Vivado.

提交回复
热议问题