K
KCL
Guest
As the two box are the same size you vcould only declare 1 type tag and use
it both for your two signal tag
"Neo" <zingafriend@yahoo.com> a écrit dans le message de news:
1109849178.223444.51630@z14g2000cwz.googlegroups.com...
it both for your two signal tag
"Neo" <zingafriend@yahoo.com> a écrit dans le message de news:
1109849178.223444.51630@z14g2000cwz.googlegroups.com...
well, here is two boxes of 8registers with 9 bits each which can be
read and written into.
----CODE------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity xyz is
port(
clk: in std_logic;
din: in std_logic_vector(8 downto 0);
add: in std_logic_vector(3 downto 0);
rdwr: in std_logic;
do : inout std_logic_vector(8 downto 0)
);
end entity;
architecture acrh_xyz of xyz is
type tag_array1 is array (0 to 7) of std_logic_vector(8 downto 0);
type tag_array2 is array (0 to 7) of std_logic_vector(8 downto 0);
signal tag1: tag_array1;
signal tag2: tag_array2;
begin
--reading
do <= tag1(conv_integer(add(2 downto 0))) when (add(3) = '0' and rdwr =
'0') else
tag2(conv_integer(add(2 downto 0))) when (add(3) = '1' and rdwr =
'0') else
(others => 'Z');
--writing
process(clk)
begin
if(clk'event and clk= '1') then
if(rdwr = '1') then
if(add(3) = '0') then
tag1(conv_integer(add(2 downto 0))) <= do;
else
tag2(conv_integer(add(2 downto 0))) <= do;
end if;
end if;
end if;
end process;
end acrh_xyz;