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

Subversion Repositories dbg_interface

[/] [dbg_interface/] [trunk/] [rtl/] [verilog/] [dbg_top.v] - Diff between revs 81 and 95

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

Rev 81 Rev 95
Line 41... Line 41...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.34  2003/12/23 15:07:34  mohor
 
// New directory structure. New version of the debug interface.
 
// Files that are not needed removed.
 
//
// Revision 1.33  2003/10/23 16:17:01  mohor
// Revision 1.33  2003/10/23 16:17:01  mohor
// CRC logic changed.
// CRC logic changed.
//
//
// Revision 1.32  2003/09/18 14:00:47  simons
// Revision 1.32  2003/09/18 14:00:47  simons
// Lower two address lines must be always zero.
// Lower two address lines must be always zero.
Line 167... Line 171...
`include "dbg_defines.v"
`include "dbg_defines.v"
 
 
// Top module
// Top module
module dbg_top(
module dbg_top(
                // JTAG signals
                // JTAG signals
                trst_i,     // trst_i is active high (inverted on higher layers)
 
                tck_i,
                tck_i,
                tdi_i,
                tdi_i,
                tdo_o,
                tdo_o,
 
 
                // TAP states
                // TAP states
Line 190... Line 193...
                wb_we_o, wb_ack_i, wb_cab_o, wb_err_i, wb_cti_o, wb_bte_o
                wb_we_o, wb_ack_i, wb_cab_o, wb_err_i, wb_cti_o, wb_bte_o
              );
              );
 
 
 
 
// JTAG signals
// JTAG signals
input   trst_i;
 
input   tck_i;
input   tck_i;
input   tdi_i;
input   tdi_i;
output  tdo_o;
output  tdo_o;
 
 
// TAP states
// TAP states
Line 251... Line 253...
 
 
reg tdo_o;
reg tdo_o;
reg wishbone_ce;
reg wishbone_ce;
 
 
// data counter
// data counter
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    data_cnt <= #1 'h0;
    data_cnt <= #1 'h0;
  else if(shift_dr_i & (~data_cnt_end))
  else if(shift_dr_i & (~data_cnt_end))
    data_cnt <= #1 data_cnt + 1'b1;
    data_cnt <= #1 data_cnt + 1'b1;
  else if (update_dr_i)
  else if (update_dr_i)
    data_cnt <= #1 'h0;
    data_cnt <= #1 'h0;
Line 266... Line 268...
 
 
assign data_cnt_end = data_cnt == `CHAIN_DATA_LEN;
assign data_cnt_end = data_cnt == `CHAIN_DATA_LEN;
 
 
 
 
// crc counter
// crc counter
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    crc_cnt <= #1 'h0;
    crc_cnt <= #1 'h0;
  else if(shift_dr_i & data_cnt_end & (~crc_cnt_end) & chain_select)
  else if(shift_dr_i & data_cnt_end & (~crc_cnt_end) & chain_select)
    crc_cnt <= #1 crc_cnt + 1'b1;
    crc_cnt <= #1 crc_cnt + 1'b1;
  else if (update_dr_i)
  else if (update_dr_i)
    crc_cnt <= #1 'h0;
    crc_cnt <= #1 'h0;
Line 288... Line 290...
    crc_cnt_end_q3 <= #1 crc_cnt_end_q2;
    crc_cnt_end_q3 <= #1 crc_cnt_end_q2;
  end
  end
 
 
 
 
// status counter
// status counter
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    status_cnt <= #1 'h0;
    status_cnt <= #1 'h0;
  else if(shift_dr_i & crc_cnt_end & (~status_cnt_end))
  else if(shift_dr_i & crc_cnt_end & (~status_cnt_end))
    status_cnt <= #1 status_cnt + 1'b1;
    status_cnt <= #1 status_cnt + 1'b1;
  else if (update_dr_i)
  else if (update_dr_i)
    status_cnt <= #1 'h0;
    status_cnt <= #1 'h0;
