URL
https://opencores.org/ocsvn/neorv32/neorv32/trunk
[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_pwm.vhd] - Diff between revs 22 and 23
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 22 |
Rev 23 |
Line 88... |
Line 88... |
signal prsc : std_ulogic_vector(2 downto 0); -- clock prescaler (r/w)
|
signal prsc : std_ulogic_vector(2 downto 0); -- clock prescaler (r/w)
|
|
|
-- prescaler clock generator --
|
-- prescaler clock generator --
|
signal prsc_tick : std_ulogic;
|
signal prsc_tick : std_ulogic;
|
|
|
-- pwm counter --
|
-- pwm core counter --
|
signal pwm_cnt : std_ulogic_vector(7 downto 0);
|
signal pwm_cnt : std_ulogic_vector(7 downto 0);
|
signal pwm_out : std_ulogic_vector(3 downto 0);
|
|
|
|
begin
|
begin
|
|
|
-- Access Control -------------------------------------------------------------------------
|
-- Access Control -------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
Line 155... |
Line 154... |
pwm_cnt <= std_ulogic_vector(unsigned(pwm_cnt) + 1);
|
pwm_cnt <= std_ulogic_vector(unsigned(pwm_cnt) + 1);
|
end if;
|
end if;
|
-- channels --
|
-- channels --
|
for i in 0 to num_pwm_channels_c-1 loop
|
for i in 0 to num_pwm_channels_c-1 loop
|
if (unsigned(pwm_cnt) >= unsigned(pwm_ch(i))) or (enable = '0') then
|
if (unsigned(pwm_cnt) >= unsigned(pwm_ch(i))) or (enable = '0') then
|
pwm_out(i) <= '0';
|
pwm_o(i) <= '0';
|
else
|
else
|
pwm_out(i) <= '1';
|
pwm_o(i) <= '1';
|
end if;
|
end if;
|
end loop; -- i, pwm channel
|
end loop; -- i, pwm channel
|
end if;
|
end if;
|
end process pwm_core;
|
end process pwm_core;
|
|
|
-- output --
|
|
pwm_o(0) <= pwm_out(0);
|
|
pwm_o(1) <= pwm_out(1);
|
|
pwm_o(2) <= pwm_out(2);
|
|
pwm_o(3) <= pwm_out(3);
|
|
|
|
|
|
end neorv32_pwm_rtl;
|
end neorv32_pwm_rtl;
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.