10 Replies Latest reply on Dec 14, 2016 5:21 AM by userc_39305

# LookUp table with more than 5 input?

Hi, How to create LookUp table with more than 5 input. For example 16 inputs and 16 outputs? Maybe with varilog? Because standart LookUp table companent has max 5 input.
• ###### 1. Re: LookUp table with more than 5 input?

Welcome in the forum.

Principally a Verilog solution would work, but a 16 input logic would require a switch statement with 65000 cases which with 16 outputs would result in a 130 kB memory requirement. This will even not fit into a C-language programmed LUT  in a PSoC.

What is exactly your problem, what do you want to perform, what frequency is required?

Bob

• ###### 2. Re: LookUp table with more than 5 input?

Thank you very much Bob.

I have binary words generated by Pseudo random sequence (PRS) generator. I'd like to create table where each PRS word will be equivalent to decimal numbers. And then to search decimal number by PRS binary word or vice versa by decimal number to search PRS binary word. PRS words will come by SPI and decimal number(of course in binary ) will return by SPI.

For example: 12-bit PRS table, in total 4095 binary word. First PRS binary word 000000000001 = 1, ..., 101000100000 = 123,... etc.

I have thought that if to create table PRS word = decimal number (of course, decimal means binary) and will write verilog code. it must work faster at UDB than and Cortex-M3 CPU.

• ###### 3. Re: LookUp table with more than 5 input?

You cannot access memory through UDB, neither sram nor flash.

Bob

• ###### 4. Re: LookUp table with more than 5 input?

Sorry, i'm just started to deal with UDB. I didn't think about sram or flash.   I thought to create some array or range with PRS binary words in Verilog, up to 15 bit. I thought that once it created with Verilog it must be inside UDB. Then need to write function that get PRS word received by SPI and return array index of this PRS word. Or to create lookup table 15 x 15.

• ###### 5. Re: LookUp table with more than 5 input?

"to create some array " This array will need a place to store it, ram or rom. Not possible for a UDB.

Bob

• ###### 6. Re: LookUp table with more than 5 input?

Ok. Could you advice the fastest way for  PSoC 5LP, where need to place array of constants (32768 constants) that then get array index of constant? Array of constants must be created once while compiling.

• ###### 7. Re: LookUp table with more than 5 input?

Use

const uint16 YourArray[] = { your 32k values go here, comma separated};

hoping the compiler doesn't get a hiccup ;-)

Bob

• ###### 8. Re: LookUp table with more than 5 input?

Dear Bob, i know how to create array. My question about where to place array? Or it is mean that i can't control where it will be placed, can't to point for compiler where to place array? For example, how to place in RAM?

• ###### 9. Re: LookUp table with more than 5 input?

You cannot place your array in ram. Max sram for PSoC5 is 64k.

Better use a raspberry pi. PSoCs are really good for embedded applications as controllers etc, not for larger data.

For placing data at defined addresses consult the GCC manuals.

Bob

• ###### 10. Re: LookUp table with more than 5 input?

Thanks. And last question. :) For example I take 14-bit array and will place it in 32 KB SRAM in SRAM region ( Data Address Map)

What do you think, how many time need to search  array index by 14bit word. I understand that it will be simple sorting, one by one. Or how to count it? How many MCU cycle need to search in SRAM?