summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/pwm/tb_comptvalue3.vhd
blob: 62471584db58dc2a3c5ecfba9f4e99515fc0539e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--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;