CPU: Synthesis Description 327
When a rising edge is applied to input clk, the data on input ais stored
in the register.
Input enis used to control output q. When enis a ‘ 1 ’value, the register
state is driven to output q. When enis a ‘ 0 ’, output qis a high impedance
value and not driving. This functionality is implemented by entity trireg
shown in the following:
library IEEE;
use IEEE.std_logic_1164.all;
use work.cpu_lib.all;
entity trireg is
port( a : in bit16;
port( en : in std_logic;
port( clk : in std_logic;
port( q : out bit16);
end trireg;
architecture rtl of trireg is
signal val : bit16;
begin
triregdata: process
begin
wait until clk’event and clk = ‘ 1 ’;
val <= a;
end process;
trireg3st: process(en, val)
begin
if en = ‘ 1 ’ then
q <= val after 1 ns;
elsif en = ‘ 0 ’ then
q <= “ZZZZZZZZZZZZZZZZ” after 1 ns;
-- exemplar_translate_off
else
a
q
Trireg
en
clk
Figure 13-12
Trireg Symbol.