implementing a lookup table

Guest
Hi,

I want to implement a 3000-element lookup table where each entry is
8-bits wide. Each element in this prepopulated table contains the
modulo 256 of the input which is the element's index in the LUT; and
thus I am trading a modulo function for an LUT to save cycles.

Could someone let me know the best way to do this; and also what would
it synthesize to?

Thanks
 
On 18 Apr 2006 17:22:26 -0700, zeeshan.nazir@gmail.com wrote:

Hi,

I want to implement a 3000-element lookup table where each entry is
8-bits wide. Each element in this prepopulated table contains the
modulo 256 of the input which is the element's index in the LUT; and
thus I am trading a modulo function for an LUT to save cycles.
Isn't modulo 256 of the index the bottom 8 bits of the index ?
 
One solution:

case(index)
0: result = 0;
1: result = 1;
2: result = 2;
....
defualt: result = 8'bx;
endcase

You would probably want to write a quick perl script to generate
the RTL.

perl -e 'for(0..2999) {print " $_: result = ", ($_%161), ";\n";}'


Alternately, your could store an offset in the table, and add that to
the
lower 8 bits of the index.
For example
offset for 0, 1,...159, 160 = 0;
offset for 161, 162, ... 321 = 95; // 95+161 = 0 with an 8 bit adder

assign result = offset + index[7:0];

The would save a significant amount of area, but be a little bit
slower.

You asked what it would synthesize to, but I think you just have to try
it and see.
 
<zeeshan.nazir@gmail.com> wrote in message
news:1145406146.585931.145290@z34g2000cwc.googlegroups.com...
Hi,

I want to implement a 3000-element lookup table where each entry is
8-bits wide. Each element in this prepopulated table contains the
modulo 256 of the input which is the element's index in the LUT; and
thus I am trading a modulo function for an LUT to save cycles.

Could someone let me know the best way to do this; and also what would
it synthesize to?

Thanks
Are you going into an ASIC? A ROM primitive might be the best way to go -
you would need to find out what the vendor supports.

If you're targeting an FPGA, the way to initialize a 4kx8 memory structure
(typically made from more than one memory block) would be dependent on your
synthesis tools.
 

Welcome to EDABoard.com

Sponsor

Back
Top