Commit 0666e279 authored by pabloalvarez's avatar pabloalvarez

CRC OK

git-svn-id: http://svn.ohwr.org/cern-fip/trunk/hdl/design@13 7f0067c9-7624-46c7-bd39-3fb5400c0213
parent 2bea548e
......@@ -88,15 +88,17 @@ constant c_poly : std_logic_vector(c_poly_length - 1 downto 0) := "0001110
constant c_check_mask : std_logic_vector(c_poly_length - 1 downto 0) := "0001110001101011";
signal s_q, s_q_nx : std_logic_vector(c_poly_length - 1 downto 0);
signal s_crc_rdy_p : std_logic;
signal s_crc_rdy_p : std_logic;
signal s_d : std_logic;
begin
s_d <= d_i;
G: for I in 0 to c_poly'left generate
G0: if I = 0 generate
s_q_nx(I) <= data_fcs_sel_n and (d_i xor s_q(s_q'left));
s_q_nx(I) <= data_fcs_sel_n and (( s_d) xor s_q(s_q'left));
end generate;
G1: if I > 0 generate
s_q_nx(I) <= s_q(I-1) xor (c_poly(I) and data_fcs_sel_n and (d_i xor s_q(s_q'left)));
s_q_nx(I) <= s_q(I-1) xor (c_poly(I) and data_fcs_sel_n and (s_d xor s_q(s_q'left)));
end generate;
end generate;
......@@ -116,7 +118,7 @@ begin
end if;
end process;
crc_o <= s_q;
crc_o <= not s_q;
crc_rdy_p_o <= s_crc_rdy_p;
process(s_q, s_crc_rdy_p)
......
......@@ -43,8 +43,8 @@ constant c_p3_var_length_table : t_integer_array(0 to 7) :=
(0 => 2, 1 => 8, 2 => 16, 3 => 32, 4 => 64, 5 => 124, others => 0);
constant c_id_dat : std_logic_vector(7 downto 0) := "11000000";
constant c_rp_dat : std_logic_vector(7 downto 0) := "01000000";
constant c_id_dat : std_logic_vector(7 downto 0) := "00000011";
constant c_rp_dat : std_logic_vector(7 downto 0) := "00000010";
--constant c_var_presence : std_logic_vector(7 downto 0) := x"14";
......
......@@ -239,7 +239,7 @@ begin
s_reset_pointer <= s_pointer_is_zero and clk_fixed_carrier_p_d_i(2);
s_calc_crc <= '1';
when tx_last_byte =>
request_byte_p_o <= s_pointer_is_zero and clk_fixed_carrier_p_d_i(0);
-- request_byte_p_o <= s_pointer_is_zero and clk_fixed_carrier_p_d_i(0);
s_inc_pointer <= clk_fixed_carrier_p_d_i(2);
s_nx_data <= s_manchester_byte(to_integer(resize(s_pointer,4)));
s_nx_data_e <= '1';
......@@ -254,7 +254,7 @@ begin
s_inc_pointer <= clk_fixed_carrier_p_d_i(2);
s_nx_data <= s_manchester_crc(to_integer(resize(s_pointer,4)));
s_nx_data <= s_manchester_crc(to_integer(resize(s_pointer,5)));
-- s_nx_data <= (not s_crc(s_crc'left)) xor ( s_pointer(0)); -- s_crc(s_crc'left) is xored with s_pointer(0) to mimic
-- a manchester encoder
s_nx_data_e <= '1';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment