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

ROM outputting values incorrectly

Altera_Forum
Honored Contributor II
1,314 Views

Hello, 

 

I am working on a project for my Electrical and Computer Engineering class at my college. I am supposed to save the patterns to make each number from 0 to 255 display on 7-segment displays into a ROM. (For example, the pattern for 136 would be 11111001 10110000 10000011, where the first bit is just a placeholder, and the rest of the bits are for segments 6-0 of a 7-segment display). 

 

I have inputted all patterns into a .mif file and checked that they are the proper patterns for each input. I have run simulations to make sure everything is working as intended and outputs for all numbers are correct. However, it seems that the output for each input is behind one (as in, if I input 1, the pattern outputted is what is intended for 0). 

 

I am not sure what's going wrong. If anyone has an idea, please help. 

 

My class uses version 9.1 sp2.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
560 Views

You should post some code. 

Probably it's only a matter of reading the data out of ROM before latching to the 7-seg registers. 

If you do it on the same clock edge, you'd latch on the display the previous data.
0 Kudos
Altera_Forum
Honored Contributor II
560 Views

If you inferred the ROM from HDL code, it can be expected to behave exactly as described in the code. 

 

If it's a ROM MegaFunction, please consider that addresses are registered on rising edge of the clock. Data output will either appear shortly after the new address takes effect (unregistered mode) after the next clock edge (registered mode). Check the MegaFunction settings for output registering.
0 Kudos
Altera_Forum
Honored Contributor II
560 Views

 

--- Quote Start ---  

If it's a ROM MegaFunction, please consider that addresses are registered on rising edge of the clock. Data output will either appear shortly after the new address takes effect (unregistered mode) after the next clock edge (registered mode). 

--- Quote End ---  

 

 

Thank you, FvM! Since we set the MegaFunction to be registered for the output, I messed around with the clock's frequency in simulations and realized it was doing just what you were describing. I imagine once I can test it on hardware everything will be set. Thanks again!
0 Kudos
Reply