"simple" problem

S

Simone Winkler

Hello!

I'm not programming VHDL now for a long time, so I've got a problem, that is
for sure quite simple:

I've got a vhdl source code that I took from the Xilinx Application Notes.
One of the ports is an inout that has 32 bits. Now what I want is two
16bit-ports. I JUST want to have the two 16bit ports on the entity, but it
doesn't matter if the vhdl code works with the 32bit-signal, so I just want
to put the two 16bit-signals together after declaring the entity.

so what i did was:

entity ... is
port( sys_data: inout std_logic_vector(15 downto 0);
sys_addr: inout std_logic_vector(15 downto 0);
...
);
end entity ...;

architechture behavioural of ... is

signal AD: std_logic_vector(31 downto 0);
...

component (...)
...

begin

%component instantiations%

process(...)
...
end process;

process(...)
...
end process;

AD <= sys_addr(15 downto 0) & sys_data(15 downto 0);
...

end architecture;

WHY doesn't it work?
When I do a behavioural simulation with modelsim, AD is undefined (all the
16 bits) and nearly everything else too.

Please don't *kill* me, because it's a silly question.. i just can't find a
solution!

THANX!

Simone
 
J

Jonathan Bromley

I've got a vhdl source code that I took from the Xilinx Application Notes.
One of the ports is an inout that has 32 bits. Now what I want is two
16bit-ports. I JUST want to have the two 16bit ports on the entity, but it
doesn't matter if the vhdl code works with the 32bit-signal, so I just want
to put the two 16bit-signals together after declaring the entity.

entity ... is
port( sys_data: inout std_logic_vector(15 downto 0);
sys_addr: inout std_logic_vector(15 downto 0);
...
);
end entity ...;

architechture behavioural of ... is

signal AD: std_logic_vector(31 downto 0);
begin [...]
AD <= sys_addr(15 downto 0) & sys_data(15 downto 0); [...]
end architecture;
WHY doesn't it work?
When I do a behavioural simulation with modelsim, AD is undefined (all the
16 bits) and nearly everything else too.

If these were input ports, the code you post would be fine.

In the absence of anything else, the code is *still* fine
even for inout ports.

However, there could easily be some problems about the way you
are driving AD to push data onto the inout ports when your
internal outputs are enabled. Something like this:

AD <= sys_addr(15 downto 0) & sys_data(15 downto 0);
sys_addr <= AD(15 downto 0);
sys_data <= AD(15 downto 0);

Whoops, now we really have a problem - a combinational loop.

So I would have thought the easy solution was to make a
wrapper component that splits the bus for you...

entity wrapper is
port

sys_data: inout std_logic_vector(15 downto 0);
sys_addr: inout std_logic_vector(15 downto 0);
[...] -- pass all the other signals through too
);
end;

architecture W of wrapper is
component the_old_32_bit_version
port (
AD: inout std_logic_vector(31 downto 0);
[...] -- other stuff
);
end component;
begin
guts: AD port map (
AD(15 downto 0) => sys_data,
AD(31 downto 16) => sys_addr);
end;

HTH

--

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 address 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top