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

Subversion Repositories xgate

[/] [xgate/] [trunk/] [bench/] [verilog/] [tst_bench_top.v] - Diff between revs 54 and 60

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

Rev 54 Rev 60
Line 43... Line 43...
 
 
module tst_bench_top();
module tst_bench_top();
 
 
  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 = 3000;
  parameter MAX_VECTOR = 8000;
 
 
  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 1193... Line 1193...
  input                      rst,  // No Connect
  input                      rst,  // No Connect
  input                      err,  // No Connect
  input                      err,  // No Connect
  input                      rty   // No Connect
  input                      rty   // No Connect
  );
  );
 
 
  // Debug states for change CHID
  // States for bus arbitration
  parameter [1:0] BUS_IDLE = 2'b00,
  parameter [1:0] BUS_IDLE = 2'b00,
                  HOST_OWNS = 2'b10,
                  HOST_OWNS = 2'b10,
                  RISC_OWNS = 2'b11;
                  RISC_OWNS = 2'b11;
 
 
 
  parameter max_bus_hold = 5;    // Max number of cycles any bus master can hold the system bus
 
  parameter ram_wait_states = 0; // Number between 0 and 15
  //////////////////////////////////////////////////////////////////////////////
  //////////////////////////////////////////////////////////////////////////////
  //
  //
  // Local Wires and Registers
  // Local Wires and Registers
  //
  //
  wire       ram_ack;        //
  wire       ram_ack;        //
Line 1216... Line 1219...
  reg  [1:0] owner_ns;
  reg  [1:0] owner_ns;
 
 
  wire       host_timeout;
  wire       host_timeout;
  wire       risc_timeout;
  wire       risc_timeout;
 
 
  reg        wbm_ack_i;
  wire       ram_ack_dly;    // Delayed bus ack to simulate bus wait states
 
  reg  [3:0] ack_dly_cnt;    // Counter to delay bus ack to master modules
 
 
 
 
  //
  //
  always @(posedge host_clk or negedge rst)
  always @(posedge host_clk or negedge rst)
    if (!rst)
    if (!rst)
Line 1253... Line 1257...
            owner_ns = HOST_OWNS;
            owner_ns = HOST_OWNS;
        end
        end
      default : owner_ns = BUS_IDLE;
      default : owner_ns = BUS_IDLE;
    endcase
    endcase
 
 
/*
 
// Throw in some wait states from the memory
 
  always @(posedge mstr_test_clk)
 
    if (((vector % 5) == 0) && (xgate.risc.load_next_inst || xgate.risc.data_access))
 
//    if ((vector % 5) == 0)
 
      wbm_ack_i <= 1'b1;
 
    else
 
      wbm_ack_i <= 1'b1;
 
*/
 
 
 
 
  assign host_timeout = (owner_state == HOST_OWNS) && (host_cycle_cnt > max_bus_hold) && any_ack;
  assign host_timeout = (owner_state == HOST_OWNS) && (host_cycle_cnt > 5) && any_ack;
  assign risc_timeout = (owner_state == RISC_OWNS) && (risc_cycle_cnt > max_bus_hold) && any_ack;
  assign risc_timeout = (owner_state == RISC_OWNS) && (risc_cycle_cnt > 5) && any_ack;
 
 
 
  // Start counting cycles that the host has the bus, if the risc is also requesting the bus
  // Start counting cycles that the host has the bus, if the risc is also requesting the bus
  always @(posedge host_clk or negedge rst)
  always @(posedge host_clk or negedge rst)
    if (!rst)
    if (!rst)
      host_cycle_cnt <= 0;
      host_cycle_cnt <= 0;
Line 1304... Line 1298...
  // Address decoding for Testbench access to RAM
  // Address decoding for Testbench access to RAM
  assign ram_sel = sys_cyc && sys_stb && !(slv1_stb || slv2_stb) &&
  assign ram_sel = sys_cyc && sys_stb && !(slv1_stb || slv2_stb) &&
                   (sys_adr >= ram_base) &&
                   (sys_adr >= ram_base) &&
                   (sys_adr < (ram_base + ram_size));
                   (sys_adr < (ram_base + ram_size));
 
 
  assign ram_ack = ram_sel;
  // Throw in some wait states from the memory
 
  always @(posedge host_clk)
 
    if ((ack_dly_cnt == ram_wait_states) || !ram_sel)
 
      ack_dly_cnt <= 0;
 
    else if (ram_sel)
 
      ack_dly_cnt <= ack_dly_cnt + 1'b1;
 
 
 
  assign ram_ack_dly = (ack_dly_cnt == ram_wait_states);
 
  assign ram_ack = ram_sel && ram_ack_dly;
 
 
 
 
  // Create the System Read Data Bus from the Slave output data buses
  // Create the System Read Data Bus from the Slave output data buses
  assign sys_din = ({dwidth{slv1_stb}} & slv1_din) |
  assign sys_din = ({dwidth{slv1_stb}} & slv1_din) |
                   ({dwidth{slv2_stb}} & slv2_din) |
                   ({dwidth{slv2_stb}} & slv2_din) |

powered by: WebSVN 2.1.0

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