--test bench du compteur sur value pour duree du niveau haut test à faire sur 59ms environ library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.all; library synopsys; use synopsys.bv_arithmetic.all; --ENTITY entity tb_comptvalue3 is end tb_comptvalue3; --ARCHITECTURE architecture sim1 of tb_comptvalue3 is component comptvalue3 port( rst : in std_logic; clk : in std_logic; clk1uscompt : in std_logic; loadcompt : in std_logic; datacompt : in integer; tccompt : buffer integer; valuecompt : out integer ); end component; -- declaration des signaux signal rst:std_logic; signal clk:std_logic:='0'; signal clk1uscompt: std_logic:='0'; signal loadcompt: std_logic; signal datacompt : integer:=0; signal tccompt: integer; signal valuecompt: integer; --declaration de constantes constant CLK1US_PERIOD :time:= 992 ns; constant tcmax :integer:= 20161; --pour le clk1us constant CLK_PERIOD :time := 32 ns ; begin U1comptvalue3: comptvalue3 port map ( rst=>rst, clk=>clk, clk1uscompt=>clk1uscompt, loadcompt=>loadcompt, datacompt=>datacompt, tccompt=>tccompt, valuecompt=>valuecompt ); --STIMULI clk<= not clk after (CLK_PERIOD/2);rst<='1','0'after (CLK_PERIOD/6); clk1uscompt<= not clk1uscompt after (CLK1US_PERIOD/2); loadcompt<='0','1'after (tcmax*CLK1US_PERIOD-(CLK1US_PERIOD/2)),'0' after (tcmax*CLK1US_PERIOD+(CLK1US_PERIOD/2)), '1'after((2*(tcmax*CLK1US_PERIOD))-(CLK1US_PERIOD/2)),'0' after ((2*(tcmax*CLK1US_PERIOD))+(CLK1US_PERIOD/2)), '1'after ((3*(tcmax*CLK1US_PERIOD))-(CLK1US_PERIOD/2)),'0' after ((3*(tcmax*CLK1US_PERIOD))+(CLK1US_PERIOD/2)), '1'after((4*(tcmax*CLK1US_PERIOD))-(CLK1US_PERIOD/2)),'0' after ((4*(tcmax*CLK1US_PERIOD))+(CLK1US_PERIOD/2)); datacompt<= 0, 25 after ((tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)), 0 after (2*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)), 255 after (3*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)), 100 after (4*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)); end sim1; --CONFIGURATION configuration cfg_tb_comptvalue3 of tb_comptvalue3 is for sim1 for all : comptvalue3 use entity work.comptvalue3(comptvalue3behav); end for; end for; end cfg_tb_comptvalue3;