Fix groundtest without HTIF
This commit is contained in:
2
chisel2
2
chisel2
Submodule chisel2 updated: e9e5bb28ac...257bd9732c
2
chisel3
2
chisel3
Submodule chisel3 updated: 70a41e5aed...2e9b41cafe
@ -25,6 +25,7 @@
|
|||||||
#include "emulator_type.h"
|
#include "emulator_type.h"
|
||||||
|
|
||||||
static dtm_t* dtm;
|
static dtm_t* dtm;
|
||||||
|
static uint64_t trace_count = 0;
|
||||||
bool verbose;
|
bool verbose;
|
||||||
|
|
||||||
void handle_sigterm(int sig)
|
void handle_sigterm(int sig)
|
||||||
@ -32,11 +33,15 @@ void handle_sigterm(int sig)
|
|||||||
dtm->stop();
|
dtm->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double sc_time_stamp()
|
||||||
|
{
|
||||||
|
return trace_count;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
unsigned random_seed = (unsigned)time(NULL) ^ (unsigned)getpid();
|
unsigned random_seed = (unsigned)time(NULL) ^ (unsigned)getpid();
|
||||||
uint64_t max_cycles = -1;
|
uint64_t max_cycles = -1;
|
||||||
uint64_t trace_count = 0;
|
|
||||||
uint64_t start = 0;
|
uint64_t start = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const char* vcd = NULL;
|
const char* vcd = NULL;
|
||||||
@ -179,7 +184,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
#include TBFRAG
|
#include TBFRAG
|
||||||
|
|
||||||
while (!dtm->done() && (trace_count >> 1) < max_cycles && ret == 0)
|
while (!dtm->done() && trace_count < max_cycles && ret == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < N_MEM_CHANNELS; i++) {
|
for (int i = 0; i < N_MEM_CHANNELS; i++) {
|
||||||
value(mem_ar_ready[i]) = mm[i]->ar_ready();
|
value(mem_ar_ready[i]) = mm[i]->ar_ready();
|
||||||
@ -212,13 +217,12 @@ int main(int argc, char** argv)
|
|||||||
tile.eval();
|
tile.eval();
|
||||||
// make sure we dump on cycle 0 to get dump_init
|
// make sure we dump on cycle 0 to get dump_init
|
||||||
#if VM_TRACE
|
#if VM_TRACE
|
||||||
if (tfp && ((trace_count >> 1) == 0 || (trace_count >> 1) >= start))
|
if (tfp && (trace_count == 0 || trace_count >= start))
|
||||||
tfp->dump(trace_count);
|
tfp->dump(trace_count * 2);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
trace_count++;
|
|
||||||
} catch (std::runtime_error& e) {
|
} catch (std::runtime_error& e) {
|
||||||
max_cycles = trace_count >> 1; // terminate cleanly after this cycle
|
max_cycles = trace_count; // terminate cleanly after this cycle
|
||||||
ret = 1;
|
ret = 1;
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
@ -258,20 +262,20 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef VERILATOR
|
#ifndef VERILATOR
|
||||||
if (verbose && (trace_count >> 1) >= start)
|
if (verbose && trace_count >= start)
|
||||||
tile.print(stderr);
|
tile.print(stderr);
|
||||||
|
|
||||||
// make sure we dump on cycle 0 to get dump_init
|
// make sure we dump on cycle 0 to get dump_init
|
||||||
if (vcd && ((trace_count >> 1) == 0 || (trace_count >> 1) >= start))
|
if (vcd && (trace_count == 0 || trace_count >= start))
|
||||||
tile.dump(vcdfile, trace_count >> 1);
|
tile.dump(vcdfile, trace_count);
|
||||||
|
|
||||||
tile.clock_hi(LIT<1>(0));
|
tile.clock_hi(LIT<1>(0));
|
||||||
#else
|
#else
|
||||||
tile.clk = 1;
|
tile.clk = 1;
|
||||||
tile.eval();
|
tile.eval();
|
||||||
#if VM_TRACE
|
#if VM_TRACE
|
||||||
if (tfp && ((trace_count >> 1) == 0 || (trace_count >> 1) >= start))
|
if (tfp && (trace_count == 0 || trace_count >= start))
|
||||||
tfp->dump(trace_count);
|
tfp->dump(trace_count * 2 + 1);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
trace_count++;
|
trace_count++;
|
||||||
@ -288,17 +292,17 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (dtm->exit_code())
|
if (dtm->exit_code())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "*** FAILED *** (code = %d, seed %d) after %ld cycles\n", dtm->exit_code(), random_seed, trace_count >> 1);
|
fprintf(stderr, "*** FAILED *** (code = %d, seed %d) after %ld cycles\n", dtm->exit_code(), random_seed, trace_count);
|
||||||
ret = dtm->exit_code();
|
ret = dtm->exit_code();
|
||||||
}
|
}
|
||||||
else if ((trace_count >> 1) == max_cycles)
|
else if (trace_count == max_cycles)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "*** FAILED *** (timeout, seed %d) after %ld cycles\n", random_seed, trace_count >> 1);
|
fprintf(stderr, "*** FAILED *** (timeout, seed %d) after %ld cycles\n", random_seed, trace_count);
|
||||||
ret = 2;
|
ret = 2;
|
||||||
}
|
}
|
||||||
else if (verbose || print_cycles)
|
else if (verbose || print_cycles)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Completed after %ld cycles\n", trace_count >> 1);
|
fprintf(stderr, "Completed after %ld cycles\n", trace_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dtm;
|
delete dtm;
|
||||||
|
2
firrtl
2
firrtl
Submodule firrtl updated: 860b04eff7...85dc973ecc
Submodule groundtest updated: 45fd2af56b...e636d7a4ff
@ -36,8 +36,7 @@ class WithGroundTest extends Config(
|
|||||||
(r: Bool, p: Parameters) =>
|
(r: Bool, p: Parameters) =>
|
||||||
Module(new GroundTestTile(i, r)(p.alterPartial({
|
Module(new GroundTestTile(i, r)(p.alterPartial({
|
||||||
case TLId => "L1toL2"
|
case TLId => "L1toL2"
|
||||||
case NUncachedTileLinkPorts =>
|
case NUncachedTileLinkPorts => p(GroundTestUncachedClients)
|
||||||
(if (i == 0) 1 else 0) + p(GroundTestUncachedClients)
|
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +75,7 @@ class WithComparator extends Config(
|
|||||||
Seq((r: Bool, p: Parameters) => Module(new ComparatorTile(r)(
|
Seq((r: Bool, p: Parameters) => Module(new ComparatorTile(r)(
|
||||||
p.alterPartial({
|
p.alterPartial({
|
||||||
case TLId => "L1toL2"
|
case TLId => "L1toL2"
|
||||||
case NUncachedTileLinkPorts => 1 + site(ComparatorKey).targets.size
|
case NUncachedTileLinkPorts => site(ComparatorKey).targets.size
|
||||||
}))))
|
}))))
|
||||||
}
|
}
|
||||||
case ComparatorKey => ComparatorParameters(
|
case ComparatorKey => ComparatorParameters(
|
||||||
|
Reference in New Issue
Block a user