FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2009, 03:30 PM
Kausi
Guest
 
Posts: n/a
Default $readmemh()

Is $readmemh synthesizable ?

Iam using Xilinx ISE 9.2i..

If yes does can i use a .txt or .hex file or is there some other
format ?
Reply With Quote
  #2 (permalink)  
Old 06-11-2009, 03:49 PM
Andreas Ehliar
Guest
 
Posts: n/a
Default Re: $readmemh()

On 2009-06-11, Kausi <kauser.johar@gmail.com> wrote:
> Is $readmemh synthesizable ?
>
> Iam using Xilinx ISE 9.2i..
>
> If yes does can i use a .txt or .hex file or is there some other
> format ?


Yes, at least according to the ISE 9.2 documentation. Take a look at
doc/usenglish/books/docs/xst/xst.pdf in your ISE folder.

/Andreas

Reply With Quote
  #3 (permalink)  
Old 06-11-2009, 04:22 PM
LittleAlex
Guest
 
Posts: n/a
Default Re: $readmemh()

On Jun 11, 7:30*am, Kausi <kauser.jo...@gmail.com> wrote:
> Is $readmemh synthesizable ?
>


You're kidding, right?
Reply With Quote
  #4 (permalink)  
Old 06-11-2009, 06:20 PM
glen herrmannsfeldt
Guest
 
Posts: n/a
Default Re: $readmemh()

LittleAlex <alex.louie@email.com> wrote:
> On Jun 11, 7:30?am, Kausi <kauser.jo...@gmail.com> wrote:
>> Is $readmemh synthesizable ?


> You're kidding, right?


When I first learned about it, $readmemh was for initializing ROMs.

I don't know how else it is used, but a convenient way to
load large tables into ROM would be nice.

-- glen
Reply With Quote
  #5 (permalink)  
Old 06-11-2009, 09:11 PM
Kausi
Guest
 
Posts: n/a
Default Re: $readmemh()

I did check out the XST document. I guess that would be a good enough
guide to know if the code would be synthesizable.. And surprisingly it
does mention the use of $readmemh.. I tried to create a ROM model and
initialized it using a .mem file... It does not throw any error in the
synthesis report.. But somehow it doesn't initialize it correctly
either.

I have another question.. I need to design a block interleaver.
Contents of input buffer are written to an output buffer. The
challenge is to do it in one clock cycle- for which i will need a very
large buffer. The problem is i need to create a matrix of buffers
( possibly 16*6) and read in one go.. Any suggestions ? How do i
normally go about designing a multi dimentional buffer.

Kauser.
Reply With Quote
  #6 (permalink)  
Old 06-11-2009, 11:53 PM
Muzaffer Kal
Guest
 
Posts: n/a
Default Re: $readmemh()

On Thu, 11 Jun 2009 13:11:00 -0700 (PDT), Kausi
<kauser.johar@gmail.com> wrote:

>I did check out the XST document. I guess that would be a good enough
>guide to know if the code would be synthesizable.. And surprisingly it
>does mention the use of $readmemh.. I tried to create a ROM model and
>initialized it using a .mem file... It does not throw any error in the
>synthesis report.. But somehow it doesn't initialize it correctly
>either.
>

Did you follow the instructions and the samples in the XST user guide
carefully? Also does you simulation load the memory correctly ? Make
sure that you can simulate, then XST should be able to use the same
file.
--
Muzaffer Kal

DSPIA INC.
ASIC/FPGA Design Services

http://www.dspia.com
Reply With Quote
  #7 (permalink)  
Old 06-11-2009, 11:58 PM
Muzaffer Kal
Guest
 
Posts: n/a
Default Re: $readmemh()

On Thu, 11 Jun 2009 08:22:08 -0700 (PDT), LittleAlex
<alex.louie@email.com> wrote:

>On Jun 11, 7:30*am, Kausi <kauser.jo...@gmail.com> wrote:
>> Is $readmemh synthesizable ?
>>

>
>You're kidding, right?


