⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 can_top.v

📁 The GRLIB IP Library is an integrated set of reusable IP cores, designed for system-on-chip (SOC) de
💻 V
📖 第 1 页 / 共 5 页
字号:
`ifdef CAN_BIST  ,  /* BIST signals */  .mbist_si_i(mbist_si_i),  .mbist_so_o(mbist_so_o),  .mbist_ctrl_i(mbist_ctrl_i),`endif  // port connections for Ram  //64x8  .q_dp_64x8(w_q_dp_64x8),  .data_64x8(w_data_64x8),  .wren_64x8(w_wren_64x8),  .rden_64x8(w_rden_64x8),  .wraddress_64x8(w_wraddress_64x8),  .rdaddress_64x8(w_rdaddress_64x8),  //64x4  .q_dp_64x4(w_q_dp_64x4),  .data_64x4(w_data_64x4),  .wren_64x4x1(w_wren_64x4x1),  .wraddress_64x4x1(w_wraddress_64x4x1),  .rdaddress_64x4x1(w_rdaddress_64x4x1),  //64x1  .q_dp_64x1(w_q_dp_64x1),  .data_64x1(w_data_64x1) );// Multiplexing wb_dat_o from registers and rx fifoalways @ (extended_mode or addr or reset_mode)begin  if (extended_mode & (~reset_mode) & ((addr >= 8'd16) && (addr <= 8'd28)) | (~extended_mode) & ((addr >= 8'd20) && (addr <= 8'd29)))    data_out_fifo_selected = 1'b1;  else    data_out_fifo_selected = 1'b0;endalways @ (posedge clk_i)begin  if (cs & (~we))    begin      if (data_out_fifo_selected)        data_out <=#Tp data_out_fifo;      else        data_out <=#Tp data_out_regs;    endendalways @ (posedge clk_i or posedge rst)begin  if (rst)    begin      rx_sync_tmp <= 1'b1;      rx_sync     <= 1'b1;    end  else    begin      rx_sync_tmp <=#Tp rx_i;      rx_sync     <=#Tp rx_sync_tmp;    endend`ifdef CAN_WISHBONE_IF  assign cs_can_i = 1'b1;  // Combining wb_cyc_i and wb_stb_i signals to cs signal. Than synchronizing to clk_i clock domain.   always @ (posedge clk_i or posedge rst)  begin    if (rst)      begin        cs_sync1     <= 1'b0;        cs_sync2     <= 1'b0;        cs_sync3     <= 1'b0;        cs_sync_rst1 <= 1'b0;        cs_sync_rst2 <= 1'b0;      end    else      begin        cs_sync1     <=#Tp wb_cyc_i & wb_stb_i & (~cs_sync_rst2) & cs_can_i;        cs_sync2     <=#Tp cs_sync1            & (~cs_sync_rst2);        cs_sync3     <=#Tp cs_sync2            & (~cs_sync_rst2);        cs_sync_rst1 <=#Tp cs_ack3;        cs_sync_rst2 <=#Tp cs_sync_rst1;      end  end      assign cs = cs_sync2 & (~cs_sync3);      always @ (posedge wb_clk_i)  begin    cs_ack1 <=#Tp cs_sync3;    cs_ack2 <=#Tp cs_ack1;    cs_ack3 <=#Tp cs_ack2;  end        // Generating acknowledge signal  always @ (posedge wb_clk_i)  begin    wb_ack_o <=#Tp (cs_ack2 & (~cs_ack3));  end  assign rst      = wb_rst_i;  assign we       = wb_we_i;  assign addr     = wb_adr_i;  assign data_in  = wb_dat_i;  assign wb_dat_o = data_out;`else  // Latching address  always @ (posedge clk_i or posedge rst)  begin    if (rst)      addr_latched <= 8'h0;    else if (ale_i)      addr_latched <=#Tp port_0_io;  end  // Generating delayed wr_i and rd_i signals  always @ (posedge clk_i or posedge rst)  begin    if (rst)      begin        wr_i_q <= 1'b0;        rd_i_q <= 1'b0;      end    else      begin        wr_i_q <=#Tp wr_i;        rd_i_q <=#Tp rd_i;      end  end  assign cs = ((wr_i & (~wr_i_q)) | (rd_i & (~rd_i_q))) & cs_can_i;  assign rst       = rst_i;  assign we        = wr_i;  assign addr      = addr_latched;  assign data_in   = port_0_io;  assign port_0_io = (cs_can_i & rd_i)? data_out : 8'hz;`endifendmodule//////////////////////////////////////////////////////////////////////////                                                              ////////  can_acf.v                                                   ////////                                                              ////////                                                              ////////  This file is part of the CAN Protocol Controller            ////////  http://www.opencores.org/projects/can/                      ////////                                                              ////////                                                              ////////  Author(s):                                                  ////////       Igor Mohor                                             ////////       igorm@opencores.org                                    ////////                                                              ////////                                                              ////////  All additional information is available in the README.txt   ////////  file.                                                       ////////                                                              //////////////////////////////////////////////////////////////////////////////                                                              //////// Copyright (C) 2002, 2003, 2004 Authors                       ////////                                                              //////// This source file may be used and distributed without         //////// restriction provided that this copyright statement is not    //////// removed from the file and that any derivative work contains  //////// the original copyright notice and the associated disclaimer. ////////                                                              //////// This source file is free software; you can redistribute it   //////// and/or modify it under the terms of the GNU Lesser General   //////// Public License as published by the Free Software Foundation; //////// either version 2.1 of the License, or (at your option) any   //////// later version.                                               ////////                                                              //////// This source is distributed in the hope that it will be       //////// useful, but WITHOUT ANY WARRANTY; without even the implied   //////// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //////// PURPOSE.  See the GNU Lesser General Public License for more //////// details.                                                     ////////                                                              //////// You should have received a copy of the GNU Lesser General    //////// Public License along with this source; if not, download it   //////// from http://www.opencores.org/lgpl.shtml                     ////////                                                              //////// The CAN protocol is developed by Robert Bosch GmbH and       //////// protected by patents. Anybody who wants to implement this    //////// CAN IP core on silicon has to obtain a CAN protocol license  //////// from Bosch.                                                  ////////                                                              ////////////////////////////////////////////////////////////////////////////// CVS Revision History//// $Log: can_acf.v,v $// Revision 1.9  2004/05/31 14:46:11  igorm// Bit acceptance_filter_mode was inverted.//// Revision 1.8  2004/02/08 14:16:44  mohor// Header changed.//// Revision 1.7  2003/07/16 13:41:34  mohor// Fixed according to the linter.//// Revision 1.6  2003/02/10 16:02:11  mohor// CAN is working according to the specification. WB interface and more// registers (status, IRQ, ...) needs to be added.//// Revision 1.5  2003/02/09 18:40:29  mohor// Overload fixed. Hard synchronization also enabled at the last bit of// interframe.//// Revision 1.4  2003/02/09 02:24:33  mohor// Bosch license warning added. Error counters finished. Overload frames// still need to be fixed.//// Revision 1.3  2003/01/31 01:13:37  mohor// backup.//// Revision 1.2  2003/01/14 12:19:35  mohor// rx_fifo is now working.//// Revision 1.1  2003/01/08 02:13:15  mohor// Acceptance filter added.////////// synopsys translate_off//`include "can_defines.v"`timescale 1ns/10ps// synopsys translate_onmodule can_acf(   clk,  rst,  id,    /* Mode register */  reset_mode,  acceptance_filter_mode,  extended_mode,    acceptance_code_0,  acceptance_code_1,  acceptance_code_2,  acceptance_code_3,  acceptance_mask_0,  acceptance_mask_1,  acceptance_mask_2,  acceptance_mask_3,    go_rx_crc_lim,  go_rx_inter,  go_error_frame,    data0,  data1,  rtr1,  rtr2,  ide,  no_byte0,  no_byte1,    id_ok    );parameter Tp = 1;input         clk;input         rst;input  [28:0] id;input         reset_mode;input         acceptance_filter_mode;input         extended_mode;input   [7:0] acceptance_code_0;input   [7:0] acceptance_code_1;input   [7:0] acceptance_code_2;input   [7:0] acceptance_code_3;input   [7:0] acceptance_mask_0;input   [7:0] acceptance_mask_1;input   [7:0] acceptance_mask_2;input   [7:0] acceptance_mask_3;input         go_rx_crc_lim;input         go_rx_inter;input         go_error_frame;input   [7:0] data0;input   [7:0] data1;input         rtr1;input         rtr2;input         ide;input         no_byte0;input         no_byte1;output        id_ok;reg           id_ok;wire          match;wire          match_sf_std;wire          match_sf_ext;wire          match_df_std;wire          match_df_ext;// Working in basic mode. ID match for standard format (11-bit ID).assign match =        ( (id[3]  == acceptance_code_0[0] | acceptance_mask_0[0] ) &                        (id[4]  == acceptance_code_0[1] | acceptance_mask_0[1] ) &                        (id[5]  == acceptance_code_0[2] | acceptance_mask_0[2] ) &                        (id[6]  == acceptance_code_0[3] | acceptance_mask_0[3] ) &                        (id[7]  == acceptance_code_0[4] | acceptance_mask_0[4] ) &                        (id[8]  == acceptance_code_0[5] | acceptance_mask_0[5] ) &                        (id[9]  == acceptance_code_0[6] | acceptance_mask_0[6] ) &                        (id[10] == acceptance_code_0[7] | acceptance_mask_0[7] )                      );// Working in extended mode. ID match for standard format (11-bit ID). Using single filter.assign match_sf_std = ( (id[3]  == acceptance_code_0[0] | acceptance_mask_0[0] ) &                        (id[4]  == acceptance_code_0[1] | acceptance_mask_0[1] ) &                        (id[5]  == acceptance_code_0[2] | acceptance_mask_0[2] ) &                        (id[6]  == acceptance_code_0[3] | acceptance_mask_0[3] ) &                        (id[7]  == acceptance_code_0[4] | acceptance_mask_0[4] ) &                        (id[8]  == acceptance_code_0[5] | acceptance_mask_0[5] ) &                        (id[9]  == acceptance_code_0[6] | acceptance_mask_0[6] ) &                        (id[10] == acceptance_code_0[7] | acceptance_mask_0[7] ) &                        (rtr1   == acceptance_code_1[4] | acceptance_mask_1[4] ) &                        (id[0]  == acceptance_code_1[5] | acceptance_mask_1[5] ) &                        (id[1]  == acceptance_code_1[6] | acceptance_mask_1[6] ) &                        (id[2]  == acceptance_code_1[7] | acceptance_mask_1[7] ) &                        (data0[0]  == acceptance_code_2[0] | acceptance_mask_2[0] | no_byte0) &                        (data0[1]  == acceptance_code_2[1] | acceptance_mask_2[1] | no_byte0) &                        (data0[2]  == acceptance_code_2[2] | acceptance_mask_2[2] | no_byte0) &                        (data0[3]  == acceptance_code_2[3] | acceptance_mask_2[3] | no_byte0) &                        (data0[4]  == acceptance_code_2[4] | acceptance_mask_2[4] | no_byte0) &                        (data0[5]  == acceptance_code_2[5] | acceptance_mask_2[5] | no_byte0) &                        (data0[6]  == acceptance_code_2[6] | acceptance_mask_2[6] | no_byte0) &                        (data0[7]  == acceptance_code_2[7] | acceptance_mask_2[7] | no_byte0) &                        (data1[0]  == acceptance_code_3[0] | acceptance_mask_3[0] | no_byte1) &                        (data1[1]  == acceptance_code_3[1] | acceptance_mask_3[1] | no_byte1) &                        (data1[2]  == acceptance_code_3[2] | acceptance_mask_3[2] | no_byte1) &                        (data1[3]  == acceptance_code_3[3] | acceptance_mask_3[3] | no_byte1) &                        (data1[4]  == acceptance_code_3[4] | acceptance_mask_3[4] | no_byte1) &                        (data1[5]  == acceptance_code_3[5] | acceptance_mask_3[5] | no_byte1) &                        (data1[6]  == acceptance_code_3[6] | acceptance_mask_3[6] | no_byte1) &                        (data1[7]  == acceptance_code_3[7] | acceptance_mask_3[7] | no_byte1)                      );// Working in extended mode. ID match for extended format (29-bit ID). Using single filter.assign match_sf_ext = ( (id[21]  == acceptance_code_0[0] | acceptance_mask_0[0] ) &                        (id[22]  == acceptance_code_0[1] | acceptance_mask_0[1] ) &                        (id[23]  == acceptance_code_0[2] | acceptance_mask_0[2] ) &                        (id[24]  == acceptance_code_0[3] | acceptance_mask_0[3] ) &                        (id[25]  == acceptance_code_0[4] | acceptance_mask_0[4] ) &                        (id[26]  == acceptance_code_0[5] | acceptance_mask_0[5] ) &                        (id[27]  == acceptance_code_0[6] | acceptance_mask_0[6] ) &                        (id[28]  == acceptance_code_0[7] | acceptance_mask_0[7] ) &                        (id[13]  == acceptance_code_1[0] | acceptance_mask_1[0] ) &                        (id[14]  == acceptance_code_1[1] | acceptance_mask_1[1] ) &                        (id[15]  == acceptance_code_1[2] | acceptance_mask_1[2] ) &                        (id[16]  == acceptance_code_1[3] | acceptance_mask_1[3] ) &                        (id[17]  == acceptance_code_1[4] | acceptance_mask_1[4] ) &                        (id[18]  == acceptance_code_1[5] | acceptance_mask_1[5] ) &                        (id[19]  == acceptance_code_1[6] | acceptance_mask_1[6] ) &                        (id[20]  == acceptance_code_1[7] | acceptance_mask_1[7] ) &                        (id[5]  == acceptance_code_2[0] | acceptance_mask_2[0] ) &                        (id[6]  == acceptance_code_2[1] | acceptance_mask_2[1] ) &                        (id[7]  == acceptance_code_2[2] | acceptance_mask_2[2] ) &                        (id[8]  == acceptance_code_2[3] | acceptance_mask_2[3] ) &                        (id[9]  == acceptance_code_2[4] | acceptance_mask_2[4] ) &                        (id[10] == acceptance_code_2[5] | acceptance_mask_2[5] ) &                        (id[11] == acceptance_code_2[6] | acceptance_mask_2[6] ) &                        (id[12] == acceptance_code_2[7] | acceptance_mask_2[7] ) &                        (rtr2   == acceptance_code_3[2] | acceptance_mask_3[2] ) &

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -