Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------------------------------------------
- -- Company:
- -- Engineer:
- --
- -- Create Date: 04:54:45 12/14/2018
- -- Design Name:
- -- Module Name: /home/ise/Documents/irrigazione_progetto/tb_progetto.vhd
- -- Project Name: irrigazione_progetto
- -- Target Device:
- -- Tool versions:
- -- Description:
- --
- -- VHDL Test Bench Created by ISE for module: funzionamento
- --
- -- Dependencies:
- --
- -- Revision:
- -- Revision 0.01 - File Created
- -- Additional Comments:
- --
- -- Notes:
- -- This testbench has been automatically generated using types std_logic and
- -- std_logic_vector for the ports of the unit under test. Xilinx recommends
- -- that these types always be used for the top-level I/O of a design in order
- -- to guarantee that the testbench will bind correctly to the post-implementation
- -- simulation model.
- --------------------------------------------------------------------------------
- LIBRARY ieee;
- USE ieee.std_logic_1164.ALL;
- USE ieee.std_logic_arith.ALL;
- -- Uncomment the following library declaration if using
- -- arithmetic functions with Signed or Unsigned values
- USE ieee.numeric_std.ALL;
- ENTITY tb_progetto IS
- END tb_progetto;
- ARCHITECTURE behavior OF tb_progetto IS
- -- Component Declaration for the Unit Under Test (UUT)
- COMPONENT funzionamento
- PORT(
- clk : IN std_logic;
- rst : IN std_logic;
- timer : IN integer range 0 to 31;
- freq : IN std_logic;
- p : IN std_logic;
- count_debug :out STD_LOGIC_VECTOR (0 TO 4);
- stato_debug :out STD_LOGIC_VECTOR (0 TO 1);
- irrigazione : out STD_LOGIC;
- ugello : OUT std_logic
- );
- END COMPONENT;
- --Inputs
- signal clk : std_logic := '0';
- signal rst : std_logic := '0';
- signal timer : integer range 0 to 31;
- signal freq : std_logic := '0';
- signal p : std_logic := '0';
- --Outputs
- signal count_debug : STD_LOGIC_VECTOR (0 TO 4);
- signal stato_debug : STD_LOGIC_VECTOR (0 TO 1);
- signal ugello : std_logic;
- signal irrigazione : STD_LOGIC;
- -- Clock period definitions
- constant clk_period : time := 10
- ns;
- BEGIN
- -- Instantiate the Unit Under Test (UUT)
- uut: funzionamento PORT MAP (
- clk => clk,
- rst => rst,
- timer => timer,
- freq => freq,
- p => p,
- count_debug=>count_debug,
- stato_debug=>stato_debug,
- irrigazione=> irrigazione,
- ugello => ugello
- );
- -- Clock process definitions
- clk_process :process
- begin
- clk <= '0';
- wait for clk_period/2;
- clk <= '1';
- wait for clk_period/2;
- end process;
- -- Stimulus process
- stim_proc: process
- begin
- -- hold reset state for 100 ns.
- wait for 100 ns;
- rst<='1';
- wait for 10 ns;
- rst<='0';
- wait for 10 ns;
- wait for clk_period*10;
- -- insert stimulus here
- --Inseriamo un numero di cicli compreso nel range dato
- timer<=20;
- --Inseriamo delle combinazioni che permettano la permanenza nello stato 'off'
- p<='0';
- freq<='0';
- wait for clk_period*10;
- p<='0';
- freq<='1';
- wait for clk_period*10;
- --Passiamo allo stato di irrigazione a frequenza alta
- -- Permaniamo nello stato fino alla fine del conteggio
- p<='1';
- freq<='1';
- wait until count_debug="00000";
- --Alla fine del ciclo di funzionamento ritorniamo nello stato off
- p<='0';
- freq<='0';
- wait for clk_period*5;
- --Passiamo allo stato di irrigazione a frequenza bassa
- -- Permaniamo nello stato fino alla fine del conteggio
- p<='1';
- freq<='0';
- wait until count_debug="00000";
- --Alla fine del ciclo di funzionamento ritorniamo nello stato off
- p<='0';
- freq<='0';
- wait for clk_period*5;
- --Passiamo allo stato di irrigazione a frequenza alta
- p<='1';
- freq<='1';
- wait for clk_period*5;
- --Sospendiamo il processo e permaniamo nello stato di 'attesa'
- --testando tutte le combinazioni
- p<='0';
- freq<='0';
- wait for clk_period*5;
- p<='0';
- freq<='1';
- wait for clk_period*5;
- --Torniamo nello stato di irrigazione a frequenza alta
- p<='1';
- wait for clk_period*10;
- --Passiamo allo stato di irrigazione a frequenza bassa
- p<='1';
- freq<='0';
- wait for clk_period*5;
- --variamo anche il valore di timer ( ovvero dei cicli di irrigazione)
- timer<=24;
- wait for clk_period*15;
- --Ritorniano allo stato 'low' variando nuovamente il timer
- --impostando un valore più piccolo del precedente
- timer<=6;
- p<='1';
- freq<='0';
- wait for clk_period*10;
- --Passiamo direttamenta allo stato 'high'
- p<='1';
- freq<='1';
- wait for clk_period*10;
- timer<=20;
- wait;
- end process;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement