--
-- component reg4
-- when enable is low, the register will output high impedance,
-- but when it goes high, the register will store the value  
--
LIBRARY ieee;  USE ieee.std_logic_1164.all;

ARCHITECTURE struct OF reg3 IS
   COMPONENT d_latch is
      port ( d, clk : in std_logic;
             q : out std_logic );
   END COMPONENT d_latch;

   COMPONENT tri_state_vector is
      port ( sel : IN std_logic;
             a,z : INOUT std_logic_vector );
   END COMPONENT tri_state_vector;

   SIGNAL s : std_logic_vector (2 downto 0);
   SIGNAL en_compl : std_logic;

BEGIN
   en_compl <= NOT enable;
   latch1 : COMPONENT d_latch
       PORT MAP ( d => data(0), clk => en_compl, q => s(0) );
   latch2 : COMPONENT d_latch
       PORT MAP ( d => data(1), clk => en_compl, q => s(1) );
   latch3 : COMPONENT d_latch
       PORT MAP ( d => data(2), clk => en_compl, q => s(2) );

   instance_tri_state_vector : COMPONENT tri_state_vector
       PORT MAP ( sel => enable, a => s, z => data );

END ARCHITECTURE struct;

<div align="center"><br /><script type="text/javascript"><!--
google_ad_client = "pub-7293844627074885";
//468x60, Created at 07. 11. 25
google_ad_slot = "8619794253";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />&nbsp;</div>