cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dberezin
Visitor
Visitor
2,018 Views
Registered: ‎04-21-2018

Calling a .coe file in Verilog Module

Jump to solution

Currently I'm working on a Verilog project in Vivado which uses a .coe file with a lookup sine table. I already loaded the file into the project and I want to call the table values into the module. I thought a good primary check could be assigning the sine values, that are integers from 0 to 255, as values to the Basys 3 LEDS, so I can check I'm effectively accessing these values.

 

Vivado generated a default named dist_mem_gen_0.xci module. The modules look like this: Captura de pantalla de 2018-04-21 19-53-35.png

 

How could I receive the sine values at the topm.v file. I mean, what should I write to manipulate these values and assign them to an output, like a LED. Thanks!

0 Kudos
1 Solution

Accepted Solutions
tedbooth
Scholar
Scholar
2,224 Views
Registered: ‎03-28-2016
  1. Modify the dist_mem_gen_0 so that it will load the seno.coe file.  Look for "Load COE File" in the IP's customization GUI.
  2. Instantiate the dist_mem_gen_0 in your top-level module (topm.v)
  3. Build a circuit that will cycle through all of the addresses in you dist_mem_gen_0.  (Typically a counter.  Connect the output of the counter to the address input of the dist_mem_gen_0.
  4. Connect the data output of the dist_mem_gen_0 to your LED output pins.  One bit per LED.

 

Ted Booth | Tech. Lead FPGA Design Engineer | DesignLinx Solutions
https://www.designlinxhs.com

View solution in original post

Tags (1)
3 Replies
tedbooth
Scholar
Scholar
2,225 Views
Registered: ‎03-28-2016
  1. Modify the dist_mem_gen_0 so that it will load the seno.coe file.  Look for "Load COE File" in the IP's customization GUI.
  2. Instantiate the dist_mem_gen_0 in your top-level module (topm.v)
  3. Build a circuit that will cycle through all of the addresses in you dist_mem_gen_0.  (Typically a counter.  Connect the output of the counter to the address input of the dist_mem_gen_0.
  4. Connect the data output of the dist_mem_gen_0 to your LED output pins.  One bit per LED.

 

Ted Booth | Tech. Lead FPGA Design Engineer | DesignLinx Solutions
https://www.designlinxhs.com

View solution in original post

Tags (1)
dberezin
Visitor
Visitor
1,961 Views
Registered: ‎04-21-2018

I loaded de .COE file and I thought about the counter, since I've done the same before put hardcoding the sine table in the .v module. What I don't know how to do is to instantiate the dist_mem_gen in my module. I don't know how to write that and how to call the variable that will take the sine values (probably it has a default name). Any chance you could help me with that or give me a similar example? Also, for such a task, should I use RAM or ROM memory? Thanks!

0 Kudos
dberezin
Visitor
Visitor
1,937 Views
Registered: ‎04-21-2018

I solved it already. I didn't know how to call variables or assign them when they weren't related to an input or output from the top module. So I realized the memory module had a diagram with an input a and an output spo. The input must depend on a variable that changes the value i'm reading so I created a variable a0 that changes with the clock. Spo just needed to be read, so I created a wire with the same name, whose value I can assign later to the leds. 

0 Kudos