SRAM bidirectional bus
by ALuPin » Wed, 25 Feb 2004 23:49:25 GMT
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.
Re: SRAM bidirectional bus
by Jonathan Bromley » Thu, 26 Feb 2004 01:05:13 GMT
Registered by a clock?
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.
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);
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');
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: XXXX@XXXXX.COM
Fax: +44 (0)1425 471573 Web: http://www.**--****.com/
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Re: SRAM bidirectional bus
by ALuPin » Thu, 26 Feb 2004 16:28:22 GMT
>l_read_enable <= l_we_bar and (not l_cs_bar) and (not l_oe_bar);
One additional thing:
l_sram_data_out are the data to WRITE into the SRAM.
Is the VHDL code correct concerning that?
Rgds
Andr V.
Re: SRAM bidirectional bus
by Jonathan Bromley » Thu, 26 Feb 2004 17:50:42 GMT
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: XXXX@XXXXX.COM
Fax: +44 (0)1425 471573 Web: http://www.**--****.com/
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Re: SRAM bidirectional bus
by ALuPin » Sat, 28 Feb 2004 16:32:38 GMT
> In particular, you will not be able to infer a data out enable
Can you explain what you mean?
Thank you very much.
Best regards
Andr Vazquez
G&D
Re: SRAM bidirectional bus
by bittor » Thu, 23 Dec 2004 23:45:16 GMT
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
Re: SRAM bidirectional bus
by bittor » Thu, 23 Dec 2004 23:47:46 GMT
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
Similar Threads:
1.SRAM controller bidirectional port VHDL
Hello,
I must do a simple controller for a SRAM in VHDL. I must store datas and
read the same datas from the SRAM. Someone has something similar to this?
Thanks
2.Bidirectional Bus delay modeling
I need to model my board delay from my FPGA model from/to my SDRAM model. I
was trying to do this in Modelsim using a specy block, but can't seem to get
it right...
Dave K.
3.bidirectional bus sanity check
I'm a lone Verilog-er at my present company and need a sanity check for
some busses that I've coded into a PLD.
My PLD interfaces with an ASIC and a processor. The PLD is supposed to
poll the ASIC every few hundred clocks and do some maintenance thereto.
The processor can also read and write to the ASIC when it needs to. I
think my arbitration is okay, but I feel shaky about my bidirectionals:
/*************************************/
// port declarations
inout [7:0] dataB_up; // data bus to/from processor
inout [7:0] dataB_asic; // data bus to/from asic
// internals
wire [7:0] data_up;
wire [7:0] data_asic;
reg [7:0] dout_asic; // to output to asic when I write
// logic
// n.b., read and write are active low
// "poll" is the signal that tells me that it's time to poll, or i'm in
// the middle of a poll read/write sequence.
assign data_up = dataB_up;
assign dataB_up = _rd ? 8'hzz : data_asic;
assign data_cirrus = dataB_asic;
assign dataB_cirrus = _wr ? 8'hzz : (poll ? dout_asic : data_up);
/**********************************/
Anybody see any issues? Many thanks -
Bmarchio
4.Please help with bidirectional data bus code..........
Hello,i am new to Verilog HDL.i have a module with a inout signal.But
i don't know what problem to my verilog code.
I want to write a module like this:
<----->DATA |
------>ADDR |
------>WR |
------>RD |
------>RESET|
DATA is an inout signal,controled by WR or RD(Write enable or Read
enable).ADDR is address.
Here is my verilog code:
module mem(ADDR,DATA,RD,WR,RESET);
input [7:0] ADDR;
inout [7:0] DATA;
tri [7:0] DATA;
input RESET;
input WR;
input RD;
reg [7:0] b[0:255];
reg [7:0] a;
assign DATA = (WR)? a : 8'bz ;
always @ (posedge WR or RD or RESET)
begin
if (!RESET)
a<=8'bz;
else if(RD)
b[ADDR]<=DATA;
else if(WR)
a <= b[ADDR];
else
a<=8'bz;
end
endmodule
But simulation result was wrong.Please tell me how should I fix it,or
another method to implement bidirectional data,thx.
Have a nice day.
5.Verifying a Bidirectional Data Bus
I have had reasonable success verifying some designs using behavioral
verilog and modelsim.
I seem to have trouble with bidirectional data buses. I have a handful
of verilog books, but none of
their simulation examples use bidirectional buses. Someone told me I
must use a transactor?
If anyone can point me to a text or has any tips it would be
appreciated.
6. Bidirectional (bus) delay help needed
7. mapping bidirectional busses
8. Bidirectional bus in Spartan-3