parent
dfa8bf490e
commit
53865371ce
|
@ -219,7 +219,7 @@ module tinyriscv_soc_top(
|
||||||
|
|
||||||
`ifdef VERILATOR
|
`ifdef VERILATOR
|
||||||
sim_jtag #(
|
sim_jtag #(
|
||||||
.TICK_DELAY(1),
|
.TICK_DELAY(10),
|
||||||
.PORT(9999)
|
.PORT(9999)
|
||||||
) u_sim_jtag (
|
) u_sim_jtag (
|
||||||
.clock ( clk ),
|
.clock ( clk ),
|
||||||
|
|
|
@ -21,6 +21,7 @@ riscv set_command_timeout_sec 2000
|
||||||
|
|
||||||
# prefer to use sba for system bus access
|
# prefer to use sba for system bus access
|
||||||
riscv set_prefer_sba on
|
riscv set_prefer_sba on
|
||||||
|
riscv set_enable_virt2phys off
|
||||||
|
|
||||||
# dump jtag chain
|
# dump jtag chain
|
||||||
scan_chain
|
scan_chain
|
||||||
|
|
|
@ -21,6 +21,7 @@ riscv set_command_timeout_sec 2000
|
||||||
|
|
||||||
# prefer to use sba for system bus access
|
# prefer to use sba for system bus access
|
||||||
riscv set_prefer_sba on
|
riscv set_prefer_sba on
|
||||||
|
riscv set_enable_virt2phys off
|
||||||
|
|
||||||
# dump jtag chain
|
# dump jtag chain
|
||||||
scan_chain
|
scan_chain
|
||||||
|
|
|
@ -1,21 +1,3 @@
|
||||||
// Copyright 2018 Robert Balas <balasr@student.ethz.ch>
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
|
|
||||||
// Top level wrapper for a verilator RI5CY testbench
|
|
||||||
// Contributor: Robert Balas <balasr@student.ethz.ch>
|
|
||||||
|
|
||||||
#include "svdpi.h"
|
#include "svdpi.h"
|
||||||
#include "Vtb_top_verilator__Dpi.h"
|
#include "Vtb_top_verilator__Dpi.h"
|
||||||
#include "Vtb_top_verilator.h"
|
#include "Vtb_top_verilator.h"
|
||||||
|
@ -30,7 +12,6 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
//void dump_memory();
|
|
||||||
double sc_time_stamp();
|
double sc_time_stamp();
|
||||||
|
|
||||||
static vluint64_t t = 0;
|
static vluint64_t t = 0;
|
||||||
|
@ -42,36 +23,35 @@ int main(int argc, char **argv, char **env)
|
||||||
Verilated::traceEverOn(true);
|
Verilated::traceEverOn(true);
|
||||||
top = new Vtb_top_verilator();
|
top = new Vtb_top_verilator();
|
||||||
|
|
||||||
//svSetScope(svGetScopeFromName(
|
|
||||||
// "TOP.tb_top_verilator.u_ram.ram"));
|
|
||||||
//Verilated::scopesDump();
|
|
||||||
|
|
||||||
#ifdef VCD_TRACE
|
#ifdef VCD_TRACE
|
||||||
VerilatedVcdC *tfp = new VerilatedVcdC;
|
VerilatedVcdC *tfp = new VerilatedVcdC;
|
||||||
top->trace(tfp, 99);
|
top->trace(tfp, 99);
|
||||||
tfp->open("verilator_tb.vcd");
|
tfp->open("verilator_tb.vcd");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
top->clk_i = 0;
|
top->clk_i = 0;
|
||||||
top->rst_ni = 0;
|
top->rst_ni = 0;
|
||||||
|
|
||||||
top->eval();
|
top->eval();
|
||||||
//dump_memory();
|
|
||||||
|
|
||||||
while (!Verilated::gotFinish()) {
|
while (!Verilated::gotFinish()) {
|
||||||
if (t > 40)
|
if (t > 40)
|
||||||
top->rst_ni = 1;
|
top->rst_ni = 1;
|
||||||
|
|
||||||
top->clk_i = !top->clk_i;
|
top->clk_i = !top->clk_i;
|
||||||
top->eval();
|
top->eval();
|
||||||
|
|
||||||
#ifdef VCD_TRACE
|
#ifdef VCD_TRACE
|
||||||
tfp->dump(t);
|
tfp->dump(t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
t += 5;
|
t += 5;
|
||||||
//if (t > 2000)
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VCD_TRACE
|
#ifdef VCD_TRACE
|
||||||
tfp->close();
|
tfp->close();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete top;
|
delete top;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
@ -80,28 +60,3 @@ double sc_time_stamp()
|
||||||
{
|
{
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void dump_memory()
|
|
||||||
{
|
|
||||||
errno = 0;
|
|
||||||
std::ofstream mem_file;
|
|
||||||
svLogicVecVal addr = {0};
|
|
||||||
|
|
||||||
mem_file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
|
|
||||||
try {
|
|
||||||
mem_file.open("memory_dump.bin");
|
|
||||||
for (size_t i = 0; i < 1048576; i++) {
|
|
||||||
addr.aval = i;
|
|
||||||
uint32_t val = read_byte(&addr);
|
|
||||||
mem_file << std::setfill('0') << std::setw(2) << std::hex << val
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
mem_file.close();
|
|
||||||
|
|
||||||
std::cout << "finished dumping memory" << std::endl;
|
|
||||||
|
|
||||||
} catch (std::ofstream::failure e) {
|
|
||||||
std::cerr << "exception opening/reading/closing file memory_dump.bin\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Reference in New Issue