| 1 |
3 |
david237 |
-----------------------------------------------------------------------
|
| 2 |
|
|
-- Bipolar TTL models (VHDL) --
|
| 3 |
|
|
-- David R Brooks --
|
| 4 |
|
|
-- June, 2016. Perth, Australia --
|
| 5 |
|
|
-- Compliance: VHDL 2008 --
|
| 6 |
|
|
-- Testbench for SN74122N: Retriggerable resettable monostable --
|
| 7 |
|
|
-----------------------------------------------------------------------
|
| 8 |
|
|
|
| 9 |
|
|
library ieee;
|
| 10 |
|
|
use ieee.std_logic_1164.all;
|
| 11 |
|
|
use ieee.std_logic_misc.all;
|
| 12 |
|
|
use ieee.numeric_std.all;
|
| 13 |
|
|
use work.LSTTL.all;
|
| 14 |
|
|
use work.TTLPrivate.all;
|
| 15 |
|
|
|
| 16 |
|
|
entity Testbench_122 is -- Top-level bench
|
| 17 |
|
|
end entity;
|
| 18 |
|
|
|
| 19 |
|
|
architecture Test of Testbench_122 is
|
| 20 |
|
|
signal S, Q : std_logic; -- Trigger & output
|
| 21 |
|
|
signal W, N : std_logic; -- Wide & narrow windows
|
| 22 |
|
|
begin
|
| 23 |
|
|
S <= '0',
|
| 24 |
|
|
'1' after 250 ns, '0' after 350 ns, -- Trigger, let it time out
|
| 25 |
|
|
'1' after 15000 ns, '0' after 15100 ns, -- Trigger again
|
| 26 |
|
|
'1' after 16000 ns, '0' after 16100 ns; -- This should retrigger
|
| 27 |
|
|
|
| 28 |
|
|
-----------------------------------------------------------------------
|
| 29 |
|
|
-- Generate expected results (with zero delays)
|
| 30 |
|
|
-----------------------------------------------------------------------
|
| 31 |
|
|
W <= '0',
|
| 32 |
|
|
'1' after 220 ns, '0' after 10330 ns,
|
| 33 |
|
|
'1' after 15020 ns, '0' after 26080 ns;
|
| 34 |
|
|
|
| 35 |
|
|
N <= '0',
|
| 36 |
|
|
'1' after 350 ns, '0' after 10250 ns,
|
| 37 |
|
|
'1' after 15090 ns, '0' after 26000 ns;
|
| 38 |
|
|
|
| 39 |
|
|
-----------------------------------------------------------------------
|
| 40 |
|
|
-- Validate the results
|
| 41 |
|
|
-----------------------------------------------------------------------
|
| 42 |
|
|
process(W, N, Q) is
|
| 43 |
|
|
begin
|
| 44 |
|
|
if (rising_edge(W) and Q = '1') or -- W must rise before Q
|
| 45 |
|
|
(rising_edge(N) and Q = '0') or -- Q must rise before N
|
| 46 |
|
|
(falling_edge(N) and Q = '0') or -- N must fall before Q
|
| 47 |
|
|
(falling_edge(W) and Q = '1') then -- Q must fall before W
|
| 48 |
|
|
assert false
|
| 49 |
|
|
report "Bad monostable pulse"
|
| 50 |
|
|
severity failure;
|
| 51 |
|
|
end if;
|
| 52 |
|
|
end process;
|
| 53 |
|
|
|
| 54 |
|
|
-----------------------------------------------------------------------
|
| 55 |
|
|
-- Device Under Test...
|
| 56 |
|
|
-----------------------------------------------------------------------
|
| 57 |
|
|
DUT: SN74122N
|
| 58 |
|
|
generic map(
|
| 59 |
|
|
W => 10 us -- Pulse width
|
| 60 |
|
|
)
|
| 61 |
|
|
port map(
|
| 62 |
|
|
X_1 => '0', -- A1\
|
| 63 |
|
|
X_2 => '0', -- A2\
|
| 64 |
|
|
X_3 => S, -- B1
|
| 65 |
|
|
X_4 => '1', -- B2
|
| 66 |
|
|
X_5 => '1', -- CD\
|
| 67 |
|
|
X_6 => open, -- Q\
|
| 68 |
|
|
X_7 => open, -- GND
|
| 69 |
|
|
X_8 => Q, -- Q
|
| 70 |
|
|
X_9 => open, -- Rint
|
| 71 |
|
|
--
|
| 72 |
|
|
X_11 => open, -- Cx
|
| 73 |
|
|
--
|
| 74 |
|
|
X_13 => open, -- RxCx
|
| 75 |
|
|
X_14 => open -- Vcc
|
| 76 |
|
|
);
|
| 77 |
|
|
end architecture Test;
|