1
0

exercice 3

This commit is contained in:
2024-03-22 13:48:57 +01:00
parent 8b2f630f7b
commit 4ba38000a8
6 changed files with 2819 additions and 31 deletions

View File

@ -0,0 +1,28 @@
-- VHDL Entity VHD.ex_24_1_3.symbol
--
-- Created:
-- by - francois.francois (Aphelia)
-- at - 09:40:30 03/27/19
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY ex_24_1_3 IS
GENERIC(
timerBitNb : positive := 8;
testModeBitNb : positive := 1
);
PORT(
testMode : IN std_ulogic;
clock : IN std_ulogic;
reset : IN std_ulogic;
pwmEn : OUT std_ulogic
);
-- Declarations
END ex_24_1_3 ;

View File

@ -1,4 +1,28 @@
architecture studentVersion of ex_24_1_3 is
signal counter : unsigned(timerBitNb-1 downto 0);
begin
pwmEn <= '0';
process(reset, clock) begin
if reset = '1' then
counter <= (others => '0');
elsif rising_edge(clock) then
if testMode = '0' then
counter <= counter - 1;
else
counter <= counter - 2**(timerBitNb - testModeBitNb);
end if;
end if;
end process;
process(counter)
begin
if counter = 0 then
pwmEn <= '1';
else
pwmEn <= '0';
end if;
end process;
end studentVersion;