Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > SRAM bidirectional bus

Reply
Thread Tools

SRAM bidirectional bus

 
 
ALuPin
Guest
Posts: n/a
 
      02-24-2004
Hi,

I have a question concerning the VHDL description of a bidirectional bus.

This bus comes from (goes to) an SRAM which I try to simulate with
a corresponding VHDL model.

Now I have an INOUT pin at my SRAM-Controller : Sram_data : inout(7 downto 0);

Within my SRAM-Controller I have the local signals
l_sram_data_out : std_logic_vector(7 downto 0);
l_sram_data_in : std_logic_vector(7 downto 0);


l_sram_data_out describes the data which I want to write into the SRAM.
l_sram_data_out is a registered signal.

l_sram_data_in describes the data I want to read from the SRAM.

The signal which is responsible for writing to the SRAM or reading out of
the SRAM is WE_bar.
WE_bar='0' & CS_bar='0' & OE_bar='1' ---> Write to the SRAM
WE_bar='1' & CS_bar='0' & OE_bar='0' ---> Read from the SRAM

How can I connect l_sram_data_out and l_sram_data_in
in a appropriate way to the bidirectional bus?

Does l_sram_data_in has to be synchronized? (It is used within the controller
in a synchronous environment)

I would appreciate any helpful hint.

Kind regards
André V.
 
Reply With Quote
 
 
 
 
Jonathan Bromley
Guest
Posts: n/a
 
      02-24-2004
"ALuPin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...

> Now I have an INOUT pin at my SRAM-Controller :
> Sram_data : inout(7 downto 0);
>
> Within my SRAM-Controller I have the local signals
> l_sram_data_out : std_logic_vector(7 downto 0);
> l_sram_data_in : std_logic_vector(7 downto 0);
>
> l_sram_data_out describes the data which I want to write into the SRAM.
> l_sram_data_out is a registered signal.


Registered by a clock?

> l_sram_data_in describes the data I want to read from the SRAM.


You probably don't need this signal. You can read the value
of the inout port directly. However, you may decide that it
makes the code clearer to have this extra internal signal.

> The signal which is responsible for writing to the SRAM
> or reading out of the SRAM is WE_bar.
> WE_bar='0' & CS_bar='0' & OE_bar='1' ---> Write to the SRAM
> WE_bar='1' & CS_bar='0' & OE_bar='0' ---> Read from the SRAM


As far as the inout port is concerned, the only important
question is: do I want the SRAM to drive a value out through
this port? That's easily answered:

signal Read_Enable: std_logic;
....
Read_Enable <= WE_bar and (not CS_bar) and (not OE_bar);

> How can I connect l_sram_data_out and l_sram_data_in
> in a appropriate way to the bidirectional bus?


l_sram_data_in <= sram_data; -- that's it, input is easy
-- Driving a tri-state inout port is the ONLY situation
-- where I find conditional signal assignment is useful:
sram_data <= l_sram_data_out when Read_Data = '1'
else (others => 'Z');

> Does l_sram_data_in has to be synchronized? (It is used
> within the controller in a synchronous environment)


That depends on your controller. Since the controller is
providing the SRAM control signals, it should be fairly easy
for you to guarantee that the SRAM's output (read) data is
stable and valid at the time when your synchronous controller
samples it.

--

Jonathan Bromley, Consultant

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

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: http://www.velocityreviews.com/forums/(E-Mail Removed)
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.



 
Reply With Quote
 
 
 
 
ALuPin
Guest
Posts: n/a
 
      02-25-2004
>l_read_enable <= l_we_bar and (not l_cs_bar) and (not l_oe_bar);

>l_sram_data_in <= Sram_data;
>Sram_data <= l_sram_data_out when l_read_enable = '1'
> else (others => 'Z');



One additional thing:

l_sram_data_out are the data to WRITE into the SRAM.

Is the VHDL code correct concerning that?

Rgds
Andrés V.
 
Reply With Quote
 
Jonathan Bromley
Guest
Posts: n/a
 
      02-25-2004
"ALuPin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...

> >l_read_enable <= l_we_bar and (not l_cs_bar) and (not l_oe_bar);

>
> >l_sram_data_in <= Sram_data;
> >Sram_data <= l_sram_data_out when l_read_enable = '1'
> > else (others => 'Z');

>
>
> One additional thing:
>
> l_sram_data_out are the data to WRITE into the SRAM.
>
> Is the VHDL code correct concerning that?


No, obviously it is not. I understood from your message
that this code was to form part of your SRAM model. If
the code is to be part of the CONTROLLER, then you will need
different behaviour.

In particular, you will not be able to infer a data out enable
control from the three memory control signals; it would
almost certainly cause write-data hold time violations at
the SRAM inputs.

However, my example correctly shows how to make tri-state
enable on an inout port. I guess you can go from there.

--

Jonathan Bromley, Consultant

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

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: (E-Mail Removed)
Fax: +44 (0)1425 471573 Web: http://www.doulos.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.



 
Reply With Quote
 
ALuPin
Guest
Posts: n/a
 
      02-27-2004
> In particular, you will not be able to infer a data out enable
> control from the three memory control signals; it would
> almost certainly cause write-data hold time violations at
> the SRAM inputs.



Can you explain what you mean?

Thank you very much.

Best regards

Andrés Vazquez
G&D
 
Reply With Quote
 
bittor
Guest
Posts: n/a
 
      12-22-2004
Hello,
I have the same problem. ALuPin, if you have your definitive vhdl code for
the SRAM. Please leave it here or if someone has something similar to use a
SRAM bidirectional bus...
Thanks

 
Reply With Quote
 
bittor
Guest
Posts: n/a
 
      12-22-2004
Hello,
If have the same problem. Alupin, if you have your definitive design
please leave it here. Or if someone has somethind silmilar to control
bidirectional port for SRAM...
Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bidirectional connection between two bidirectional ports Manfred Balik VHDL 12 09-10-2006 08:53 PM
Re: bidirectional bus Arnim Laeuger VHDL 2 12-20-2005 09:15 PM
Bidirectional bus in Spartan-3 rybol VHDL 3 09-09-2005 08:04 AM
SRAM controller bidirectional port VHDL bittor VHDL 0 12-22-2004 02:51 PM
Bidirectional (bus) delay help needed Nicolas Matringe VHDL 2 09-28-2004 06:24 AM



Advertisments