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

Subversion Repositories xgate

[/] [xgate/] [trunk/] [bench/] [verilog/] [tst_bench_top.v] - Diff between revs 82 and 86

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

Rev 82 Rev 86
Line 45... Line 45...
 
 
  parameter MAX_CHANNEL = 127;    // Max XGATE Interrupt Channel Number
  parameter MAX_CHANNEL = 127;    // Max XGATE Interrupt Channel Number
  parameter STOP_ON_ERROR = 1'b0;
  parameter STOP_ON_ERROR = 1'b0;
  parameter MAX_VECTOR = 9000;
  parameter MAX_VECTOR = 9000;
 
 
 
  parameter IR_BITS = 4;     // Number of bits in JTAG instruction
 
  parameter JTAG_PERIOD = 4; // JTAG Test clock half period
 
 
  parameter L_BYTE = 2'b01;
  parameter L_BYTE = 2'b01;
  parameter H_BYTE = 2'b10;
  parameter H_BYTE = 2'b10;
  parameter WORD   = 2'b11;
  parameter WORD   = 2'b11;
 
 
 
 
Line 152... Line 155...
  reg         rstn;
  reg         rstn;
  reg         sync_reset;
  reg         sync_reset;
  reg         por_reset_b;
  reg         por_reset_b;
  reg         scantestmode;
  reg         scantestmode;
 
 
 
  reg         jtag_tck;
 
  reg         jtag_tdi;
 
  reg         jtag_tms;
 
 
 
  wire        jtag_tdo;
 
  wire        jtag_tdo_en;
 
 
  reg  [MAX_CHANNEL:1] channel_req;  // XGATE Interrupt inputs
  reg  [MAX_CHANNEL:1] channel_req;  // XGATE Interrupt inputs
  wire [MAX_CHANNEL:1] xgif;         // XGATE Interrupt outputs
  wire [MAX_CHANNEL:1] xgif;         // XGATE Interrupt outputs
  wire         [  7:0] xgswt;         // XGATE Software Trigger outputs
  wire         [  7:0] xgswt;         // XGATE Software Trigger outputs
  wire                 xg_sw_irq;    // Xgate Software Error interrupt
  wire                 xg_sw_irq;    // Xgate Software Error interrupt
  wire          [15:0] brkpt_cntl;   // 
  wire          [15:0] brkpt_cntl;   // 
Line 230... Line 240...
      test_num = 0;
      test_num = 0;
      por_reset_b = 0;
      por_reset_b = 0;
      scantestmode = 0;
      scantestmode = 0;
      error_count = 0;
      error_count = 0;
      mem_wait_state_enable = 0;
      mem_wait_state_enable = 0;
 
      jtag_tck = 0;
 
      jtag_tdi = 0;
 
      jtag_tms = 1;
 
 
      // channel_req = 0;
      // channel_req = 0;
 
 
      `ifdef WAVES
      `ifdef WAVES
           $shm_open("waves");
           $shm_open("waves");
           $shm_probe("AS",tst_bench_top,"AS");
           $shm_probe("AS",tst_bench_top,"AS");
Line 409... Line 423...
          .debug_mode_i( 1'b0 ),
          .debug_mode_i( 1'b0 ),
          .secure_mode_i( 1'b0 ),
          .secure_mode_i( 1'b0 ),
          .scantestmode( scantestmode )
          .scantestmode( scantestmode )
  );
  );
 
 
 
  xgate_jtag #(.IR_BITS(IR_BITS))
 
  jtag(
 
  .jtag_tdo( jtag_tdo ),
 
  .jtag_tdo_en( jtag_tdo_en ),
 
 
 
  .jtag_tdi( jtag_tdi ),
 
  .jtag_clk( jtag_tck ),
 
  .jtag_reset_n( rstn ),
 
  .jtag_tms( jtag_tms )
 
  );
 
 
 
 
  tb_slave #(.DWIDTH(16),
  tb_slave #(.DWIDTH(16),
             .SINGLE_CYCLE(1'b1),
             .SINGLE_CYCLE(1'b1),
             .MAX_CHANNEL(MAX_CHANNEL))
             .MAX_CHANNEL(MAX_CHANNEL))
          tb_slave_regs(
          tb_slave_regs(
          // wishbone interface
          // wishbone interface
Line 497... Line 523...
 
 
    // End testing
    // End testing
    wrap_up;
    wrap_up;
  end
  end
 
 
 
// Main JTAG Test Program
 
initial
 
  begin
 
    $display("\nstatus at time: %t Testbench started", $time);
 
  //              tms, tdi
 
    send_jtag_bit(1,0);  // RUN/TEST/IDLE
 
    send_jtag_bit(0,1);  // SEL DR
 
    send_jtag_bit(1,1);  // SEL IR
 
    send_jtag_bit(1,1);  // Capture IR
 
    send_jtag_bit(0,1);  // Dead Bit?
 
    send_jtag_bit(0,1);  // LSB
 
    send_jtag_bit(0,0);  // Bit 1
 
    send_jtag_bit(0,1);  // Bit 2
 
    send_jtag_bit(0,0);  // Bit 3
 
    send_jtag_bit(1,1);  // EXIT1 IR
 
    send_jtag_bit(1,1);  // UPDATE IR
 
    send_jtag_bit(0,1);  // RUN/TEST/IDLE    
 
    send_jtag_bit(0,1);  // RUN/TEST/IDLE    
 
 
 
  end
 
 
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Test CHID Debug mode operation
// Test CHID Debug mode operation
task test_chid_debug;
task test_chid_debug;
  begin
  begin
    test_num = test_num + 1;
    test_num = test_num + 1;
Line 1336... Line 1383...
    $finish;
    $finish;
  end
  end
endtask
endtask
 
 
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
 
task send_jtag_bit;
 
  input tms_val;
 
  input tdi_val;
 
  begin
 
        jtag_tck = 0;
 
        repeat(JTAG_PERIOD) @(posedge mstr_test_clk);
 
        jtag_tck = 1;
 
        #1;
 
        jtag_tms = tms_val;
 
        jtag_tdi = tdi_val;
 
        repeat(JTAG_PERIOD) @(posedge mstr_test_clk);
 
        jtag_tck = 0;
 
  end
 
endtask
 
 
 
////////////////////////////////////////////////////////////////////////////////
function [15:0] four_2_16;
function [15:0] four_2_16;
  input [3:0] vector;
  input [3:0] vector;
  begin
  begin
    case (vector)
    case (vector)
      4'h0 : four_2_16 = 16'b0000_0000_0000_0001;
      4'h0 : four_2_16 = 16'b0000_0000_0000_0001;

powered by: WebSVN 2.1.0

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