Line 304... Line 306...
 
 
 
 
assign selecting_command = shift_dr_i & (data_cnt == `DATA_CNT'h0) & debug_select_i;
assign selecting_command = shift_dr_i & (data_cnt == `DATA_CNT'h0) & debug_select_i;
 
 
 
 
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    chain_select <= #1 1'b0;
    chain_select <= #1 1'b0;
  else if(selecting_command & tdi_i)       // Chain select
  else if(selecting_command & tdi_i)       // Chain select
    chain_select <= #1 1'b1;
    chain_select <= #1 1'b1;
  else if (update_dr_i)
  else if (update_dr_i)
    chain_select <= #1 1'b0;
    chain_select <= #1 1'b0;
Line 329... Line 331...
    default               :   chain_select_error    <= #1 1'b1;
    default               :   chain_select_error    <= #1 1'b1;
  endcase
  endcase
end
end
 
 
 
 
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    chain <= `CHAIN_ID_LENGTH'b111;
    chain <= `CHAIN_ID_LENGTH'b111;
  else if(chain_select & crc_cnt_end & (~crc_cnt_end_q) & crc_match)
  else if(chain_select & crc_cnt_end & (~crc_cnt_end_q) & crc_match)
    chain <= #1 chain_dr[`CHAIN_DATA_LEN -1:1];
    chain <= #1 chain_dr[`CHAIN_DATA_LEN -1:1];
end
end
 
 
Line 354... Line 356...
dbg_crc32_d1 i_dbg_crc32_d1_in
dbg_crc32_d1 i_dbg_crc32_d1_in
             (
             (
              .data       (tdi_i),
              .data       (tdi_i),
              .enable     (shift_dr_i),
              .enable     (shift_dr_i),
              .shift      (1'b0),
              .shift      (1'b0),
              .rst        (trst_i),
              .rst        (wb_rst_i),
              .sync_rst   (update_dr_i),
              .sync_rst   (update_dr_i),
              .crc_out    (),
              .crc_out    (),
              .clk        (tck_i),
              .clk        (tck_i),
              .crc_match  (crc_match)
              .crc_match  (crc_match)
             );
             );
Line 388... Line 390...
             (
             (
              .data       (tdo_tmp),
              .data       (tdo_tmp),
              .enable     (crc_en), // enable has priority
              .enable     (crc_en), // enable has priority
//              .shift      (1'b0),
//              .shift      (1'b0),
              .shift      (shift_dr_i & crc_started & (~crc_en)),
              .shift      (shift_dr_i & crc_started & (~crc_en)),
              .rst        (trst_i),
              .rst        (wb_rst_i),
              .sync_rst   (update_dr_i),
              .sync_rst   (update_dr_i),
              .crc_out    (crc_out),
              .crc_out    (crc_out),
              .clk        (tck_i),
              .clk        (tck_i),
              .crc_match  ()
              .crc_match  ()
             );
             );
Line 456... Line 458...
 
 
 
 
// Signals for WISHBONE module
// Signals for WISHBONE module
 
 
 
 
always @ (posedge tck_i or posedge trst_i)
always @ (posedge tck_i or posedge wb_rst_i)
begin
begin
  if (trst_i)
  if (wb_rst_i)
    wishbone_ce <= #1 1'b0;
    wishbone_ce <= #1 1'b0;
  else if(selecting_command & (~tdi_i) & wishbone_scan_chain) // wishbone CE
  else if(selecting_command & (~tdi_i) & wishbone_scan_chain) // wishbone CE
    wishbone_ce <= #1 1'b1;
    wishbone_ce <= #1 1'b1;
  else if (update_dr_i)   // igor !!! This needs to be changed?
  else if (update_dr_i)   // igor !!! This needs to be changed?
    wishbone_ce <= #1 1'b0;
    wishbone_ce <= #1 1'b0;
Line 472... Line 474...
assign tdi_wb = wishbone_ce & tdi_i;
assign tdi_wb = wishbone_ce & tdi_i;
 
 
// Connecting wishbone module
// Connecting wishbone module
dbg_wb i_dbg_wb (
dbg_wb i_dbg_wb (
                  // JTAG signals
                  // JTAG signals
                  .trst_i        (trst_i), // trst_i is active high (inverted on higher layers)
 
                  .tck_i         (tck_i),
                  .tck_i         (tck_i),
                  .tdi_i         (tdi_wb),
                  .tdi_i         (tdi_wb),
                  .tdo_o         (tdo_wb),
                  .tdo_o         (tdo_wb),
 
 
                  // TAP states
                  // TAP states
Line 486... Line 487...
 
 
                  .wishbone_ce_i (wishbone_ce),
                  .wishbone_ce_i (wishbone_ce),
                  .crc_match_i   (crc_match),
                  .crc_match_i   (crc_match),
                  .crc_en_o      (crc_en_wb),
                  .crc_en_o      (crc_en_wb),
                  .shift_crc_o   (shift_crc_wb),
                  .shift_crc_o   (shift_crc_wb),
 
                  .rst_i         (wb_rst_i),
 
 
                  // WISHBONE common signals
                  // WISHBONE common signals
                  .wb_rst_i      (wb_rst_i),
 
                  .wb_clk_i      (wb_clk_i),
                  .wb_clk_i      (wb_clk_i),
 
 
                  // WISHBONE master interface
                  // WISHBONE master interface
                  .wb_adr_o      (wb_adr_o),
                  .wb_adr_o      (wb_adr_o),
                  .wb_dat_o      (wb_dat_o),
                  .wb_dat_o      (wb_dat_o),

powered by: WebSVN 2.1.0

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