Line 47... |
Line 47... |
-- host access --
|
-- host access --
|
clk_i : in std_ulogic; -- global clock line
|
clk_i : in std_ulogic; -- global clock line
|
addr_i : in std_ulogic_vector(31 downto 0); -- address
|
addr_i : in std_ulogic_vector(31 downto 0); -- address
|
rden_i : in std_ulogic; -- read enable
|
rden_i : in std_ulogic; -- read enable
|
wren_i : in std_ulogic; -- write enable
|
wren_i : in std_ulogic; -- write enable
|
ben_i : in std_ulogic_vector(03 downto 0); -- byte write enable
|
|
data_i : in std_ulogic_vector(31 downto 0); -- data in
|
data_i : in std_ulogic_vector(31 downto 0); -- data in
|
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
data_o : out std_ulogic_vector(31 downto 0); -- data out
|
ack_o : out std_ulogic; -- transfer acknowledge
|
ack_o : out std_ulogic; -- transfer acknowledge
|
-- clock generator --
|
-- clock generator --
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
clkgen_en_o : out std_ulogic; -- enable clock generator
|
Line 112... |
Line 111... |
if rising_edge(clk_i) then
|
if rising_edge(clk_i) then
|
ack_o <= acc_en and (rden_i or wren_i);
|
ack_o <= acc_en and (rden_i or wren_i);
|
-- write access --
|
-- write access --
|
if (wren = '1') then
|
if (wren = '1') then
|
if (addr = pwm_ctrl_addr_c) then -- control register
|
if (addr = pwm_ctrl_addr_c) then -- control register
|
if (ben_i(0) = '1') then
|
|
enable <= data_i(ctrl_enable_c);
|
enable <= data_i(ctrl_enable_c);
|
prsc <= data_i(ctrl_prsc2_bit_c downto ctrl_prsc0_bit_c);
|
prsc <= data_i(ctrl_prsc2_bit_c downto ctrl_prsc0_bit_c);
|
end if;
|
end if;
|
end if;
|
|
if (addr = pwm_duty_addr_c) then -- duty cycle register
|
if (addr = pwm_duty_addr_c) then -- duty cycle register
|
for i in 0 to 3 loop
|
for i in 0 to 3 loop
|
if (ben_i(i) = '1') then
|
|
pwm_ch(i) <= data_i(7+i*8 downto 0+i*8);
|
pwm_ch(i) <= data_i(7+i*8 downto 0+i*8);
|
end if;
|
|
end loop;
|
end loop;
|
end if;
|
end if;
|
end if;
|
end if;
|
-- read access --
|
-- read access --
|
data_o <= (others => '0');
|
data_o <= (others => '0');
|