phy: rx: Implement error handling for Manchester
This commit is contained in:
parent
5d6df0219b
commit
1f894866ab
@ -98,7 +98,7 @@ begin
|
||||
signal bit_ev : bit_ev_t;
|
||||
|
||||
-- Bit recovery
|
||||
type demanchestization_state_t is (SYNC, DATA);
|
||||
type demanchestization_state_t is (SYNC, DATA, ERROR);
|
||||
signal demanchestization_state : demanchestization_state_t;
|
||||
begin
|
||||
-- Detects spacing of transitions
|
||||
@ -170,23 +170,32 @@ begin
|
||||
demanchestization_state <= SYNC;
|
||||
bit_stb <= '0';
|
||||
rx_active <= '0';
|
||||
|
||||
rx_error <= '0';
|
||||
elsif rising_edge(clk) then
|
||||
bit_stb <= '0';
|
||||
rx_error <= '0';
|
||||
|
||||
if (bit_ev /= NONE) then
|
||||
rx_active <= '1';
|
||||
case demanchestization_state is
|
||||
when SYNC =>
|
||||
if (bit_ev = KEEP) then
|
||||
bit_value <= '1';
|
||||
demanchestization_state <= DATA;
|
||||
rx_active <= '1';
|
||||
end if;
|
||||
when DATA =>
|
||||
when DATA => -- @suppress: Condition outside of case allows to exit this state
|
||||
bit_value <= not bit_value when bit_ev = TOGGLE else bit_value;
|
||||
bit_stb <= '1';
|
||||
when ERROR => -- @suppress: Condition outside of case allows to exit this state
|
||||
null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
if (bit_ev = ERROR) then
|
||||
rx_error <= '1';
|
||||
demanchestization_state <= ERROR;
|
||||
end if;
|
||||
|
||||
if (not transition_activity) then
|
||||
demanchestization_state <= SYNC;
|
||||
rx_active <= '0';
|
||||
|
Loading…
Reference in New Issue
Block a user