Line 48... |
Line 48... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.49 2004/10/25 06:37:51 igorm
|
|
// Arbitration bug fixed.
|
|
//
|
// Revision 1.48 2004/05/12 15:58:41 igorm
|
// Revision 1.48 2004/05/12 15:58:41 igorm
|
// Core improved to pass all tests with the Bosch VHDL Reference system.
|
// Core improved to pass all tests with the Bosch VHDL Reference system.
|
//
|
//
|
// Revision 1.47 2004/02/08 14:24:10 mohor
|
// Revision 1.47 2004/02/08 14:24:10 mohor
|
// Error counters changed.
|
// Error counters changed.
|
Line 522... |
Line 525... |
reg [2:0] passive_cnt;
|
reg [2:0] passive_cnt;
|
|
|
reg transmitting;
|
reg transmitting;
|
|
|
reg error_frame;
|
reg error_frame;
|
reg error_frame_q;
|
|
reg enable_error_cnt2;
|
reg enable_error_cnt2;
|
reg [2:0] error_cnt1;
|
reg [2:0] error_cnt1;
|
reg [2:0] error_cnt2;
|
reg [2:0] error_cnt2;
|
reg [2:0] delayed_dominant_cnt;
|
reg [2:0] delayed_dominant_cnt;
|
reg enable_overload_cnt2;
|
reg enable_overload_cnt2;
|
Line 538... |
Line 540... |
reg tx;
|
reg tx;
|
reg crc_err;
|
reg crc_err;
|
|
|
reg arbitration_lost;
|
reg arbitration_lost;
|
reg arbitration_lost_q;
|
reg arbitration_lost_q;
|
|
reg read_arbitration_lost_capture_reg_q;
|
reg [4:0] arbitration_lost_capture;
|
reg [4:0] arbitration_lost_capture;
|
reg arbitration_cnt_en;
|
reg arbitration_cnt_en;
|
reg arbitration_blocked;
|
reg arbitration_blocked;
|
reg tx_q;
|
reg tx_q;
|
|
|
Line 558... |
Line 561... |
reg transmitter;
|
reg transmitter;
|
reg finish_msg;
|
reg finish_msg;
|
|
|
reg [8:0] rx_err_cnt;
|
reg [8:0] rx_err_cnt;
|
reg [8:0] tx_err_cnt;
|
reg [8:0] tx_err_cnt;
|
reg rx_err_cnt_blocked;
|
|
reg [3:0] bus_free_cnt;
|
reg [3:0] bus_free_cnt;
|
reg bus_free_cnt_en;
|
reg bus_free_cnt_en;
|
reg bus_free;
|
reg bus_free;
|
reg waiting_for_bus_free;
|
reg waiting_for_bus_free;
|
|
|
Line 573... |
Line 575... |
reg bit_err_latched;
|
reg bit_err_latched;
|
reg stuff_err_latched;
|
reg stuff_err_latched;
|
reg form_err_latched;
|
reg form_err_latched;
|
reg rule3_exc1_1;
|
reg rule3_exc1_1;
|
reg rule3_exc1_2;
|
reg rule3_exc1_2;
|
reg rule3_exc2;
|
|
reg suspend;
|
reg suspend;
|
reg susp_cnt_en;
|
reg susp_cnt_en;
|
reg [2:0] susp_cnt;
|
reg [2:0] susp_cnt;
|
reg error_flag_over_latched;
|
reg error_flag_over_latched;
|
|
|
Line 1218... |
Line 1219... |
else if (rule3_exc1_1 & (error_cnt1 < 3'd7) & sample_point & (~sampled_bit))
|
else if (rule3_exc1_1 & (error_cnt1 < 3'd7) & sample_point & (~sampled_bit))
|
rule3_exc1_2 <=#Tp 1'b1;
|
rule3_exc1_2 <=#Tp 1'b1;
|
end
|
end
|
|
|
|
|
// Rule 3 exception 2 (Fault confinement).
|
|
always @ (posedge clk or posedge rst)
|
|
begin
|
|
if (rst)
|
|
rule3_exc2 <= 1'b0;
|
|
else if (reset_mode | error_flag_over)
|
|
rule3_exc2 <=#Tp 1'b0;
|
|
else if (transmitter & stuff_err & arbitration_field & sample_point & tx & (~sampled_bit))
|
|
rule3_exc2 <=#Tp 1'b1;
|
|
end
|
|
|
|
|
|
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
stuff_err_latched <= 1'b0;
|
stuff_err_latched <= 1'b0;
|
else if (reset_mode | error_frame_ended | go_overload_frame)
|
else if (reset_mode | error_frame_ended | go_overload_frame)
|
Line 1437... |
Line 1425... |
|
|
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
error_frame_q <=#Tp 1'b0;
|
|
else if (sample_point)
|
|
error_frame_q <=#Tp error_frame;
|
|
end
|
|
|
|
|
|
always @ (posedge clk or posedge rst)
|
|
begin
|
|
if (rst)
|
|
error_cnt1 <= 3'd0;
|
error_cnt1 <= 3'd0;
|
else if (reset_mode | error_frame_ended | go_error_frame | go_overload_frame)
|
else if (reset_mode | error_frame_ended | go_error_frame | go_overload_frame)
|
error_cnt1 <=#Tp 3'd0;
|
error_cnt1 <=#Tp 3'd0;
|
else if (error_frame & tx_point & (error_cnt1 < 3'd7))
|
else if (error_frame & tx_point & (error_cnt1 < 3'd7))
|
error_cnt1 <=#Tp error_cnt1 + 1'b1;
|
error_cnt1 <=#Tp error_cnt1 + 1'b1;
|
Line 1895... |
Line 1874... |
|
|
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
|
begin
|
arbitration_lost_q <=#Tp 1'b0;
|
arbitration_lost_q <=#Tp 1'b0;
|
|
read_arbitration_lost_capture_reg_q <=#Tp 1'b0;
|
|
end
|
else
|
else
|
|
begin
|
arbitration_lost_q <=#Tp arbitration_lost;
|
arbitration_lost_q <=#Tp arbitration_lost;
|
|
read_arbitration_lost_capture_reg_q <=#Tp read_arbitration_lost_capture_reg;
|
|
end
|
end
|
end
|
|
|
|
|
assign set_arbitration_lost_irq = arbitration_lost & (~arbitration_lost_q) & (~arbitration_blocked);
|
assign set_arbitration_lost_irq = arbitration_lost & (~arbitration_lost_q) & (~arbitration_blocked);
|
|
|
Line 1931... |
Line 1916... |
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
arbitration_lost_capture <= 5'h0;
|
arbitration_lost_capture <= 5'h0;
|
else if (read_arbitration_lost_capture_reg)
|
else if (read_arbitration_lost_capture_reg_q)
|
arbitration_lost_capture <=#Tp 5'h0;
|
arbitration_lost_capture <=#Tp 5'h0;
|
else if (sample_point & (~arbitration_blocked) & arbitration_cnt_en & (~bit_de_stuff))
|
else if (sample_point & (~arbitration_blocked) & arbitration_cnt_en & (~bit_de_stuff))
|
arbitration_lost_capture <=#Tp arbitration_lost_capture + 1'b1;
|
arbitration_lost_capture <=#Tp arbitration_lost_capture + 1'b1;
|
end
|
end
|
|
|
Line 2002... |
Line 1987... |
|
|
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
rx_err_cnt_blocked <= 1'b0;
|
|
else if (reset_mode | error_frame_ended | go_error_frame | go_overload_frame)
|
|
rx_err_cnt_blocked <=#Tp 1'b0;
|
|
else if (sample_point & (error_cnt1 == 3'd7))
|
|
rx_err_cnt_blocked <=#Tp 1'b1;
|
|
end
|
|
|
|
|
|
|
|
always @ (posedge clk or posedge rst)
|
|
begin
|
|
if (rst)
|
|
node_error_passive <= 1'b0;
|
node_error_passive <= 1'b0;
|
else if ((rx_err_cnt < 128) & (tx_err_cnt < 9'd128))
|
else if ((rx_err_cnt < 128) & (tx_err_cnt < 9'd128))
|
node_error_passive <=#Tp 1'b0;
|
node_error_passive <=#Tp 1'b0;
|
else if (((rx_err_cnt >= 128) | (tx_err_cnt >= 9'd128)) & (error_frame_ended | go_error_frame | (~reset_mode) & reset_mode_q) & (~node_bus_off))
|
else if (((rx_err_cnt >= 128) | (tx_err_cnt >= 9'd128)) & (error_frame_ended | go_error_frame | (~reset_mode) & reset_mode_q) & (~node_bus_off))
|
node_error_passive <=#Tp 1'b1;
|
node_error_passive <=#Tp 1'b1;
|