If a table have variable length value, how to look up the table in RTL fast ?
what about using CAM?
can anyone introduce some methods to implementing looking up table in RTL level?
thanks!
on one answer me?
when decoding bitstream, i should look up a decoding-table. the table is large and has
varible length content, so i don't know how to implement it in RTL. the table can be saved in ram but how to save it? someone say dividing the table into several segments is good, but how to dividing it?
anyone can help me?
hi,
1.
some vendor provide CAM core ,and you can get CAM simulation lib ,then use it in your RTL.
2.
if not ,use verilog reg array to build a lookup table,using the max length as the array width .
this way may lead to large die area consumed if the look-up table is big.
3.
if your target is FPGA,then using CAM or LUT or something in FPGA.
thank you!
our target is ASIC, and the size can't be too big.
so the regsiter array is not good.
we want to save the table in the RAM, but the critical problem is how to look up the content?
for example:
when received one bitstream, i should compare the bitstream and the table in the RAM, output the result of looking-up. otherwise, the bitstream is not fixed-length.
do you have any advices for it?
You've mentioned that you need a dynamic look-up table whose contents/size can be modified and thatn you are targetting ASIC. There's a contradiction here... First, hardware structure or size cannot be modified/changed dynamically.
What you can do, is to design a ROM of fixed size by first deciding on an upper memory limit and the number of data that are going to be stored in the ROM table. Then hardcode the ROM with the values of the table. This way you have created a lookup table. The only drawback here is that you cannot modify the contents of the ROM later. This is the method followed in storing the instructions in processors.
If you implemet this table in RAM, you will loose all the data when the chip looses power and to overcome this you will have to use a external ROM to load the data back in.
If a table have variable length value, how to look up the table in RTL fast ?
what about using CAM?
can anyone introduce some methods to implementing looking up table in RTL level?
thanks!
hi,
I think how to design a look-up table depends much on the requirements of your design.
1. if your input value for look-up varies in its bit-length, try to define the min & max length
----> the min length will be the depth of your unit table.
----> The max leng will define how many unit tables that you need
2.ex: you need to look up this [a2a1a0][b4b3b2b1b0] for a data of 16 bits
----> divide the look up table in to ([a2a1a0]max)=8 unit table
-----> ([b4b3b2b1b0])max = 32 ----> unit table size = 32x16
so you can look-up in parallel on 8 unit-table --> decode --> your desire lookup value
using CAM will result in large size, sequential looking-up a table will result in a waste of time. i must balance the size and time. does anyone more advise?
to ami,
your solution for table structure is good for me, can you explain more? because
how to look-up the table is critical!
to avimit,
using case structure (DFF) will result in huge size, as the table is very large!
hello xldu,
tell me what exactly you want to implement, and then I may be able to give you a better edvice.
In some applications, only a few values are stored in a lookup table at regular intervals, while the others may be calculated using the stored values and linear interpolation.
Kr,
Aviral Mittal
Hi,
this is the heart code of my CAM (search unit table),
Code:
reg [W-1:0] cam_reg [D-1:0];
reg [D-1:0] match;
integer i;
always @ (posedge clock or negedge reset)
if (!reset)
begin
match <= {D{1'b0}};
end
else
begin
for (i=0;i<D;i=i+1) match[i] <= (search_data == cam_reg[i]);
end
----> then, simply decode the "match" register ----> search result
this code works well with D=8 (256 locations), W=32 @155MHz
* Hope this help
Regards
Added after 33 minutes:
xldu said:
to avimit,
using case structure (DFF) will result in huge size, as the table is very large!
yes, building the CAM with DFF cost much area, but you must accept that if the time for search result is important.
The CAM I give you above (4 unit of 256x32) cost 112422 area (a DFF with drive strength =1 cost 30 area).
Regards
Added after 11 minutes:
Another experience in this: if you use RAM for search, you must use many design tricks. Then, it will make your design more complex and hard to change afterward.
Using logic cell in such design like this cost area but it worth its weight in gold. If you use RAMs, there will many small RAMs in your design----> cost area in total too and you will face the difficult in P&R later.
It's my experience and I have paid for it
Regards[/b]
Yes,
But we can use HDL to build something which functions like the comercial CAM, OK?
(self-bulding one will not be optimization like comercial CAM, but it still function well in many case)