diff --git a/lib/emac/src/sipo.vhd b/lib/emac/src/sipo.vhd index ebed385..31b98ab 100644 --- a/lib/emac/src/sipo.vhd +++ b/lib/emac/src/sipo.vhd @@ -41,7 +41,7 @@ ARCHITECTURE behavior OF sipo IS -------------------------------------------------------------------------- begin - pre_fin <= shift_cnt_pipe(shift_cnt_pipe'left); + pre_fin <= shift_cnt_pipe(shift_cnt_pipe'left) when msb_first else shift_cnt_pipe(0); dout_en <= out_en; dout_vld <= out_vld; @@ -86,9 +86,17 @@ process(clk) begin if rising_edge(clk) then if rst = '1' or pre_fin = '1' then - shift_cnt_pipe <= (shift_cnt_pipe'left downto 1 => '0') & din_vld; + if (msb_first) then + shift_cnt_pipe <= (shift_cnt_pipe'left downto 1 => '0') & din_vld; + else + shift_cnt_pipe <= din_vld & (shift_cnt_pipe'left downto 1 => '0'); + end if; elsif din_vld = '1' or abort = '1' then - shift_cnt_pipe <= shift_cnt_pipe(shift_cnt_pipe'left-1 downto 0) & din_vld; + if (msb_first) then + shift_cnt_pipe <= shift_cnt_pipe(shift_cnt_pipe'left-1 downto 0) & din_vld; + else + shift_cnt_pipe <= din_vld & shift_cnt_pipe(shift_cnt_pipe'left downto 1); + end if; end if; end if; end process;