Suppose the synthesizer has a memory compiler which it can call to
generate the memory macros it finds in the design, then suppose that
the said memory compiler accepts a file name to initialize the
contents of the memories it generates. This would even work within an
ASIC flow for ROMs let alone in an FPGA flow where there is really no
uninitialized memory and all the contents of all memories (RAM & ROM
(which actually doesn't exist in an FPGA)) can be loaded to a bit file
to be downloaded to the FPGA. In that case this makes perfect sense.
--
Muzaffer Kal

DSPIA INC.
ASIC/FPGA Design Services

http://www.dspia.com
Reply With Quote
  #8 (permalink)  
Old 06-12-2009, 12:34 AM
glen herrmannsfeldt
Guest
 
Posts: n/a
Default Re: $readmemh()

Muzaffer Kal <kal@dspia.com> wrote:
(snip)
< This would even work within an
< ASIC flow for ROMs let alone in an FPGA flow where there is really no
< uninitialized memory and all the contents of all memories (RAM & ROM
< (which actually doesn't exist in an FPGA)) can be loaded to a bit file
< to be downloaded to the FPGA. In that case this makes perfect sense.

I believe that earlier FPGA families wouldn't guarantee the
ability to initialize RAM. That is, that write enable stay inactive
at the appropriate time. As I understand it, many now allow
for initialized RAM. ROM doesn't have write enable, so that
problem doesn't appear.

-- glen
Reply With Quote
  #9 (permalink)  
Old 06-16-2009, 12:26 PM
Andreas Ehliar
Guest
 
Posts: n/a
Default Re: $readmemh()

On 2009-06-16, gabor <gabor@alacron.com> wrote:
> XST is a little more restrictive than simulators. The $readmemh
> needs to be in an initial block in the same module where the
> memory array is declared. Other than that, it should match
> the simulation for generating initialized memories or ROMs.


In the past I've had problems when initiating part of a memory with
initial statements. For example, the following example didn't work
because the entire memory was not initialized:

reg [7:0] foo[15:0];

initial begin
foo[0] = 9;
foo[1] = 5;
end


In this case XST gave an error in the synthesis log file if I remember
correctly. I'm just guessing here, but perhaps the original poster is
having the same problems even though you are using $readmemh instead of
plain variable assignments to initialize your memory?

/Andreas
Reply With Quote
  #10 (permalink)  
Old 06-16-2009, 03:28 PM
gabor
Guest
 
Posts: n/a
Default Re: $readmemh()

On Jun 11, 6:53*pm, Muzaffer Kal <k...@dspia.com> wrote:
> On Thu, 11 Jun 2009 13:11:00 -0700 (PDT), Kausi
>
> <kauser.jo...@gmail.com> wrote:
> >I did check out the XST document. I guess that would be a good enough
> >guide to know if the code would be synthesizable.. And surprisingly it
> >does mention the use of $readmemh.. I tried to create a ROM model and
> >initialized it using a .mem file... It does not throw any error in the
> >synthesis report.. But somehow it doesn't initialize it correctly
> >either.

>
> Did you follow the instructions and the samples in the XST user guide
> carefully? Also does you simulation load the memory correctly ? Make
> sure that you can simulate, then XST should be able to use the same
> file.
> --
> Muzaffer Kal
>
> DSPIA INC.
> ASIC/FPGA Design Services
>
> http://www.dspia.com


XST is a little more restrictive than simulators. The $readmemh
needs to be in an initial block in the same module where the
memory array is declared. Other than that, it should match
the simulation for generating initialized memories or ROMs.
Reply With Quote
  #11 (permalink)  
Old 06-18-2009, 12:25 PM
Kausi
Guest
 
Posts: n/a
Default Re: $readmemh()

On 16 June, 12:26, Andreas Ehliar <ehliar-nos...@isy.liu.se> wrote:
> On 2009-06-16, gabor <ga...@alacron.com> wrote:
>
> > XST is a little more restrictive than simulators. *The $readmemh
> > needs to be in an initial block in the same module where the
> > memory array is declared. *Other than that, it should match
> > the simulation for generating initialized memories or ROMs.

>
> In the past I've had problems when initiating part of a memory with
> initial statements. For example, the following example didn't work
> because the entire memory was not initialized:
>
> reg [7:0] foo[15:0];
>
> initial begin
> * * foo[0] = 9;
> * * foo[1] = 5;
> end
>
> In this case XST gave an error in the synthesis log file if I remember
> correctly. I'm just guessing here, but perhaps the original poster is
> having the same problems even though you are using $readmemh instead of
> plain variable assignments to initialize your memory?
>
> /Andreas


When i try to initialize using $readmemh-> It only returns a warning
saying that the memory is tied to zero as it was partially
initialized.

reg mem [0:47];
initial $readmemb("ScDataIn.txt", mem);

The file contains 48 binary numbers.

Am i missing something ?
Reply With Quote
  #12 (permalink)  
Old 06-18-2009, 03:07 PM
gabor
Guest
 
Posts: n/a
Default Re: $readmemh()

On Jun 18, 7:25*am, Kausi <kauser.jo...@gmail.com> wrote:
> On 16 June, 12:26, Andreas Ehliar <ehliar-nos...@isy.liu.se> wrote:
>
>
>
> > On 2009-06-16, gabor <ga...@alacron.com> wrote:

>
> > > XST is a little more restrictive than simulators. *The $readmemh
> > > needs to be in an initial block in the same module where the
> > > memory array is declared. *Other than that, it should match
> > > the simulation for generating initialized memories or ROMs.

>
> > In the past I've had problems when initiating part of a memory with
> > initial statements. For example, the following example didn't work
> > because the entire memory was not initialized:

>
> > reg [7:0] foo[15:0];

>
> > initial begin
> > * * foo[0] = 9;
> > * * foo[1] = 5;
> > end

>
> > In this case XST gave an error in the synthesis log file if I remember
> > correctly. I'm just guessing here, but perhaps the original poster is
> > having the same problems even though you are using $readmemh instead of
> > plain variable assignments to initialize your memory?

>
> > /Andreas

>
> When i try to initialize using $readmemh-> It only returns a warning
> saying that the memory is tied to zero as it was partially
> initialized.
>
> reg * * * * * * *mem *[0:47];
> initial $readmemb("ScDataIn.txt", mem);
>
> The file contains 48 binary numbers.
>
> Am i missing something ?


Depending on the resource used to synthesize this memory,
e.g. distributed RAM or block RAM, the actual memory is
likely to be larger than 48 elements. Although you
initialized all of the memory you declared, the synthesis
tool will warn you about the remainder of memory it
inferred being uninitialized.

regards,
Gabor
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hex start address in $readmemh? Muzaffer Kal Verilog 1 03-29-2009 06:14 AM
XST and Verilog $readmemh johnp FPGA 1 04-12-2007 06:03 PM
Reading Large Files Using $readmemh Ganesh Verilog 2 04-04-2006 07:51 PM
Trouble with $readmemh in ModelSim Chris Carlen FPGA 8 07-02-2004 01:25 AM
Trouble with $readmemh in ModelSim Chris Carlen Verilog 9 07-02-2004 01:25 AM


All times are GMT +1. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved