summaryrefslogtreecommitdiff
path: root/2004/n/fpga/src/pwm/tb_toppwm3.vhd
diff options
context:
space:
mode:
Diffstat (limited to '2004/n/fpga/src/pwm/tb_toppwm3.vhd')
-rw-r--r--2004/n/fpga/src/pwm/tb_toppwm3.vhd83
1 files changed, 83 insertions, 0 deletions
diff --git a/2004/n/fpga/src/pwm/tb_toppwm3.vhd b/2004/n/fpga/src/pwm/tb_toppwm3.vhd
new file mode 100644
index 0000000..5775d18
--- /dev/null
+++ b/2004/n/fpga/src/pwm/tb_toppwm3.vhd
@@ -0,0 +1,83 @@
+--simulation sur 82 ms environ
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.std_logic_arith.all;
+use IEEE.std_logic_unsigned.all;
+library work;
+library synopsys;
+use synopsys.bv_arithmetic.all;
+
+--ENTITY
+entity tb_toppwm3 is
+end tb_toppwm3;
+
+--ARCHITECTURE
+architecture sim1 of tb_toppwm3 is
+ component toppwm3
+ port(
+ RST :in std_logic;
+ CLK :in std_logic;
+ DATA :in std_logic_vector (7 downto 0);
+ OUTPWM :out std_logic
+ );
+ end component;
+-- declaration des signaux
+signal RST : std_logic;
+signal CLK : std_logic:='0';
+signal DATA: std_logic_vector (7 downto 0);
+
+signal OUTPWM: std_logic;
+
+--CONSTANT
+--constant ENVLP_PERIOD : time := 20 ms;
+--constant DATA_MAX : integer := 15;
+--constant CLK_PERIOD : time := (ENVLP_PERIOD/DATA_MAX);
+--constant CLK1_FREQ :integer:= 30E+6;--car freq de 30MHz
+--constant tcmax :integer:= 600E3;
+--constant seconde :time := 1 sec;
+--constant CLK_PERIOD :time := (seconde/CLK1_FREQ) ;
+
+--constant CLK1US_PERIOD :time:= 992 ns;
+--constant tcmax :integer:= 20161; --pour le clk1us
+constant CLK_PERIOD :time := 32 ns ;
+
+
+--MAP
+ begin
+ U1toppwm3: toppwm3 port map (
+ RST=>RST,
+ CLK=>CLK,
+ DATA=>DATA,
+ OUTPWM=>OUTPWM
+ );
+
+-- STIMULI
+ RST <= '1','0' after(CLK_PERIOD/6);
+ clk<= not clk after (CLK_PERIOD/2);
+
+ data<="00000011", "00011001" after 17 ms, --0 25
+ -- "00000000", "00011001" after 17 ms, --0 25
+ "00000000" after 38 ms, -- 0
+ "11111111" after 58 ms, -- 255
+ "01111111" after 78 ms; -- 127
+
+ --"00000000", "00011001" after ((tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)),
+ --"00000000" after (2*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)),
+ --"11111111" after (3*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6)),
+ --"00011100" after (4*(tcmax*CLK1US_PERIOD)-(CLK1US_PERIOD/6));
+
+ --"00000000",--10
+ -- "01100101" after 25 ms,--5
+ -- "00000000" after 30 ms,--vérifier que cette donnée est bien perdue
+ -- "11111111" after 38 ms,
+ -- "00100000" after 50 ms;
+end sim1;
+
+--CONFIGURATION
+configuration cfg_tb_toppwm3 of tb_toppwm3 is
+ for sim1
+ -- for U1toppwm3 : toppwm3 use entity work.toppwm3(RTL);end for;
+ for all : toppwm3 use entity work.toppwm3(RTL);end for;
+end for;
+end cfg_tb_toppwm3;
+