Advertisement
prasun54

modelsim

Apr 11th, 2024 (edited)
70
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.92 KB | None | 0 0
  1.  
  2. # command chain to force
  3. force A 0
  4. force B 0
  5. run
  6. force B 1
  7. run
  8. force A 1
  9. force B 0
  10. run
  11. force B 1
  12. run
  13.  
  14. # test bench
  15. library IEEE;
  16. use IEEE.std_logic_1164.all;
  17.  
  18. entity gate_tb is
  19. end entity gate_tb;
  20.  
  21. architecture test of gate_tb is
  22.         component []
  23.           port (
  24.                 A : in std_logic;
  25.                 B : in std_logic;
  26.                 Y  : out std_logic);
  27.         end component;
  28.  
  29.         signal A, B, O : std_logic;
  30. begin
  31.         gate_map: [] port map (A => A, B => B, Y => O);
  32.  
  33.         process begin
  34.                 A <= '0';
  35.                 B <= '0';
  36.                 wait for 100 ps;
  37.  
  38.                 A <= '0';
  39.                 B <= '1';
  40.                 wait for 100 ps;
  41.  
  42.                 A <= '1';
  43.                 B <= '0';
  44.                 wait for 100 ps;
  45.  
  46.                 A <= '1';
  47.                 B <= '1';
  48.                 wait for 100 ps;
  49.         end process;
  50.  
  51. end test;
  52.  
Advertisement
Comments
  • prasun54
    1 year
    # Python 0.21 KB | 0 0
    1. inputs = ['A', 'B', 'Cin']
    2.  
    3. inputs = inputs[::-1]
    4. n = len(inputs)
    5. for i in range(2**n):
    6.     for j in range(n):
    7.         if i % (2**j) == 0:
    8.             print(f"force {inputs[j]} {i//(2**j) % 2}")
    9.     print("run")
Add Comment
Please, Sign In to add comment
Advertisement