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

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [trunk/] [Hardware/] [adv_dbg_if/] [bench/] [simulated_system/] [adv_dbg_tb.v] - Diff between revs 8 and 32

Show entire file | Details | Blame | View Log

Rev 8 Rev 32
Line 38... Line 38...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: adv_dbg_tb.v,v $
// $Log: adv_dbg_tb.v,v $
 
// Revision 1.7  2010-01-13 00:55:45  Nathan
 
// Created hi-speed mode for burst reads.  This will probably be most beneficial to the OR1K module, as GDB does a burst read of all the GPRs each time a microinstruction is single-stepped.
 
//
// Revision 1.2  2009/05/17 20:54:55  Nathan
// Revision 1.2  2009/05/17 20:54:55  Nathan
// Changed email address to opencores.org
// Changed email address to opencores.org
//
//
// Revision 1.1  2008/07/08 19:11:55  Nathan
// Revision 1.1  2008/07/08 19:11:55  Nathan
// Added second testbench to simulate a complete system, including OR1200, wb_conbus, and onchipram.  Renamed sim-only testbench directory from verilog to simulated_system.
// Added second testbench to simulate a complete system, including OR1200, wb_conbus, and onchipram.  Renamed sim-only testbench directory from verilog to simulated_system.
Line 53... Line 56...
// Removed code to select top-level module as active (it served no purpose).  Re-numbered modules, requiring changes to testbench and software driver.
// Removed code to select top-level module as active (it served no purpose).  Re-numbered modules, requiring changes to testbench and software driver.
//
//
 
 
 
 
`include "tap_defines.v"
`include "tap_defines.v"
`include "dbg_defines.v"
`include "adbg_defines.v"
`include "dbg_wb_defines.v"
`include "adbg_wb_defines.v"
`include "wb_model_defines.v"
`include "wb_model_defines.v"
 
 
// Polynomial for the CRC calculation
// Polynomial for the CRC calculation
// Yes, it's backwards.  Yes, this is on purpose.
// Yes, it's backwards.  Yes, this is on purpose.
// To decrease logic + routing, we want to shift the CRC calculation
// To decrease logic + routing, we want to shift the CRC calculation
Line 303... Line 306...
    write_bit(`JTAG_TMS_bit);  // update_dr
    write_bit(`JTAG_TMS_bit);  // update_dr
    write_bit(3'h0);           // idle
    write_bit(3'h0);           // idle
    #1000;
    #1000;
    */
    */
 
 
    #1000;
    /*
     $display("Testing WB intreg select at time %t", $time);
    #1000;
    select_module_internal_register(32'h1, 1);  // Really just a read, with discarded data
     $display("Testing WB intreg select at time %t", $time);
    #1000;
    select_module_internal_register(32'h1, 1);  // Really just a read, with discarded data
     select_module_internal_register(32'h0, 1);  // Really just a read, with discarded data
    #1000;
   #1000;
     select_module_internal_register(32'h0, 1);  // Really just a read, with discarded data
 
   #1000;
   // Reset the error bit    
 
    write_module_internal_register(32'h0, 8'h1, 32'h1, 8'h1);  // idx, idxlen, data, datalen
 
   #1000;
 
 
 
   // Read the error bit
   // Reset the error bit
   read_module_internal_register(8'd33, err_data);  // We assume the register is already selected
    write_module_internal_register(32'h0, 8'h1, 32'h1, 8'h1);  // idx, idxlen, data, datalen
   #1000;
   #1000;
 
 
 
   // Read the error bit
 
   read_module_internal_register(8'd33, err_data);  // We assume the register is already selected
 
   #1000;
 
*/
 
 
  /////////////////////////////////
  /////////////////////////////////
  // Test 8-bit WB access
  // Test 8-bit WB access
  failed = 0;
  failed = 0;
  $display("Testing WB 8-bit burst write at time %t: resetting ", $time);
  $display("Testing WB 8-bit burst write at time %t: resetting ", $time);
Line 449... Line 453...
                .sample_preload_select_o(),
                .sample_preload_select_o(),
                .mbist_select_o(),
                .mbist_select_o(),
                .debug_select_o(dbg_sel),
                .debug_select_o(dbg_sel),
 
 
                // TDO signal that is connected to TDI of sub-modules.
                // TDO signal that is connected to TDI of sub-modules.
                .tdo_o(dbg_tdo),
                .tdi_o(dbg_tdo),
 
 
                // TDI signals from sub-modules
                // TDI signals from sub-modules
                .debug_tdi_i(dbg_tdi),    // from debug module
                .debug_tdo_i(dbg_tdi),    // from debug module
                .bs_chain_tdi_i(1'b0), // from Boundary Scan Chain
                .bs_chain_tdo_i(1'b0), // from Boundary Scan Chain
                .mbist_tdi_i(1'b0)     // from Mbist Chain
                .mbist_tdo_i(1'b0)     // from Mbist Chain
              );
              );
 
 
 
 
// Top module
// Top module
dbg_top i_dbg_module(
adbg_top i_dbg_module(
                // JTAG signals
                // JTAG signals
                .tck_i(jtag_tck_o),
                .tck_i(jtag_tck_o),
                .tdi_i(dbg_tdo),
                .tdi_i(dbg_tdo),
                .tdo_o(dbg_tdi),
                .tdo_o(dbg_tdi),
                .rst_i(dbg_rst),
                .rst_i(dbg_rst),
Line 790... Line 794...
   // Get us back to shift_dr mode to read a burst
   // Get us back to shift_dr mode to read a burst
   write_bit(`JTAG_TMS_bit);  // select_dr_scan
   write_bit(`JTAG_TMS_bit);  // select_dr_scan
   write_bit(3'h0);           // capture_ir
   write_bit(3'h0);           // capture_ir
   write_bit(3'h0);           // shift_ir
   write_bit(3'h0);           // shift_ir
 
 
 
`ifdef ADBG_USE_HISPEED
 
      // Get 1 status bit, then word_size_bytes*8 bits
 
      status = 1'b0;
 
      j = 0;
 
      while(!status) begin
 
         read_write_bit(3'h0, status);
 
         j = j + 1;
 
      end
 
 
 
      if(j > 1) begin
 
         $display("Took %0d tries before good status bit during burst read", j);
 
      end
 
`endif
 
 
   // Now, repeat...
   // Now, repeat...
   for(i = 0; i < word_count; i=i+1) begin
   for(i = 0; i < word_count; i=i+1) begin
 
 
 
`ifndef ADBG_USE_HISPEED
      // Get 1 status bit, then word_size_bytes*8 bits
      // Get 1 status bit, then word_size_bytes*8 bits
      status = 1'b0;
      status = 1'b0;
      j = 0;
      j = 0;
      while(!status) begin
      while(!status) begin
         read_write_bit(3'h0, status);
         read_write_bit(3'h0, status);
Line 803... Line 823...
      end
      end
 
 
      if(j > 1) begin
      if(j > 1) begin
         $display("Took %0d tries before good status bit during burst read", j);
         $display("Took %0d tries before good status bit during burst read", j);
      end
      end
 
`endif
 
 
     jtag_read_write_stream(64'h0, {2'h0,(word_size_bytes<<3)},0,instream);
     jtag_read_write_stream(64'h0, {2'h0,(word_size_bytes<<3)},0,instream);
     //$display("Read 0x%0x", instream[31:0]);
     //$display("Read 0x%0x", instream[31:0]);
     compute_crc(crc_calc_i, instream[31:0], word_size_bits, crc_calc_o);
     compute_crc(crc_calc_i, instream[31:0], word_size_bits, crc_calc_o);
     crc_calc_i = crc_calc_o;
     crc_calc_i = crc_calc_o;
Line 880... Line 901...
 
 
      jtag_write_stream(dataword, {2'h0,(word_size_bytes<<3)},0);
      jtag_write_stream(dataword, {2'h0,(word_size_bytes<<3)},0);
      compute_crc(crc_calc_i, dataword[31:0], word_size_bits, crc_calc_o);
      compute_crc(crc_calc_i, dataword[31:0], word_size_bits, crc_calc_o);
      crc_calc_i = crc_calc_o;
      crc_calc_i = crc_calc_o;
 
 
 
 
 
`ifndef ADBG_USE_HISPEED
      // Check if WB bus is ready
      // Check if WB bus is ready
      // *** THIS WILL NOT WORK IF THERE IS MORE THAN 1 DEVICE IN THE JTAG CHAIN!!!
      // *** THIS WILL NOT WORK IF THERE IS MORE THAN 1 DEVICE IN THE JTAG CHAIN!!!
      status = 1'b0;
      status = 1'b0;
      read_write_bit(3'h0, status);
      read_write_bit(3'h0, status);
 
 
      if(!status) begin
      if(!status) begin
         $display("Bad status bit during burst write, index %d", i);
         $display("Bad status bit during burst write, index %d", i);
      end
      end
 
`endif
 
 
     //$display("Wrote 0x%0x", dataword);
     //$display("Wrote 0x%0x", dataword);
   end
   end
 
 
   // Send the CRC we computed
   // Send the CRC we computed

powered by: WebSVN 2.1.0

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