Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Problem :(

Reply
Thread Tools

Problem :(

 
 
Wojtek
Guest
Posts: n/a
 
      05-01-2006
Hi, I have a problem:

entity Data_Bus_Buffer is

port(
clk : in std_logic;
P_I_Load : in std_logic;
P_I_Store : in std_logic;
P_IO_D0 : inout std_logic;
P_IO_D1 : inout std_logic;
P_IO_D2 : inout std_logic;
P_IO_D3 : inout std_logic;

P_IO_Bus : inout std_logic_vector(3 downto 0)

);

end Data_Bus_Buffer;

architecture Behavioral of Data_Bus_Buffer is



begin

zegar: process(clk,P_I_Load,P_I_Store)


begin

if (clk'event and clk = '1') then


if (P_I_Load = '1' and P_I_Store = '0') then

P_IO_Bus(3) <= P_IO_D3;
P_IO_Bus(2) <= P_IO_D2;
P_IO_Bus(1) <= P_IO_D1;
P_IO_Bus(0) <= P_IO_D0;


elsif (P_I_Load = '0' and P_I_Store = '1') then



P_IO_D3 <= P_IO_Bus(3);
P_IO_D2 <= P_IO_Bus(2);
P_IO_D1 <= P_IO_Bus(1);
P_IO_D0 <= P_IO_Bus(0);



else

P_IO_Bus <= "ZZZZ";
P_IO_D0 <= 'Z';
P_IO_D1 <= 'Z';
P_IO_D2 <= 'Z';
P_IO_D3 <= 'Z';

end if;
end if;

end process zegar;
end;




When i am simulating I can not initalize in testbench ports P_IO_DX before
P_I_Load = '0';

MAybe I should use only ports of type 'in' or 'out', and not inout ??


 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      05-01-2006
The 'zegar' process will be actively driving the P_IO_Dx inout signals
until AFTER the rising edge of clock that occurs when P_I_LOAD and
P_I_STORE are both either '0' or both '1'. You probably wanted
something more along the lines of what is pasted below.

zegar: process(clk,P_I_Load,P_I_Store)
begin
if (clk'event and clk = '1') then
if (P_I_Load = '1' and P_I_Store = '0') then
P_IO_Bus(3) <= P_IO_D3;
P_IO_Bus(2) <= P_IO_D2;
P_IO_Bus(1) <= P_IO_D1;
P_IO_Bus(0) <= P_IO_D0;
end if;
end if;
end process zegar;

zegar2 : process(P_I_LOAD, P_I_STORE, P_IO_BUS)
begin
if (P_I_Load = '0' and P_I_Store = '1') then
P_IO_D3 <= P_IO_Bus(3);
P_IO_D2 <= P_IO_Bus(2);
P_IO_D1 <= P_IO_Bus(1);
P_IO_D0 <= P_IO_Bus(0);
else
P_IO_Bus <= "ZZZZ";
P_IO_D0 <= 'Z';
P_IO_D1 <= 'Z';
P_IO_D2 <= 'Z';
P_IO_D3 <= 'Z';
end if;
end process zegar2;

KJ

 
Reply With Quote
 
 
 
 
Wojtek
Guest
Posts: n/a
 
      05-01-2006
>
> zegar: process(clk,P_I_Load,P_I_Store)



is it correct? Clk, P_I_Load, P_I_Store in this line? If yes, why not
P_IO_Dx ??

Thank you
Wojtek

 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      05-01-2006
Oops. No, it should just be

zegar: process(clk)

Nothing actually happens inside the 'zegar' process unless 'clk'
changes. When any of the other signals changes (without a coincidental
change in 'clk' as well) nothing happens inside the 'zegar' process
since the outermost loop looks for clk'event and clk = '1'.

KJ

 
Reply With Quote
 
Wojtek
Guest
Posts: n/a
 
      05-01-2006

Uzytkownik "KJ" <(E-Mail Removed)> napisal w wiadomosci
news:(E-Mail Removed) oups.com...
> Oops. No, it should just be
>
> zegar: process(clk)
>
> Nothing actually happens inside the 'zegar' process unless 'clk'
> changes. When any of the other signals changes (without a coincidental
> change in 'clk' as well) nothing happens inside the 'zegar' process
> since the outermost loop looks for clk'event and clk = '1'.
>
>




zegar2 : process(P_I_LOAD, P_I_STORE, P_IO_BUS)

and that is correct?

thank you so much

Wojtek

 
Reply With Quote
 
Wojtek
Guest
Posts: n/a
 
      05-01-2006

Uzytkownik "KJ" <(E-Mail Removed)> napisal w wiadomosci
news:(E-Mail Removed) oups.com...
> The 'zegar' process will be actively driving the P_IO_Dx inout signals
> until AFTER the rising edge of clock that occurs when P_I_LOAD and
> P_I_STORE are both either '0' or both '1'. You probably wanted
> something more along the lines of what is pasted below.



I would like to make data_buffer.


RAM <=> data_buffer <=> bus

bidirect lines are too dificult for me


Wojtek

 
Reply With Quote
 
Jeremy Ralph
Guest
Posts: n/a
 
      05-03-2006
I'd split each inout into a separate in and out if possible. Probably
best to avoid inouts whenever possible.



---
PDTi [ http://www.productive-eda.com ]
SpectaReg -- Spec-down code and doc generation for register maps

 
Reply With Quote
 
lundril@gmx.de
Guest
Posts: n/a
 
      05-06-2006
Let's see if I understand what you want to achieve:
As far as I understand you want to connect two "inout" busses and you
want to put a register stage between them.

Try that ( I changed the names somewhat to save time):

entity Data_Bus_Buffer is
port (
iClk : in STD_LOGIC;
iLoad : in STD_LOGIC; -- When 1 drive ioBusB to ioBusA
iStore: in STD_LOGIC; -- When 1 drive ioBusA to ioBusB
ioBusA : inout STD_LOGIC_VECTOR(3 downto 0);
ioBusB : inout STD_LOGIC_VECTOR(3 downto 0)
);
end Data_Bus_Buffer;

architecture whatever of Data_Bus_Buffer is

signal rLoad, rStore : STD_LOGIC;
signal rD : STD_LOGIC_VECTOR(3 downto 0);
begin
ioBusA <= rD when rLoad='1' and rStore='0' else (others => 'Z');
ioBusB <= rD when rLoad='0' and rStore='1' else (others => 'Z');
process(iClk) -- (No other signals necessary)
begin
if iClk'event and iClk='1' then
rLoad <= iLoad;
rStore <= iStore;
if iLoad='1' and iStore='0' then
rD<=ioBusB;
end if;
if iLoad='0' and iStore='1' then
rD<=ioBusA;
end if;
end if;
end process;
end whatever;


Sorry if there are type mistakes in that code, I just hacked it right
here.
Tell me if this is what you wanted.

so long
lundril

 
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
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments