mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
adding issue_top testbench
This commit is contained in:
parent
1b9f0a998b
commit
068ec6c5ef
4 changed files with 211 additions and 1 deletions
132
hw/rtl/core/VX_issue_top.sv
Normal file
132
hw/rtl/core/VX_issue_top.sv
Normal file
|
@ -0,0 +1,132 @@
|
|||
// Copyright © 2019-2023
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
`include "VX_define.vh"
|
||||
|
||||
module VX_issue_top import VX_gpu_pkg::*; #(
|
||||
parameter `STRING INSTANCE_ID = "issue"
|
||||
) (
|
||||
// Clock
|
||||
input wire clk,
|
||||
input wire reset,
|
||||
|
||||
input wire decode_valid,
|
||||
input wire [`UUID_WIDTH-1:0] decode_uuid,
|
||||
input wire [`NW_WIDTH-1:0] decode_wid,
|
||||
input wire [`NUM_THREADS-1:0] decode_tmask,
|
||||
input wire [`PC_BITS-1:0] decode_PC,
|
||||
input wire [`EX_BITS-1:0] decode_ex_type,
|
||||
input wire [`INST_OP_BITS-1:0] decode_op_type,
|
||||
input op_args_t decode_op_args,
|
||||
input wire decode_wb,
|
||||
input wire [`NR_BITS-1:0] decode_rd,
|
||||
input wire [`NR_BITS-1:0] decode_rs1,
|
||||
input wire [`NR_BITS-1:0] decode_rs2,
|
||||
input wire [`NR_BITS-1:0] decode_rs3,
|
||||
output wire decode_ready,
|
||||
|
||||
input wire writeback_valid[`ISSUE_WIDTH],
|
||||
input wire [`UUID_WIDTH-1:0] writeback_uuid[`ISSUE_WIDTH],
|
||||
input wire [ISSUE_WIS_W-1:0] writeback_wis[`ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0] writeback_tmask[`ISSUE_WIDTH],
|
||||
input wire [`PC_BITS-1:0] writeback_PC[`ISSUE_WIDTH],
|
||||
input wire [`NR_BITS-1:0] writeback_rd[`ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0][`XLEN-1:0] writeback_data[`ISSUE_WIDTH],
|
||||
input wire writeback_sop[`ISSUE_WIDTH],
|
||||
input wire writeback_eop[`ISSUE_WIDTH],
|
||||
|
||||
input wire dispatch_valid[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`UUID_WIDTH-1:0] dispatch_uuid[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [ISSUE_WIS_W-1:0] dispatch_wis[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0] dispatch_tmask[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`PC_BITS-1:0] dispatch_PC[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`INST_ALU_BITS-1:0] dispatch_op_type[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input op_args_t dispatch_op_args[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire dispatch_wb[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NR_BITS-1:0] dispatch_rd[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NT_WIDTH-1:0] dispatch_tid[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0][`XLEN-1:0] dispatch_rs1_data[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0][`XLEN-1:0] dispatch_rs2_data[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
input wire [`NUM_THREADS-1:0][`XLEN-1:0] dispatch_rs3_data[`NUM_EX_UNITS * `ISSUE_WIDTH],
|
||||
output wire dispatch_ready[`NUM_EX_UNITS * `ISSUE_WIDTH]
|
||||
);
|
||||
|
||||
VX_decode_if decode_if();
|
||||
VX_dispatch_if dispatch_if[`NUM_EX_UNITS * `ISSUE_WIDTH]();
|
||||
VX_writeback_if writeback_if[`ISSUE_WIDTH]();
|
||||
|
||||
assign decode_if.valid = decode_valid;
|
||||
assign decode_if.data.uuid = decode_uuid;
|
||||
assign decode_if.data.wid = decode_wid;
|
||||
assign decode_if.data.tmask = decode_tmask;
|
||||
assign decode_if.data.PC = decode_PC;
|
||||
assign decode_if.data.ex_type = decode_ex_type;
|
||||
assign decode_if.data.op_type = decode_op_type;
|
||||
assign decode_if.data.op_args = decode_op_args;
|
||||
assign decode_if.data.wb = decode_wb;
|
||||
assign decode_if.data.rd = decode_rd;
|
||||
assign decode_if.data.rs1 = decode_rs1;
|
||||
assign decode_if.data.rs2 = decode_rs2;
|
||||
assign decode_if.data.rs3 = decode_rs3;
|
||||
assign decode_ready = decode_if.ready;
|
||||
|
||||
for (genvar i = 0; i < `ISSUE_WIDTH; ++i) begin
|
||||
assign writeback_if[i].valid = writeback_valid[i];
|
||||
assign writeback_if[i].data.uuid = writeback_uuid[i];
|
||||
assign writeback_if[i].data.wis = writeback_wis[i];
|
||||
assign writeback_if[i].data.tmask = writeback_tmask[i];
|
||||
assign writeback_if[i].data.PC = writeback_PC[i];
|
||||
assign writeback_if[i].data.rd = writeback_rd[i];
|
||||
assign writeback_if[i].data.data = writeback_data[i];
|
||||
assign writeback_if[i].data.sop = writeback_sop[i];
|
||||
assign writeback_if[i].data.eop = writeback_eop[i];
|
||||
end
|
||||
|
||||
for (genvar i = 0; i < `NUM_EX_UNITS * `ISSUE_WIDTH; ++i) begin
|
||||
assign dispatch_if[i].valid = dispatch_valid[i];
|
||||
assign dispatch_if[i].data.uuid = dispatch_uuid[i];
|
||||
assign dispatch_if[i].data.wis = dispatch_wis[i];
|
||||
assign dispatch_if[i].data.tmask = dispatch_tmask[i];
|
||||
assign dispatch_if[i].data.PC = dispatch_PC[i];
|
||||
assign dispatch_if[i].data.op_type = dispatch_op_type[i];
|
||||
assign dispatch_if[i].data.op_args = dispatch_op_args[i];
|
||||
assign dispatch_if[i].data.wb = dispatch_wb[i];
|
||||
assign dispatch_if[i].data.rd = dispatch_rd[i];
|
||||
assign dispatch_if[i].data.tid = dispatch_tid[i];
|
||||
assign dispatch_if[i].data.rs1_data = dispatch_rs1_data[i];
|
||||
assign dispatch_if[i].data.rs2_data = dispatch_rs2_data[i];
|
||||
assign dispatch_if[i].data.rs3_data = dispatch_rs3_data[i];
|
||||
assign dispatch_ready[i] = dispatch_if[i].ready;
|
||||
end
|
||||
|
||||
`ifdef PERF_ENABLE
|
||||
issue_perf_t issue_perf = '0;
|
||||
`endif
|
||||
|
||||
VX_issue #(
|
||||
.INSTANCE_ID (INSTANCE_ID)
|
||||
) issue (
|
||||
`SCOPE_IO_BIND (0)
|
||||
.clk (clk),
|
||||
.reset (reset),
|
||||
|
||||
`ifdef PERF_ENABLE
|
||||
.issue_perf (issue_perf),
|
||||
`endif
|
||||
|
||||
.decode_if (decode_if),
|
||||
.writeback_if (writeback_if),
|
||||
.dispatch_if (dispatch_if)
|
||||
);
|
||||
|
||||
endmodule
|
|
@ -4,6 +4,7 @@ all:
|
|||
$(MAKE) -C mem_streamer
|
||||
$(MAKE) -C cache_top
|
||||
$(MAKE) -C core_top
|
||||
$(MAKE) -C issue_top
|
||||
|
||||
run:
|
||||
$(MAKE) -C cache run
|
||||
|
@ -11,10 +12,12 @@ run:
|
|||
$(MAKE) -C mem_streamer run
|
||||
$(MAKE) -C cache_top run
|
||||
$(MAKE) -C core_top run
|
||||
$(MAKE) -C issue_top run
|
||||
|
||||
clean:
|
||||
$(MAKE) -C cache clean
|
||||
$(MAKE) -C generic_queue clean
|
||||
$(MAKE) -C mem_streamer clean
|
||||
$(MAKE) -C cache_top clean
|
||||
$(MAKE) -C core_top clean
|
||||
$(MAKE) -C core_top clean
|
||||
$(MAKE) -C issue_top clean
|
26
hw/unittest/issue_top/Makefile
Normal file
26
hw/unittest/issue_top/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
|||
ROOT_DIR := $(realpath ../../..)
|
||||
include $(ROOT_DIR)/config.mk
|
||||
|
||||
PROJECT := issue_top
|
||||
|
||||
RTL_DIR := $(VORTEX_HOME)/hw/rtl
|
||||
DPI_DIR := $(VORTEX_HOME)/hw/dpi
|
||||
|
||||
SRC_DIR := $(VORTEX_HOME)/hw/unittest/$(PROJECT)
|
||||
|
||||
CXXFLAGS := -I$(SRC_DIR) -I$(VORTEX_HOME)/hw/unittest/common -I$(VORTEX_HOME)/sim/common
|
||||
CXXFLAGS += -I$(ROOT_DIR)/hw
|
||||
|
||||
SRCS := $(DPI_DIR)/util_dpi.cpp
|
||||
SRCS += $(SRC_DIR)/main.cpp
|
||||
|
||||
DBG_TRACE_FLAGS := -DDBG_TRACE_CACHE
|
||||
|
||||
RTL_PKGS := $(RTL_DIR)/VX_gpu_pkg.sv $(RTL_DIR)/core/VX_trace_pkg.sv
|
||||
|
||||
RTL_INCLUDE := -I$(RTL_DIR) -I$(DPI_DIR) -I$(RTL_DIR)/libs
|
||||
RTL_INCLUDE += -I$(RTL_DIR)/interfaces -I$(RTL_DIR)/mem -I$(RTL_DIR)/core
|
||||
|
||||
TOP := VX_issue_top
|
||||
|
||||
include ../common.mk
|
49
hw/unittest/issue_top/main.cpp
Normal file
49
hw/unittest/issue_top/main.cpp
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright © 2019-2023
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "vl_simulator.h"
|
||||
|
||||
#ifndef TRACE_START_TIME
|
||||
#define TRACE_START_TIME 0ull
|
||||
#endif
|
||||
|
||||
#ifndef TRACE_STOP_TIME
|
||||
#define TRACE_STOP_TIME -1ull
|
||||
#endif
|
||||
|
||||
static uint64_t timestamp = 0;
|
||||
static bool trace_enabled = false;
|
||||
static uint64_t trace_start_time = TRACE_START_TIME;
|
||||
static uint64_t trace_stop_time = TRACE_STOP_TIME;
|
||||
|
||||
double sc_time_stamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
bool sim_trace_enabled() {
|
||||
if (timestamp >= trace_start_time
|
||||
&& timestamp < trace_stop_time)
|
||||
return true;
|
||||
return trace_enabled;
|
||||
}
|
||||
|
||||
void sim_trace_enable(bool enable) {
|
||||
trace_enabled = enable;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// Initialize Verilators variables
|
||||
Verilated::commandArgs(argc, argv);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue