How to implement an C array structure in verilog code

H

hutu

Guest
Dear All,

I have to convert a C code error check algorithm to verilog code. The C code
has a constant array. How to implement it in verilog?

Thanks a lot!


---
 
Verilog-1995 only supports one dimensional register array.
reg [DATA_WIDTH-1:0] CONSTANT_ARRAY[0:ARRAY_SIZE-1]

Verilog-2001 supports multi-dimensional array and you have to use a
simulator that supports the feature.

HTH,
Jim Wu
jimwu88NOOOOOSPAM@yahoo.com

hutu <hutu@microsoft.com> wrote in message
news:bgl706$p1m$1@adenine.netfront.net...
Dear All,

I have to convert a C code error check algorithm to verilog code. The C
code
has a constant array. How to implement it in verilog?

Thanks a lot!


---
 
"hutu" <hutu@microsoft.com> wrote in message news:<bgl706$p1m$1@adenine.netfront.net>...
I have to convert a C code error check algorithm to verilog code. The C code
has a constant array. How to implement it in verilog?
You declare an array, which is commonly called a memory in Verilog-1995,
and initialize it with your constant values in an initial block.

Typical declaration:

reg [31:0] arr [0:9]; // array of 10 32-bit words
 

Welcome to EDABoard.com

Sponsor

Back
Top