- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: RAM synthesis in registers instead of LUT
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-04-2012 02:21 PM
trounds wrote:
Thanks for the quick response. I only specify an initial condition with this is generated as part of simulation. There is no initial condition for the code specific to synthesis. Why doesn't the software know this?
Your code in the first post in this thread looks correct.
Are you sure you set the generic properly in the synthesis options? I assume that the SIM_ENB constant is set by a generic in the entity's port list, and I futher assume that the entity in question isn't the top level of the FPGA design.
You have to make sure that the generic filters all the way up to the top of the hierarchy, so it can be set in the synthesis and simulation options. Otherwise, the tools will assume the default (which isn't clear from the code you posted) and honestly, I don't know what happens in absence of a default.
My guess is that the synthesis tool is actually using the SIM_RESULT_RAM.
And for what it's worth: when you infer a memory, the simulation tool doesn't magically know that your code refers to a specific library element. It just simulates exactly what you code.
Finally, what Bob suggests about an initializer should be correct. So something like:
type lutram_t is array (0 to 15) of std_logic_vector(47 downto 0);
signal lutram : lutram_t := (others => (others => '0')); -- <<== this is the initializer
signal addr : natural range 0 to 15;
signal foo : std_logic_vector(47 downto 0);
u_lutram : process (clk) is
begin
if rising_edge(clk) then
if we = '1' then
lutram(addr) <= foo;
end if;
end if;
end process u_lutram;
that oughta do it.
----------------------------------------------------------------
Yes, I do this for a living.
Re: RAM synthesis in registers instead of LUT
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-05-2012 11:18 AM
Thank you both! I should have thought of setting the initializer properly instead of writing special VHDL code to do it when I wanted to simulate. That works like a charm for simulation and synthesis and I can get rid of the SIM_ENB generic.
Though I am still surprised that the inclusion of the few lines that initialize the RAM to 0's when SIM_ENB=TRUE affects the synthesized code when SIM_ENB=FALSE. I would have thought it would be ignored entirely. Isn't that what conditional code generation is all about? BTW that's a rhetorical question so no answer is needed.
Cheers all.
Re: RAM synthesis in registers instead of LUT
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-05-2012 11:59 AM
trounds wrote:
Though I am still surprised that the inclusion of the few lines that initialize the RAM to 0's when SIM_ENB=TRUE affects the synthesized code when SIM_ENB=FALSE. I would have thought it would be ignored entirely. Isn't that what conditional code generation is all about? BTW that's a rhetorical question so no answer is needed.
I still think the SIM_ENB isn't being set the way you think it is for the case where it's supposed to be FALSE. Check your synthesis reports.
----------------------------------------------------------------
Yes, I do this for a living.











