| Line 48... |
Line 48... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.16 2003/06/16 13:57:58 mohor
|
|
// tx_point generated one clk earlier. rx_i registered. Data corrected when
|
|
// using extended mode.
|
|
//
|
// Revision 1.15 2003/06/13 15:02:24 mohor
|
// Revision 1.15 2003/06/13 15:02:24 mohor
|
// Synchronization is also needed when transmitting a message.
|
// Synchronization is also needed when transmitting a message.
|
//
|
//
|
// Revision 1.14 2003/06/13 14:55:11 mohor
|
// Revision 1.14 2003/06/13 14:55:11 mohor
|
// Counters width changed.
|
// Counters width changed.
|
| Line 127... |
Line 131... |
sample_point,
|
sample_point,
|
sampled_bit,
|
sampled_bit,
|
sampled_bit_q,
|
sampled_bit_q,
|
tx_point,
|
tx_point,
|
hard_sync,
|
hard_sync,
|
go_seg1,
|
|
|
|
/* Output from can_bsp module */
|
/* Output from can_bsp module */
|
rx_idle,
|
rx_idle,
|
overjump_sync_seg,
|
|
last_bit_of_inter
|
last_bit_of_inter
|
|
|
|
|
|
|
|
|
| Line 160... |
Line 162... |
input [2:0] time_segment2;
|
input [2:0] time_segment2;
|
input triple_sampling;
|
input triple_sampling;
|
|
|
/* Output from can_bsp module */
|
/* Output from can_bsp module */
|
input rx_idle;
|
input rx_idle;
|
input overjump_sync_seg;
|
|
input last_bit_of_inter;
|
input last_bit_of_inter;
|
|
|
/* Output signals from this module */
|
/* Output signals from this module */
|
output sample_point;
|
output sample_point;
|
output sampled_bit;
|
output sampled_bit;
|
output sampled_bit_q;
|
output sampled_bit_q;
|
output tx_point;
|
output tx_point;
|
output hard_sync;
|
output hard_sync;
|
output go_seg1;
|
|
|
|
|
|
|
|
reg [8:0] clk_cnt;
|
reg [8:0] clk_cnt;
|
reg clk_en;
|
reg clk_en;
|
| Line 196... |
Line 196... |
wire go_seg1;
|
wire go_seg1;
|
wire go_seg2;
|
wire go_seg2;
|
wire [8:0] preset_cnt;
|
wire [8:0] preset_cnt;
|
wire sync_window;
|
wire sync_window;
|
wire resync;
|
wire resync;
|
wire quant_cnt_rst1;
|
wire quant_cnt_rst;
|
wire quant_cnt_rst2;
|
|
|
|
|
|
|
|
assign preset_cnt = (baud_r_presc + 1'b1)<<1; // (BRP+1)*2
|
assign preset_cnt = (baud_r_presc + 1'b1)<<1; // (BRP+1)*2
|
assign hard_sync = (rx_idle | last_bit_of_inter) & (~rx) & sampled_bit & (~sync_blocked); // Hard synchronization
|
assign hard_sync = (rx_idle | last_bit_of_inter) & (~rx) & sampled_bit & (~sync_blocked); // Hard synchronization
|
| Line 308... |
Line 307... |
seg2 <=#Tp 1'b0;
|
seg2 <=#Tp 1'b0;
|
end
|
end
|
|
|
|
|
/* Quant counter */
|
/* Quant counter */
|
|
assign quant_cnt_rst = go_sync | go_seg1 | go_seg2;
|
|
|
//assign quant_cnt_rst1 = go_sync | go_seg1 & (~overjump_sync_seg) | go_seg2;
|
|
//assign quant_cnt_rst2 = go_seg1 & overjump_sync_seg;
|
|
assign quant_cnt_rst1 = go_sync | go_seg1 | go_seg2;
|
|
assign quant_cnt_rst2 = 1'b0;
|
|
always @ (posedge clk or posedge rst)
|
always @ (posedge clk or posedge rst)
|
begin
|
begin
|
if (rst)
|
if (rst)
|
quant_cnt <= 0;
|
quant_cnt <= 0;
|
else if (quant_cnt_rst1)
|
else if (quant_cnt_rst)
|
quant_cnt <=#Tp 0;
|
quant_cnt <=#Tp 0;
|
else if (quant_cnt_rst2)
|
|
quant_cnt <=#Tp 1;
|
|
else if (clk_en_q)
|
else if (clk_en_q)
|
quant_cnt <=#Tp quant_cnt + 1'b1;
|
quant_cnt <=#Tp quant_cnt + 1'b1;
|
end
|
end
|
|
|
|
|