mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-24 13:34:28 +00:00
Partially sd card read on fpga.
This commit is contained in:
parent
99070127d8
commit
db18aac9af
@ -40,7 +40,7 @@ vsim workopt -fsmdebug
|
||||
|
||||
#profile on
|
||||
|
||||
do wave.do
|
||||
do fpga-wave.do
|
||||
add log -r /*
|
||||
|
||||
-- Run the Simulation
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -337,7 +337,7 @@ module SDC
|
||||
.o_ERROR_CODE_Q(ErrorCode),
|
||||
.o_FATAL_ERROR(FatalError),
|
||||
.i_COUNT_IN_MAX(-8'd62),
|
||||
.LIMIT_SD_TIMERS(1'b1)); // *** must change this to 0 for real hardware.
|
||||
.LIMIT_SD_TIMERS(1'b0)); // *** must change this to 0 for real hardware.
|
||||
|
||||
|
||||
endmodule
|
||||
|
@ -28,81 +28,81 @@
|
||||
module sd_cmd_fsm
|
||||
(
|
||||
|
||||
input logic CLK, // HS
|
||||
input logic CLK, // HS
|
||||
//i_SLOWER_CLK : in std_logic;
|
||||
input logic i_RST, // reset FSM,
|
||||
input logic i_RST, // reset FSM,
|
||||
// MUST COME OUT OF RESET
|
||||
// SYNCHRONIZED TO THE 1.2 GHZ CLOCK!
|
||||
output logic o_TIMER_LOAD, o_TIMER_EN, // Timer
|
||||
output logic [18:0] o_TIMER_IN,
|
||||
input logic [18:0] i_TIMER_OUT,
|
||||
output logic o_COUNTER_LOAD, o_COUNTER_EN, // Counter
|
||||
output logic [7:0] o_COUNTER_IN,
|
||||
input logic [7:0] i_COUNTER_OUT,
|
||||
output logic o_SD_CLK_EN, // Clock Gaters
|
||||
input logic i_CLOCK_CHANGE_DONE, // Communication with CLK_FSM
|
||||
output logic o_START_CLOCK_CHANGE, // Communication with CLK_FSM
|
||||
output logic o_IC_RST, o_IC_EN, o_IC_UP_DOWN, // Instruction counter
|
||||
input logic [3:0] i_IC_OUT, // stop when you get to 10 because that is CMD17
|
||||
input logic [1:0] i_USES_DAT,
|
||||
input logic [6:0] i_OPCODE,
|
||||
input logic [2:0] i_R_TYPE,
|
||||
(* mark_debug = "true" *) output logic o_TIMER_LOAD, o_TIMER_EN, // Timer
|
||||
(* mark_debug = "true" *) output logic [18:0] o_TIMER_IN,
|
||||
(* mark_debug = "true" *) input logic [18:0] i_TIMER_OUT,
|
||||
(* mark_debug = "true" *) output logic o_COUNTER_LOAD, o_COUNTER_EN, // Counter
|
||||
(* mark_debug = "true" *) output logic [7:0] o_COUNTER_IN,
|
||||
(* mark_debug = "true" *) input logic [7:0] i_COUNTER_OUT,
|
||||
(* mark_debug = "true" *) output logic o_SD_CLK_EN, // Clock Gaters
|
||||
(* mark_debug = "true" *) input logic i_CLOCK_CHANGE_DONE, // Communication with CLK_FSM
|
||||
(* mark_debug = "true" *) output logic o_START_CLOCK_CHANGE, // Communication with CLK_FSM
|
||||
(* mark_debug = "true" *) output logic o_IC_RST, o_IC_EN, o_IC_UP_DOWN, // Instruction counter
|
||||
(* mark_debug = "true" *) input logic [3:0] i_IC_OUT, // stop when you get to 10 because that is CMD17
|
||||
(* mark_debug = "true" *) input logic [1:0] i_USES_DAT,
|
||||
(* mark_debug = "true" *) input logic [6:0] i_OPCODE,
|
||||
(* mark_debug = "true" *) input logic [2:0] i_R_TYPE,
|
||||
// bit masks
|
||||
input logic [31:0] i_NO_REDO_MASK,
|
||||
input logic [31:0] i_NO_REDO_ANS,
|
||||
input logic [31:0] i_NO_ERROR_MASK,
|
||||
input logic [31:0] i_NO_ERROR_ANS,
|
||||
output logic o_SD_CMD_OE, // Enable ouptut on tri-state SD_CMD line
|
||||
(* mark_debug = "true" *) input logic [31:0] i_NO_REDO_MASK,
|
||||
(* mark_debug = "true" *) input logic [31:0] i_NO_REDO_ANS,
|
||||
(* mark_debug = "true" *) input logic [31:0] i_NO_ERROR_MASK,
|
||||
(* mark_debug = "true" *) input logic [31:0] i_NO_ERROR_ANS,
|
||||
(* mark_debug = "true" *) output logic o_SD_CMD_OE, // Enable ouptut on tri-state SD_CMD line
|
||||
// TX Components
|
||||
output logic o_TX_PISO40_LOAD, o_TX_PISO40_EN, // Shift register for TX command head
|
||||
output logic o_TX_PISO8_LOAD, o_TX_PISO8_EN, // Shift register for TX command tail
|
||||
output logic o_TX_CRC7_PIPO_RST, o_TX_CRC7_PIPO_EN, // Parallel-to-Parallel CRC7 Generator
|
||||
output logic [1:0] o_TX_SOURCE_SELECT, // What gets sent to CMD_TX
|
||||
(* mark_debug = "true" *) output logic o_TX_PISO40_LOAD, o_TX_PISO40_EN, // Shift register for TX command head
|
||||
(* mark_debug = "true" *) output logic o_TX_PISO8_LOAD, o_TX_PISO8_EN, // Shift register for TX command tail
|
||||
(* mark_debug = "true" *) output logic o_TX_CRC7_PIPO_RST, o_TX_CRC7_PIPO_EN, // Parallel-to-Parallel CRC7 Generator
|
||||
(* mark_debug = "true" *) output logic [1:0] o_TX_SOURCE_SELECT, // What gets sent to CMD_TX
|
||||
// TX Memory
|
||||
output logic o_CMD_TX_IS_CMD55_RST,
|
||||
output logic o_CMD_TX_IS_CMD55_EN, // '1' means that the command that was just sent has index
|
||||
(* mark_debug = "true" *) output logic o_CMD_TX_IS_CMD55_RST,
|
||||
(* mark_debug = "true" *) output logic o_CMD_TX_IS_CMD55_EN, // '1' means that the command that was just sent has index
|
||||
// 55, so the subsequent command is to be
|
||||
// viewed as ACMD by the SD card.
|
||||
// RX Components
|
||||
input logic i_SD_CMD_RX, // serial response input on SD_CMD
|
||||
output logic o_RX_SIPO48_RST, o_RX_SIPO48_EN, // Shift Register for all 48 bits of Response
|
||||
(* mark_debug = "true" *) input logic i_SD_CMD_RX, // serial response input on SD_CMD
|
||||
(* mark_debug = "true" *) output logic o_RX_SIPO48_RST, o_RX_SIPO48_EN, // Shift Register for all 48 bits of Response
|
||||
|
||||
input logic [39:8] i_RESPONSE_CONTENT, // last 32 bits of RX_SIPO_40_OUT
|
||||
input logic [45:40] i_RESPONSE_INDEX, // 6 bits from RX_SIPO_40_OUT
|
||||
output logic o_RX_CRC7_SIPO_RST, o_RX_CRC7_SIPO_EN, // Serial-to-parallel CRC7 Generator
|
||||
input logic [6:0] i_RX_CRC7,
|
||||
(* mark_debug = "true" *) input logic [39:8] i_RESPONSE_CONTENT, // last 32 bits of RX_SIPO_40_OUT
|
||||
(* mark_debug = "true" *) input logic [45:40] i_RESPONSE_INDEX, // 6 bits from RX_SIPO_40_OUT
|
||||
(* mark_debug = "true" *) output logic o_RX_CRC7_SIPO_RST, o_RX_CRC7_SIPO_EN, // Serial-to-parallel CRC7 Generator
|
||||
(* mark_debug = "true" *) input logic [6:0] i_RX_CRC7,
|
||||
// RX Memory
|
||||
output logic o_RCA_REGISTER_RST, o_RCA_REGISTER_EN, // Relative Card Address
|
||||
(* mark_debug = "true" *) output logic o_RCA_REGISTER_RST, o_RCA_REGISTER_EN, // Relative Card Address
|
||||
// Communication to sd_dat_fsm
|
||||
output logic o_CMD_TX_DONE, // begin waiting for DAT_RX to complete
|
||||
input logic i_DAT_RX_DONE, // now go to next state since data block rx was completed
|
||||
input logic i_ERROR_CRC16, // repeat last command
|
||||
input logic i_ERROR_DAT_TIMES_OUT,
|
||||
(* mark_debug = "true" *) output logic o_CMD_TX_DONE, // begin waiting for DAT_RX to complete
|
||||
(* mark_debug = "true" *) input logic i_DAT_RX_DONE, // now go to next state since data block rx was completed
|
||||
(* mark_debug = "true" *) input logic i_ERROR_CRC16, // repeat last command
|
||||
(* mark_debug = "true" *) input logic i_ERROR_DAT_TIMES_OUT,
|
||||
// Commnuication to core
|
||||
output logic o_READY_FOR_READ, // tell core that I have completed initialization
|
||||
output logic o_SD_RESTARTING, // inform core the need to restart
|
||||
input logic i_READ_REQUEST, // core tells me to execute CMD17
|
||||
(* mark_debug = "true" *) output logic o_READY_FOR_READ, // tell core that I have completed initialization
|
||||
(* mark_debug = "true" *) output logic o_SD_RESTARTING, // inform core the need to restart
|
||||
(* mark_debug = "true" *) input logic i_READ_REQUEST, // core tells me to execute CMD17
|
||||
// Communication to Host
|
||||
output logic o_DAT_ERROR_FD_RST,
|
||||
output logic [2:0] o_ERROR_CODE_Q, // Indicates what caused the fatal error
|
||||
output logic o_FATAL_ERROR, // SD Card is damaged beyond recovery, restart entire initialization procedure of card
|
||||
input logic LIMIT_SD_TIMERS
|
||||
(* mark_debug = "true" *) output logic o_DAT_ERROR_FD_RST,
|
||||
(* mark_debug = "true" *) output logic [2:0] o_ERROR_CODE_Q, // Indicates what caused the fatal error
|
||||
(* mark_debug = "true" *) output logic o_FATAL_ERROR, // SD Card is damaged beyond recovery, restart entire initialization procedure of card
|
||||
(* mark_debug = "true" *) input logic LIMIT_SD_TIMERS
|
||||
);
|
||||
|
||||
|
||||
|
||||
(* mark_debug = "true" *) logic [4:0] w_next_state, r_curr_state;
|
||||
logic w_resend_last_command, w_rx_crc7_check, w_rx_index_check, w_rx_bad_crc7, w_rx_bad_index, w_rx_bad_reply, w_bad_card;
|
||||
(* mark_debug = "true" *) logic w_resend_last_command, w_rx_crc7_check, w_rx_index_check, w_rx_bad_crc7, w_rx_bad_index, w_rx_bad_reply, w_bad_card;
|
||||
|
||||
logic [31:0] w_redo_result, w_error_result;
|
||||
logic w_ACMD41_init_done;
|
||||
logic w_fail_cnt_en, w_fail_count_rst;
|
||||
logic [10:0] r_fail_count_out;
|
||||
(* mark_debug = "true" *) logic [31:0] w_redo_result, w_error_result;
|
||||
(* mark_debug = "true" *) logic w_ACMD41_init_done;
|
||||
(* mark_debug = "true" *) logic w_fail_cnt_en, w_fail_count_rst;
|
||||
(* mark_debug = "true" *) logic [10:0] r_fail_count_out;
|
||||
|
||||
logic w_ACMD41_busy_timer_START, w_ACMD41_times_out_FLAG, w_ACMD41_busy_timer_RST; //give up after 1000 ms of ACMD41
|
||||
logic [2:0] w_ERROR_CODE_D, r_ERROR_CODE_Q ; // Error Codes for fatal error on SD CMD FSM
|
||||
logic w_ERROR_CODE_RST, w_ERROR_CODE_EN;
|
||||
logic [18:0] Timer_In;
|
||||
(* mark_debug = "true" *) logic w_ACMD41_busy_timer_START, w_ACMD41_times_out_FLAG, w_ACMD41_busy_timer_RST; //give up after 1000 ms of ACMD41
|
||||
(* mark_debug = "true" *) logic [2:0] w_ERROR_CODE_D, r_ERROR_CODE_Q ; // Error Codes for fatal error on SD CMD FSM
|
||||
(* mark_debug = "true" *) logic w_ERROR_CODE_RST, w_ERROR_CODE_EN;
|
||||
(* mark_debug = "true" *) logic [18:0] Timer_In;
|
||||
|
||||
|
||||
localparam s_reset_clear_error_reg = 5'b00000;
|
||||
|
@ -31,11 +31,11 @@ module sd_top #(parameter g_COUNT_WIDTH = 8)
|
||||
input logic a_RST, // Reset signal (Must be held for minimum of 24 clock cycles)
|
||||
// a_RST MUST COME OUT OF RESET SYNCHRONIZED TO THE 1.2 GHZ CLOCK!
|
||||
// io_SD_CMD_z : inout std_logic; // SD CMD Bus
|
||||
input logic i_SD_CMD, // CMD Response from card
|
||||
output logic o_SD_CMD, // CMD Command from host
|
||||
output logic o_SD_CMD_OE, // Direction of SD_CMD
|
||||
input logic [3:0] i_SD_DAT, // SD DAT Bus
|
||||
output logic o_SD_CLK, // SD CLK Bus
|
||||
(* mark_debug = "true" *)input logic i_SD_CMD, // CMD Response from card
|
||||
(* mark_debug = "true" *)output logic o_SD_CMD, // CMD Command from host
|
||||
(* mark_debug = "true" *)output logic o_SD_CMD_OE, // Direction of SD_CMD
|
||||
(* mark_debug = "true" *)input logic [3:0] i_SD_DAT, // SD DAT Bus
|
||||
(* mark_debug = "true" *)output logic o_SD_CLK, // SD CLK Bus
|
||||
// For communication with core cpu
|
||||
input logic [32:9] i_BLOCK_ADDR, // see "Addressing" in parts.fods (only 8GB total capacity is used)
|
||||
output logic o_READY_FOR_READ, // tells core that initialization sequence is completed and
|
||||
@ -222,7 +222,7 @@ module sd_top #(parameter g_COUNT_WIDTH = 8)
|
||||
logic [15:0] r_RCA_Q2;
|
||||
|
||||
// Multiplexer Logics
|
||||
logic [132:0] w_instruction_control_bits;
|
||||
(* mark_debug = "true" *) logic [132:0] w_instruction_control_bits;
|
||||
logic [132:130] w_R_TYPE ;
|
||||
logic [129:128] w_USES_DAT ;
|
||||
logic [127:96] w_NO_REDO_MASK ;
|
||||
@ -255,7 +255,7 @@ module sd_top #(parameter g_COUNT_WIDTH = 8)
|
||||
|
||||
// Tri state IO Driver BC18MIMS
|
||||
logic w_SD_CMD_TX_Q; // Write Data
|
||||
logic w_SD_CMD_RX; // Read Data
|
||||
(* mark_debug = "true" *) logic w_SD_CMD_RX; // Read Data
|
||||
|
||||
|
||||
// CLOCKS
|
||||
|
@ -1,41 +0,0 @@
|
||||
///////////////////////////////////////////
|
||||
// ila_0.sv
|
||||
//
|
||||
// Written: Ross Thompson September 26, 2021
|
||||
// Modified:
|
||||
//
|
||||
// Purpose: stub for simulation. does nothing.
|
||||
//
|
||||
// A component of the Wally configurable RISC-V project.
|
||||
//
|
||||
// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
|
||||
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
|
||||
// is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
///////////////////////////////////////////
|
||||
|
||||
|
||||
`include "wally-config.vh"
|
||||
|
||||
module ila_0
|
||||
(input logic clk,
|
||||
input logic [`XLEN-1:0] probe0,
|
||||
input logic [`XLEN-1:0] probe1,
|
||||
input logic [`XLEN-1:0] probe2,
|
||||
input logic [`XLEN-1:0] probe3,
|
||||
input logic probe4,
|
||||
input logic [1:0] probe5,
|
||||
input logic [31:0] probe6
|
||||
);
|
||||
endmodule; // ila_0
|
||||
|
||||
|
@ -50,13 +50,15 @@ module wallypipelinedsoc (
|
||||
output logic HMASTLOCK,
|
||||
output logic HREADY,
|
||||
// I/O Interface
|
||||
input logic [31:0] GPIOPinsIn,
|
||||
output logic [31:0] GPIOPinsOut, GPIOPinsEn,
|
||||
input logic UARTSin,
|
||||
output logic UARTSout,
|
||||
output tri1 SDCCmd,
|
||||
input logic [3:0] SDCDat,
|
||||
output logic SDCCLK
|
||||
input logic [31:0] GPIOPinsIn,
|
||||
output logic [31:0] GPIOPinsOut, GPIOPinsEn,
|
||||
input logic UARTSin,
|
||||
output logic UARTSout,
|
||||
input logic SDCCmdIn,
|
||||
output logic SDCCmdOut,
|
||||
output logic SDCCmdOE,
|
||||
input logic [3:0] SDCDatIn,
|
||||
output logic SDCCLK
|
||||
);
|
||||
|
||||
// to instruction memory *** remove later
|
||||
@ -77,14 +79,17 @@ module wallypipelinedsoc (
|
||||
logic [31:0] InstrF;
|
||||
logic HRESP;
|
||||
|
||||
/* -----\/----- EXCLUDED -----\/-----
|
||||
logic SDCCmdOut;
|
||||
logic SDCCmdOE;
|
||||
logic SDCCmdIn;
|
||||
logic [3:0] SDCDatIn;
|
||||
-----/\----- EXCLUDED -----/\----- */
|
||||
// logic [3:0] SDCDatIn;
|
||||
|
||||
assign SDCCmd = SDCCmdOE ? SDCCmdOut : 1'bz;
|
||||
assign SDCCmdIn = SDCCmd;
|
||||
assign SDCDatIn = SDCDat; // when write supported this will be a tristate
|
||||
// it turn out vivado cannot infer these at this level of the hierarchy.
|
||||
//assign SDCCmd = SDCCmdOE ? SDCCmdOut : 1'bz;
|
||||
//assign SDCCmdIn = SDCCmd;
|
||||
//assign SDCDatIn = SDCDat; // when write supported this will be a tristate
|
||||
|
||||
// instantiate processor and memories
|
||||
wallypipelinedhart hart(.*);
|
||||
|
@ -55,9 +55,11 @@ module wallypipelinedsocwrapper (
|
||||
input UARTSin,
|
||||
output UARTSout,
|
||||
input ddr4_calib_complete,
|
||||
input [3:0] SDCDat,
|
||||
input [3:0] SDCDatIn,
|
||||
output SDCCLK,
|
||||
inout SDCCmd
|
||||
input SDCCmdIn,
|
||||
output SDCCmdOut,
|
||||
output SDCCmdOE
|
||||
);
|
||||
|
||||
wire [31:0] GPIOPinsEn;
|
||||
@ -109,8 +111,10 @@ module wallypipelinedsocwrapper (
|
||||
.GPIOPinsEn(GPIOPinsEn),
|
||||
.UARTSin(UARTSin),
|
||||
.UARTSout(UARTSout),
|
||||
.SDCDat(SDCDat),
|
||||
.SDCDatIn(SDCDatIn),
|
||||
.SDCCLK(SDCCLK),
|
||||
.SDCCmd(SDCCmd));
|
||||
.SDCCmdIn(SDCCmdIn),
|
||||
.SDCCmdOut(SDCCmdOut),
|
||||
.SDCCmdOE(SDCCmdOE));
|
||||
|
||||
endmodule
|
||||
|
@ -519,12 +519,12 @@ string tests32f[] = '{
|
||||
|
||||
logic DCacheFlushDone, DCacheFlushStart;
|
||||
|
||||
flopenr #(`XLEN) PCWReg(clk, reset, ~dut.hart.ieu.dp.StallW, dut.hart.ifu.PCM, PCW);
|
||||
flopenr #(32) InstrWReg(clk, reset, ~dut.hart.ieu.dp.StallW, dut.hart.ifu.InstrM, InstrW);
|
||||
flopenr #(`XLEN) PCWReg(clk, reset, ~dut.wallypipelinedsoc.hart.ieu.dp.StallW, dut.wallypipelinedsoc.hart.ifu.PCM, PCW);
|
||||
flopenr #(32) InstrWReg(clk, reset, ~dut.wallypipelinedsoc.hart.ieu.dp.StallW, dut.wallypipelinedsoc.hart.ifu.InstrM, InstrW);
|
||||
|
||||
// check assertions for a legal configuration
|
||||
riscvassertions riscvassertions();
|
||||
logging logging(clk, reset, dut.uncore.HADDR, dut.uncore.HTRANS);
|
||||
logging logging(clk, reset, dut.wallypipelinedsoc.uncore.HADDR, dut.wallypipelinedsoc.uncore.HTRANS);
|
||||
|
||||
// pick tests based on modes supported
|
||||
initial begin
|
||||
@ -568,8 +568,11 @@ string tests32f[] = '{
|
||||
|
||||
string signame, memfilename, romfilename, sdcfilename;
|
||||
|
||||
logic [31:0] GPIOPinsIn, GPIOPinsOut, GPIOPinsEn;
|
||||
logic [3:0] GPIOPinsIn_IO;
|
||||
logic [4:0] GPIOPinsOut_IO;
|
||||
logic UARTSin, UARTSout;
|
||||
logic ddr4_calib_complete;
|
||||
|
||||
|
||||
logic SDCCLK;
|
||||
tri1 SDCCmd;
|
||||
@ -594,10 +597,10 @@ string tests32f[] = '{
|
||||
wallypipelinedsocwrapper dut(.*);
|
||||
|
||||
// Track names of instructions
|
||||
instrTrackerTB it(clk, reset, dut.hart.ieu.dp.FlushE,
|
||||
dut.hart.ifu.icache.FinalInstrRawF,
|
||||
dut.hart.ifu.InstrD, dut.hart.ifu.InstrE,
|
||||
dut.hart.ifu.InstrM, dut.hart.ifu.InstrW,
|
||||
instrTrackerTB it(clk, reset, dut.wallypipelinedsoc.hart.ieu.dp.FlushE,
|
||||
dut.wallypipelinedsoc.hart.ifu.icache.FinalInstrRawF,
|
||||
dut.wallypipelinedsoc.hart.ifu.InstrD, dut.wallypipelinedsoc.hart.ifu.InstrE,
|
||||
dut.wallypipelinedsoc.hart.ifu.InstrM, dut.wallypipelinedsoc.hart.ifu.InstrW,
|
||||
InstrFName, InstrDName, InstrEName, InstrMName, InstrWName);
|
||||
|
||||
// initialize tests
|
||||
@ -630,7 +633,7 @@ string tests32f[] = '{
|
||||
romfilename = {"../../imperas-riscv-tests/work/rv64BP/fpga-test-sdc.memfile"};
|
||||
sdcfilename = {"../src/sdc/tb/ramdisk2.hex"};
|
||||
$readmemh(memfilename, dtim.RAM);
|
||||
$readmemh(romfilename, dut.uncore.bootdtim.bootdtim.RAM);
|
||||
$readmemh(romfilename, dut.wallypipelinedsoc.uncore.bootdtim.bootdtim.RAM);
|
||||
$readmemh(sdcfilename, sdcard.FLASHmem);
|
||||
ProgramAddrMapFile = {"../../imperas-riscv-tests/work/rv64BP/fpga-test-sdc.objdump.addr"};
|
||||
ProgramLabelMapFile = {"../../imperas-riscv-tests/work/rv64BP/fpga-test-sdc.objdump.lab"};
|
||||
@ -648,11 +651,11 @@ string tests32f[] = '{
|
||||
always @(negedge clk)
|
||||
begin
|
||||
/* -----\/----- EXCLUDED -----\/-----
|
||||
if (dut.hart.priv.EcallFaultM &&
|
||||
(dut.hart.ieu.dp.regf.rf[3] == 1 ||
|
||||
(dut.hart.ieu.dp.regf.we3 &&
|
||||
dut.hart.ieu.dp.regf.a3 == 3 &&
|
||||
dut.hart.ieu.dp.regf.wd3 == 1))) begin
|
||||
if (dut.wallypipelinedsoc.hart.priv.EcallFaultM &&
|
||||
(dut.wallypipelinedsoc.hart.ieu.dp.regf.rf[3] == 1 ||
|
||||
(dut.wallypipelinedsoc.hart.ieu.dp.regf.we3 &&
|
||||
dut.wallypipelinedsoc.hart.ieu.dp.regf.a3 == 3 &&
|
||||
dut.wallypipelinedsoc.hart.ieu.dp.regf.wd3 == 1))) begin
|
||||
-----/\----- EXCLUDED -----/\----- */
|
||||
if (DCacheFlushDone) begin
|
||||
//$display("Code ended with ecall with gp = 1");
|
||||
@ -729,18 +732,20 @@ string tests32f[] = '{
|
||||
end // always @ (negedge clk)
|
||||
|
||||
// track the current function or global label
|
||||
/* -----\/----- EXCLUDED -----\/-----
|
||||
if (DEBUG == 1) begin : FunctionName
|
||||
FunctionName FunctionName(.reset(reset),
|
||||
.clk(clk),
|
||||
.ProgramAddrMapFile(ProgramAddrMapFile),
|
||||
.ProgramLabelMapFile(ProgramLabelMapFile));
|
||||
end
|
||||
-----/\----- EXCLUDED -----/\----- */
|
||||
|
||||
assign DCacheFlushStart = dut.hart.priv.EcallFaultM &&
|
||||
(dut.hart.ieu.dp.regf.rf[3] == 1 ||
|
||||
(dut.hart.ieu.dp.regf.we3 &&
|
||||
dut.hart.ieu.dp.regf.a3 == 3 &&
|
||||
dut.hart.ieu.dp.regf.wd3 == 1));
|
||||
assign DCacheFlushStart = dut.wallypipelinedsoc.hart.priv.EcallFaultM &&
|
||||
(dut.wallypipelinedsoc.hart.ieu.dp.regf.rf[3] == 1 ||
|
||||
(dut.wallypipelinedsoc.hart.ieu.dp.regf.we3 &&
|
||||
dut.wallypipelinedsoc.hart.ieu.dp.regf.a3 == 3 &&
|
||||
dut.wallypipelinedsoc.hart.ieu.dp.regf.wd3 == 1));
|
||||
|
||||
DCacheFlushFSM DCacheFlushFSM(.clk(clk),
|
||||
.reset(reset),
|
||||
@ -753,8 +758,8 @@ string tests32f[] = '{
|
||||
if (`BPRED_ENABLED == 1) begin : bpred
|
||||
|
||||
initial begin
|
||||
$readmemb(`TWO_BIT_PRELOAD, dut.hart.ifu.bpred.bpred.Predictor.DirPredictor.PHT.memory);
|
||||
$readmemb(`BTB_PRELOAD, dut.hart.ifu.bpred.bpred.TargetPredictor.memory.memory);
|
||||
$readmemb(`TWO_BIT_PRELOAD, dut.wallypipelinedsoc.hart.ifu.bpred.bpred.Predictor.DirPredictor.PHT.memory);
|
||||
$readmemb(`BTB_PRELOAD, dut.wallypipelinedsoc.hart.ifu.bpred.bpred.TargetPredictor.memory.memory);
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
@ -794,10 +799,10 @@ module DCacheFlushFSM
|
||||
input logic start,
|
||||
output logic done);
|
||||
|
||||
localparam integer numlines = testbench.dut.hart.lsu.dcache.NUMLINES;
|
||||
localparam integer numways = testbench.dut.hart.lsu.dcache.NUMWAYS;
|
||||
localparam integer blockbytelen = testbench.dut.hart.lsu.dcache.BLOCKBYTELEN;
|
||||
localparam integer numwords = testbench.dut.hart.lsu.dcache.BLOCKLEN/`XLEN;
|
||||
localparam integer numlines = testbench.dut.wallypipelinedsoc.hart.lsu.dcache.NUMLINES;
|
||||
localparam integer numways = testbench.dut.wallypipelinedsoc.hart.lsu.dcache.NUMWAYS;
|
||||
localparam integer blockbytelen = testbench.dut.wallypipelinedsoc.hart.lsu.dcache.BLOCKBYTELEN;
|
||||
localparam integer numwords = testbench.dut.wallypipelinedsoc.hart.lsu.dcache.BLOCKLEN/`XLEN;
|
||||
localparam integer lognumlines = $clog2(numlines);
|
||||
localparam integer logblockbytelen = $clog2(blockbytelen);
|
||||
localparam integer lognumways = $clog2(numways);
|
||||
@ -823,10 +828,10 @@ module DCacheFlushFSM
|
||||
.logblockbytelen(logblockbytelen))
|
||||
copyShadow(.clk,
|
||||
.start,
|
||||
.tag(testbench.dut.hart.lsu.dcache.MemWay[way].CacheTagMem.StoredData[index]),
|
||||
.valid(testbench.dut.hart.lsu.dcache.MemWay[way].ValidBits[index]),
|
||||
.dirty(testbench.dut.hart.lsu.dcache.MemWay[way].DirtyBits[index]),
|
||||
.data(testbench.dut.hart.lsu.dcache.MemWay[way].word[cacheWord].CacheDataMem.StoredData[index]),
|
||||
.tag(testbench.dut.wallypipelinedsoc.hart.lsu.dcache.MemWay[way].CacheTagMem.StoredData[index]),
|
||||
.valid(testbench.dut.wallypipelinedsoc.hart.lsu.dcache.MemWay[way].ValidBits[index]),
|
||||
.dirty(testbench.dut.wallypipelinedsoc.hart.lsu.dcache.MemWay[way].DirtyBits[index]),
|
||||
.data(testbench.dut.wallypipelinedsoc.hart.lsu.dcache.MemWay[way].word[cacheWord].CacheDataMem.StoredData[index]),
|
||||
.index(index),
|
||||
.cacheWord(cacheWord),
|
||||
.CacheData(CacheData[way][index][cacheWord]),
|
||||
|
Loading…
Reference in New Issue
Block a user