1 ------------------------------------------------------------------------------- 4 ------------------------------------------------------------------------------- 9 --! Using IEEE standard logic components 10 USE ieee.std_logic_1164.
ALL;
12 --! Using IEE standard numeric components 15 --! @brief PWM device entity 17 --! @image html pwm_device_entity.png "PWM Device Entity" 19 --! This entity manages four PWM devices. The write register contains the 20 --! four 8-bit PWM duty cycles. The read register contains the current four 21 --! 8-bit PWM duty cycles. 30 pwm_out : OUT (3 DOWNTO 0) --! PWM outputs 32 END ENTITY pwm_device;
34 --! Architecture rtl of pwm_device entity 37 --! Array type of four duty-cycles 45 --! Generate four PWMs 46 g_pwm : FOR i IN 0 TO 3 GENERATE 48 --! Generate PWM instance 49 i_pwm :
ENTITY work.
pwm(rtl)
63 --! @brief Process to handle writes and resets 73 ELSIF (rising_edge(clk_in)) THEN 75 -- Set duty cycles from write register 85 --! @brief Process to handle reads 89 IF (rising_edge(clk_in)) THEN 90 -- Populate read register with duty cycles in rst_instd_logic
Asynchronous reset.
in clk_instd_logic
Clock.
in rst_instd_logic
Asynchronous reset.
pwm_duty_set pwm_duty
Duty cycles array.
in dat_wr_reg_instd_logic_vector( 31 DOWNTO 0)
Device Write Register value.
out dat_rd_reg_outstd_logic_vector( 31 DOWNTO 0)
Device Read Register value.
in pwm_adv_instd_logic
PWM Advance flag.
in pwm_duty_instd_logic_vector( bit_width- 1 DOWNTO 0)
PWM duty cycle.
bit_widthnatural range 2 TO 32:= 8
PWM width.
in pwm_adv_instd_logic
PWM Advance flag.
( 3 DOWNTO 0) std_logic_vector( 7 DOWNTO 0) pwm_duty_set
Array type of four duty-cycles.
in clk_instd_logic
Clock.
out pwm_outstd_logic_vector( 3 DOWNTO 0)
PWM outputs.
out pwm_outstd_logic
PWM output.
_library_ ieeeieee
Using IEEE library.
in dat_wr_done_instd_logic
Device Write Done flag.