OpenCores
URL https://opencores.org/ocsvn/can/can/trunk

Subversion Repositories can

[/] [can/] [trunk/] [rtl/] [verilog/] [can_btl.v] - Diff between revs 137 and 141

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 137 Rev 141
Line 48... Line 48...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.28  2004/02/08 14:25:26  mohor
 
// Header changed.
 
//
// Revision 1.27  2003/09/30 00:55:13  mohor
// Revision 1.27  2003/09/30 00:55:13  mohor
// Error counters fixed to be compatible with Bosch VHDL reference model.
// Error counters fixed to be compatible with Bosch VHDL reference model.
// Small synchronization changes.
// Small synchronization changes.
//
//
// Revision 1.26  2003/09/25 18:55:49  mohor
// Revision 1.26  2003/09/25 18:55:49  mohor
Line 220... Line 223...
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;
 
 
 
 
 
 
reg     [6:0] clk_cnt;
reg     [6:0] clk_cnt;
reg           clk_en;
reg           clk_en;
reg           clk_en_q;
reg           clk_en_q;
reg           sync_blocked;
reg           sync_blocked;
reg           hard_sync_blocked;
reg           hard_sync_blocked;
Line 248... Line 249...
wire [7:0]    preset_cnt;
wire [7:0]    preset_cnt;
wire          sync_window;
wire          sync_window;
wire          resync;
wire          resync;
 
 
 
 
 
 
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 | rx_inter)    & (~rx) & sampled_bit & (~hard_sync_blocked);  // Hard synchronization
assign hard_sync  =   (rx_idle | rx_inter)    & (~rx) & sampled_bit & (~hard_sync_blocked);  // Hard synchronization
assign resync     =  (~rx_idle) & (~rx_inter) & (~rx) & sampled_bit & (~sync_blocked);       // Re-synchronization
assign resync     =  (~rx_idle) & (~rx_inter) & (~rx) & sampled_bit & (~sync_blocked);       // Re-synchronization
 
 
 
 
 
 
/* Generating general enable signal that defines baud rate. */
/* Generating general enable signal that defines baud rate. */
always @ (posedge clk or posedge rst)
always @ (posedge clk or posedge rst)
begin
begin
  if (rst)
  if (rst)
    clk_cnt <= 7'h0;
    clk_cnt <= 7'h0;
Line 301... Line 302...
begin
begin
  if (rst)
  if (rst)
    tx_point <= 1'b0;
    tx_point <= 1'b0;
  else
  else
    tx_point <=#Tp ~tx_point & seg2 & (  clk_en & (quant_cnt[2:0] == time_segment2)
    tx_point <=#Tp ~tx_point & seg2 & (  clk_en & (quant_cnt[2:0] == time_segment2)
                                       | clk_en_q & (resync | hard_sync)
                                       | (clk_en | clk_en_q) & (resync | hard_sync)
                                      );    // When transmitter we should transmit as soon as possible.
                                      );    // When transmitter we should transmit as soon as possible.
end
end
 
 
 
 
 
 
/* When early edge is detected outside of the SJW field, synchronization request is latched and performed when
/* When early edge is detected outside of the SJW field, synchronization request is latched and performed when
   SJW is reached */
   SJW is reached */
always @ (posedge clk or posedge rst)
always @ (posedge clk or posedge rst)
begin
begin
  if (rst)
  if (rst)
Line 401... Line 403...
    begin
    begin
      sampled_bit <= 1'b1;
      sampled_bit <= 1'b1;
      sampled_bit_q <= 1'b1;
      sampled_bit_q <= 1'b1;
      sample_point <= 1'b0;
      sample_point <= 1'b0;
    end
    end
 
  else if (go_error_frame)
 
    begin
 
      sampled_bit_q <=#Tp sampled_bit;
 
      sample_point <=#Tp 1'b0;
 
    end
  else if (clk_en_q & (~hard_sync))
  else if (clk_en_q & (~hard_sync))
    begin
    begin
      if (seg1 & (quant_cnt == (time_segment1 + delay)))
      if (seg1 & (quant_cnt == (time_segment1 + delay)))
        begin
        begin
          sample_point <=#Tp 1'b1;
          sample_point <=#Tp 1'b1;
Line 455... Line 462...
/* Blocking hard synchronization when occurs once or when we are transmitting a msg */
/* Blocking hard synchronization when occurs once or when we are transmitting a msg */
always @ (posedge clk or posedge rst)
always @ (posedge clk or posedge rst)
begin
begin
  if (rst)
  if (rst)
    hard_sync_blocked <=#Tp 1'b0;
    hard_sync_blocked <=#Tp 1'b0;
  else if (hard_sync & clk_en_q | transmitting & transmitter & tx_point & (~tx_next))
  else if (hard_sync & clk_en_q | (transmitting & transmitter | go_tx) & tx_point & (~tx_next))
    hard_sync_blocked <=#Tp 1'b1;
    hard_sync_blocked <=#Tp 1'b1;
  else if (go_rx_inter | (rx_idle | rx_inter) & sample_point & sampled_bit)  // When a glitch performed synchronization
  else if (go_rx_inter | (rx_idle | rx_inter) & sample_point & sampled_bit)  // When a glitch performed synchronization
    hard_sync_blocked <=#Tp 1'b0;
    hard_sync_blocked <=#Tp 1'b0;
end
end
 
 
Line 467... Line 474...
 
 
 
 
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.