COUTER : process (clk, reset) is
begin
- if reset = '1' then
- cnt <= (others => '0');
-
- elsif rising_edge(clk) then
- if clk_en = '1' then
- if eq_max = '1' then
- cnt <= (others => '0');
- else
- cnt <= cnt + 1;
+ if rising_edge(clk) then
+ if reset = '1' then
+ cnt <= (others => '0');
+
+ else
+ if clk_en = '1' then
+ if eq_max = '1' then
+ cnt <= (others => '0');
+ else
+ cnt <= cnt + 1;
+ end if;
end if;
end if;
end if;
process (CLK_I, RST_I) is
begin
- if RST_I = '1' then
- INNER_ACK <= '0';
-
- elsif rising_edge(CLK_I) then
- INNER_ACK <= STB_I;
+ if rising_edge(CLK_I) then
+ if RST_I = '1' then
+ INNER_ACK <= '0';
+ else
+ INNER_ACK <= STB_I;
+ end if;
end if;
end process;
MCC_EXEC_LOGIC : process (RST_I, CLK_I) is
begin
- if RST_I = '1' then
- mcc_ack_inner <= (others => '0');
- mcc_stb_inner <= (others => '0');
-
- elsif rising_edge(CLK_I) then
- if mcc_exec = '0' then
+ if rising_edge(CLK_I) then
+ if RST_I = '1' then
mcc_ack_inner <= (others => '0');
mcc_stb_inner <= (others => '0');
-
+
else
- mcc_ack_inner (0) <= mcc_exec;
-
- for i in 0 to MCC_W-1 loop
- if mcc_mask (i) = '1' then
- mcc_ack_inner (i+1) <= MCC_ACK_I (i);
- mcc_stb_inner (i) <= mcc_ack_inner (i);
- else
- mcc_ack_inner (i+1) <= mcc_ack_inner (i);
- mcc_stb_inner (i) <= '0';
- end if;
- end loop;
+ if mcc_exec = '0' then
+ mcc_ack_inner <= (others => '0');
+ mcc_stb_inner <= (others => '0');
+
+ else
+ mcc_ack_inner (0) <= mcc_exec;
+
+ for i in 0 to MCC_W-1 loop
+ if mcc_mask (i) = '1' then
+ mcc_ack_inner (i+1) <= MCC_ACK_I (i);
+ mcc_stb_inner (i) <= mcc_ack_inner (i);
+ else
+ mcc_ack_inner (i+1) <= mcc_ack_inner (i);
+ mcc_stb_inner (i) <= '0';
+ end if;
+ end loop;
+ end if;
end if;
end if;
end process;
-- Peripheral register
PWM_REGISTER : process (clk, reset)
begin
- if reset = '1' then
- reg <= (others => '0');
-
- elsif rising_edge(clk) then
- if we = '1' then
- reg <= din;
+ if rising_edge(clk) then
+ if reset = '1' then
+ reg <= (others => '0');
+ else
+ if we = '1' then
+ reg <= din;
+ end if;
end if;
end if;
end process;
-- with next clk edge. Pwm output is delayed by one clock.
PWM_GEN : process (clk, reset)
begin
- if reset = '1' then
- pwm <= '0';
-
- elsif rising_edge(clk) then
- if pwm_cyc = '1' then
- cmp <= reg;
- end if;
-
- if pwm_cnt < cmp then
- pwm <= '1';
- else
+ if rising_edge(clk) then
+ if reset = '1' then
pwm <= '0';
+
+ else
+ if pwm_cyc = '1' then
+ cmp <= reg;
+ end if;
+
+ if pwm_cnt < cmp then
+ pwm <= '1';
+ else
+ pwm <= '0';
+ end if;
end if;
end if;
end process;
FSM : process (CLK_I, RST_I) is
begin
- if RST_I = '1' then
- state <= ready;
- INNER_ACK <= '0';
- PWM_STB_O <= '0';
+ if rising_edge(CLK_I) then
+ if RST_I = '1' then
+ state <= ready;
+ INNER_ACK <= '0';
+ PWM_STB_O <= '0';
- elsif rising_edge(CLK_I) then
- case state is
- when ready =>
- if STB_I = '1' then
- state <= done;
- INNER_ACK <= '1';
- PWM_STB_O <= '1';
- end if;
+ else
+ case state is
+ when ready =>
+ if STB_I = '1' then
+ state <= done;
+ INNER_ACK <= '1';
+ PWM_STB_O <= '1';
+ end if;
- when done =>
- PWM_STB_O <= '0';
- if STB_I = '0' then
- state <= ready;
- INNER_ACK <= '0';
- end if;
- end case;
+ when done =>
+ PWM_STB_O <= '0';
+ if STB_I = '0' then
+ state <= ready;
+ INNER_ACK <= '0';
+ end if;
+ end case;
+ end if;
end if;
end process;
FSM : process (CLK_I, RST_I) is
begin
- if RST_I = '1' then
- state <= ready;
- INNER_ACK <= '0';
- SL_STB_O <= '0';
-
- elsif rising_edge(CLK_I) then
- case state is
- when ready =>
- if STB_I = '1' then
- state <= phase1;
+ if rising_edge(CLK_I) then
+ if RST_I = '1' then
+ state <= ready;
+ INNER_ACK <= '0';
+ SL_STB_O <= '0';
+
+ else
+ case state is
+ when ready =>
+ if STB_I = '1' then
+ state <= phase1;
+ SL_STB_O <= '1';
+ end if;
+
+ when phase1 =>
+ if SL_ACK_I = '1' then
+ state <= phase2;
+ SL_STB_O <= '0';
+ end if;
+
+ when phase2 =>
SL_STB_O <= '1';
- end if;
-
- when phase1 =>
- if SL_ACK_I = '1' then
- state <= phase2;
- SL_STB_O <= '0';
- end if;
-
- when phase2 =>
- SL_STB_O <= '1';
- if SL_ACK_I = '1' then
- state <= phase3;
- SL_STB_O <= '0';
- end if;
-
- when phase3 =>
- SL_STB_O <= '1';
- if SL_ACK_I = '1' then
- state <= done;
- INNER_ACK <= '1';
- SL_STB_O <= '0';
- end if;
-
- when done =>
- if STB_I = '0' then
- state <= ready;
- INNER_ACK <= '0';
- end if;
- end case;
+ if SL_ACK_I = '1' then
+ state <= phase3;
+ SL_STB_O <= '0';
+ end if;
+
+ when phase3 =>
+ SL_STB_O <= '1';
+ if SL_ACK_I = '1' then
+ state <= done;
+ INNER_ACK <= '1';
+ SL_STB_O <= '0';
+ end if;
+
+ when done =>
+ if STB_I = '0' then
+ state <= ready;
+ INNER_ACK <= '0';
+ end if;
+ end case;
+ end if;
end if;
end process;
FSM : process (CLK_I, RST_I) is
begin
- if RST_I = '1' then
- state <= ready;
- INNER_ACK <= '0';
- IRF_STB_O <= '0';
- IRF_WE_O <= '0';
-
- elsif rising_edge(CLK_I) then
- case state is
- when ready =>
- if STB_I = '1' then
- state <= load_scale;
- IRF_ADR_O <= SCALE_ADR;
- IRF_STB_O <= '1';
- end if;
-
- when load_scale =>
- state <= load_vector;
- IRF_ADR_O <= VECTOR_ADR;
-
- when load_vector =>
- state <= save_scaled;
- IRF_ADR_O <= SCALED_ADR;
- MUL_A <= IRF_DAT_I;
-
- when save_scaled =>
- state <= done;
- INNER_ACK <= '1';
- IRF_WE_O <= '1';
- MUL_B <= conv_std_logic_vector(signed(biased_to_twos(IRF_DAT_I(VECTOR_W-1 downto 0))), 16);
-
- when done =>
- IRF_STB_O <= '0';
- IRF_WE_O <= '0';
- if STB_I = '0' then
- state <= ready;
- INNER_ACK <= '0';
- end if;
- end case;
+ if rising_edge(CLK_I) then
+ if RST_I = '1' then
+ state <= ready;
+ INNER_ACK <= '0';
+ IRF_STB_O <= '0';
+ IRF_WE_O <= '0';
+
+ else
+ case state is
+ when ready =>
+ if STB_I = '1' then
+ state <= load_scale;
+ IRF_ADR_O <= SCALE_ADR;
+ IRF_STB_O <= '1';
+ end if;
+
+ when load_scale =>
+ state <= load_vector;
+ IRF_ADR_O <= VECTOR_ADR;
+
+ when load_vector =>
+ state <= save_scaled;
+ IRF_ADR_O <= SCALED_ADR;
+ MUL_A <= IRF_DAT_I;
+
+ when save_scaled =>
+ state <= done;
+ INNER_ACK <= '1';
+ IRF_WE_O <= '1';
+ MUL_B <= conv_std_logic_vector(signed(biased_to_twos(IRF_DAT_I(VECTOR_W-1 downto 0))), 16);
+
+ when done =>
+ IRF_STB_O <= '0';
+ IRF_WE_O <= '0';
+ if STB_I = '0' then
+ state <= ready;
+ INNER_ACK <= '0';
+ end if;
+ end case;
+ end if;
end if;
end process;