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-18-2009, 01:13 PM
Kausi
Guest
 
Posts: n/a
Default Reading from a buffer

Hi,

I want to read and write into a buffer from another module without
first reading/writing it onto a port. Find my code snipet below-

module ABC ( clock ,
reset ,
InData ,
OutData ,
);

// Port Declarations

reg buff1[0:15][0:15];
reg buff2[0:15][0:15];

I want to write into buff1 from output of a verilog module, reorder
bits into buff2 and then pass it on to another module.

I could combine the three modules together which i want to avoid for
clarity.
I also could write it to a port and then read from it- which will
waste unnecessary resources and clock cycles.

Any suggestions ?

Kauser.
Reply With Quote
  #2 (permalink)  
Old 06-18-2009, 01:47 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Reading from a buffer

On Jun 18, 12:13*pm, Kausi <kauser.jo...@gmail.com> wrote:
> I want to read and write into a buffer from another module without
> first reading/writing it onto a port. Find my code snipet below-
>
> module *ABC ( clock * * * * ,
> * * * * * * * * * * * reset * * * * *,
> * * * * * * * * * * * InData * * * *,
> * * * * * * * * * * * OutData * * ,
> * * * * * * * * * * );
>
> * * * // Port Declarations
>
> * * * * * reg * * * *buff1[0:15][0:15];
> * * * * * reg * * * *buff2[0:15][0:15];
>
> I want to write into buff1 from output of a verilog module, reorder
> bits into buff2 and then pass it on to another module.


I'm not sure how this relates to the ports on your module ABC.

> I could combine the three modules together which i want to avoid for
> clarity.
> I also could write it to a port and then read from it- which will
> waste unnecessary resources and clock cycles.


What makes you think that passing data through a port
will "waste resources and clock cycles"? Ports are just
connections....
--
Jonathan Bromley
Reply With Quote
  #3 (permalink)  
Old 06-18-2009, 04:14 PM
gabor
Guest
 
Posts: n/a
Default Re: Reading from a buffer

On Jun 18, 7:47*am, Jonathan Bromley <s...@oxfordbromley.plus.com>
wrote:
> On Jun 18, 12:13*pm, Kausi <kauser.jo...@gmail.com> wrote:
>
>
>
> > I want to read and write into a buffer from another module without
> > first reading/writing it onto a port. Find my code snipet below-

>
> > module *ABC ( clock * * * * ,
> > * * * * * * * * * * * reset * * * * *,
> > * * * * * * * * * * * InData * * * *,
> > * * * * * * * * * * * OutData * * ,
> > * * * * * * * * * * );

>
> > * * * // Port Declarations

>
> > * * * * * reg * * * *buff1[0:15][0:15];
> > * * * * * reg * * * *buff2[0:15][0:15];

>
> > I want to write into buff1 from output of a verilog module, reorder
> > bits into buff2 and then pass it on to another module.

>
> I'm not sure how this relates to the ports on your module ABC.
>
> > I could combine the three modules together which i want to avoid for
> > clarity.
> > I also could write it to a port and then read from it- which will
> > waste unnecessary resources and clock cycles.

>
> What makes you think that passing data through a port
> will "waste resources and clock cycles"? *Ports are just
> connections....
> --
> Jonathan Bromley


I think the point is that his memory arrays cannot be
directly used as module ports. For simulation you could
use direct hierarchy access to the memory, but for
synthesis the only reasonable approach is to put all
access to the memory array in the module where it is
defined. Address and data bus ports to the memory
can certainly be routed via module ports without any
additional "resources and clock cycles" but the
memories themselves cannot be directly accessed for
synthesis from another module, since the RAM elements
inferred would not allow this.

Regards,
Gabor
Reply With Quote
  #4 (permalink)  
Old 06-19-2009, 07:35 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Reading from a buffer

On Thu, 18 Jun 2009 07:14:58 -0700 (PDT), gabor wrote:

>I think the point is that his memory arrays cannot be
>directly used as module ports.


True; Verilog ports must be simple vectors.

>For simulation you could
>use direct hierarchy access to the memory, but for
>synthesis the only reasonable approach is to put all
>access to the memory array in the module where it is
>defined. Address and data bus ports to the memory
>can certainly be routed via module ports without any
>additional "resources and clock cycles" but the
>memories themselves cannot be directly accessed for
>synthesis from another module, since the RAM elements
>inferred would not allow this.


I agree with all of this, but I still don't get it.

If you have a memory block, then it can only be
accessed through its address and data signals,
whether or not it's in the same module. Passing
those address and data signals through ports of
the enclosing module costs nothing.

If a given module can access any and all locations
of a memory simultaneously, then that isn't a
memory (except in the Verilog LRM-jargon sense);
it's just a large collection of flip-flops. You
can easily gain access to that from another module,
simply by flattening the memory's contents to a
single big vector and passing said vector through
the module port. That's tiresome, but not difficult.

In summary, I agree with Gabor but I still don't
understand what the OP was asking.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
j[email protected]
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Reply With Quote
  #5 (permalink)  
Old 06-23-2009, 01:29 PM
Kausi
Guest
 
Posts: n/a
Default Re: Reading from a buffer

Sorry about the way my question was posted. But i did get the answer
from the discussion.

Thanks.
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
Buffer [email protected] VHDL 2 03-11-2008 07:20 PM
need help on asynchronous buffer Jdon FPGA 8 03-22-2006 05:49 PM
Buffer? rsk Verilog 1 02-28-2005 09:06 PM
why ISE par does not tell me all buffer usage? QiDaNei FPGA 1 02-20-2004 12:50 PM
buffer port Max VHDL 1 09-22-2003 12:41 PM


All times are GMT +1. The time now is 01:22 AM.


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