Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21069 Discussions

How to define contant look up tables (LUT) ??

Altera_Forum
Honored Contributor II
1,742 Views

Hello.. 

 

I can define LUT4 (4 input, 16 bit init value) and LUT5 (5 input, 32 bit init value) look up tables with constant values on Lattice Diamond in this way; 

 

 

LUT5  

# (.init (32'h330FF0CC)) 

I1 ( .A (x_in[0]), .B (x_in[1]), .C (k_in[0]), .D (k_in[1]), .E (k_in[2]), .Z (f_out) ); 

 

LUT4  

# (.init (16'h00D8)) 

I1 ( .A (k_in[0]), .B (k_in[1]), .C (k_in[2]), .D (1'b0), .Z (f_out) ); 

 

is there a simple way for this purpose on Altera Quartus (Verilog language, EP3C25E144N fpga CIII) ??  

 

Thanks..
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
735 Views

Quartus has a cycloneiii_lcell_comb primitive for this purpose. See the users guide designing with low-level primitives. But what do you want to achieve?

0 Kudos
Altera_Forum
Honored Contributor II
735 Views

I want to build hundreds of 32 bit input and 16 bit input look up tables inside the fpga. But they must work very fast and spend minimum logic cells. 

 

there is also LPM_MUX plugin in the wizard.  

 

- Is this a simple LUT generator? Are there wasted logic cells on the design output? 

- is it the way for the fastest LUT generation? Or the primitives method output is faster? 

 

Thanks..
0 Kudos
Altera_Forum
Honored Contributor II
735 Views

Did you consider to build the look-up tables with internal ROM? 

 

Generally, I would leave logic cell selection and timing optimization to the design compiler by writing a behavioral description, and timing constraints, if necessary.
0 Kudos
Altera_Forum
Honored Contributor II
735 Views

Thanks FvM,  

i'll try LPM_MUX plugin and see the result..
0 Kudos
Altera_Forum
Honored Contributor II
735 Views

You can just create a behavioral description, like the one below. 

The tools will then sort it out for you. 

 

module LUT4 (input wire A, input wire B, input wire C, input wire D, output wire Z); 

param INIT=16'b0000_0000_0000_0000; 

assign Z <= INIT[{D, C, B, A}]; 

endmodule
0 Kudos
Reply