Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)

Help with LPM_ROM!

Altera_Forum
Honored Contributor II
2,045 Views

Hi guys,  

 

Im relatively new to Quartus/VHDL so forgive me if I sound like I don't know what i'm talking about! 

 

I am using small 2-wheeled robot with a cyclone II fpga. It has 2 photo-transistor inputs. 

 

I have done various projects with it before but i'm still not exactly confident with Quartus and VHDL coding. 

 

The problem... 

 

I want to use an LPM_ROM block to store a number of sequences (arrays perhaps?) so that when the photo-transistors drive over a surafce with just black and white (binary) markings, it scans the LPM_ROM for that sequence. 

 

i.e. black, black white = memory 1 - light LED 1 

white, white, white = memory 2 - light LED 2 

black, white , black = memory 3 - light LED 3 

 

so if it drives over a surface, the correct LED shall light up for example. 

 

I apologise for the explanation, I'd be happy to break it down and/or give other details if required! 

 

Thanks for looking, I await any help/advice/comments! :)
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
837 Views

Sounds like you want a lookup table. You can make the sequence the ROM address and the memory contents what you want to output to the LEDs. That way you can hook up the output of the memory directly to the LEDs. There is a memory editor included in Quartus II that you can use to pre-initialize the contents in the .mif or .hex file.

0 Kudos
Altera_Forum
Honored Contributor II
837 Views

Thanks for the reply, 

 

For making the sequence the address, lets say the sequence is 10010111, could the address be 97 and just state the radix as hex or would it have to be set to bin? 

- If it has to be binary, what would the syntax be to state it and separate each bit? 

 

Also, when you say the memory editor, do you mean the LPM_ROM mega wizard?
0 Kudos
Altera_Forum
Honored Contributor II
837 Views

Maybe you can use the $readmemb command to initialize the look-up table. You will have to make a memory list file.

0 Kudos
Altera_Forum
Honored Contributor II
837 Views

There is a memory editor in the Quartus II software that supports various radix representations. You tell it the memory characteristics and it will display the contents accordingly. Normally when I use it to code the outputs of a state machine I use spreadsheet software to encode my bits and then copy the contents over into the Quartus II memory editor window.

0 Kudos
Reply