Shakix

P04_NAND

Nov 24th, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.28 KB | Software | 0 0
  1. -- Imagine you’re designing a smart lock system for a door. The door should remain locked (output HIGH = 1) unless two conditions are
  2. -- met at the same time:
  3. -- Condition A: Fingerprint
  4. -- Condition B: Badge Scanned
  5.  
  6. library ieee;
  7. use ieee.std_logic_1164.all;
  8.  
  9. entity SmartLock_TB is
  10. end entity;
  11.  
  12. architecture Testbench of SmartLock_TB is
  13.     signal Fingerprint, Badge, DoorLock : std_logic; -- Inputs and output
  14. begin
  15.     -- Instantiate the SmartLock design
  16.     UUT: entity work.SmartLock
  17.         port map (
  18.             Fingerprint => Fingerprint,
  19.             Badge       => Badge,
  20.             DoorLock    => DoorLock
  21.         );
  22.  
  23.     -- Testbench process
  24.     process
  25.     begin
  26.         -- Test Case 1: No fingerprint, no badge
  27.         Fingerprint <= '0';
  28.         Badge <= '0';
  29.         wait for 10 ns;
  30.  
  31.         -- Test Case 2: No fingerprint, badge scanned
  32.         Fingerprint <= '0';
  33.         Badge <= '1';
  34.         wait for 10 ns;
  35.  
  36.         -- Test Case 3: Fingerprint present, no badge
  37.         Fingerprint <= '1';
  38.         Badge <= '0';
  39.         wait for 10 ns;
  40.  
  41.         -- Test Case 4: Fingerprint and badge scanned
  42.         Fingerprint <= '1';
  43.         Badge <= '1';
  44.         wait for 10 ns;
  45.  
  46.         wait; -- End simulation
  47.     end process;
  48. end architecture;
  49.  
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment