put test harness on the heap in emulator
This commit is contained in:
		| @@ -64,14 +64,14 @@ int main(int argc, char** argv) | |||||||
|   srand48(random_seed); |   srand48(random_seed); | ||||||
|  |  | ||||||
|   Verilated::randReset(2); |   Verilated::randReset(2); | ||||||
|   VTestHarness tile; |   VTestHarness *tile = new VTestHarness; | ||||||
|  |  | ||||||
| #if VM_TRACE | #if VM_TRACE | ||||||
|   Verilated::traceEverOn(true); // Verilator must compute traced signals |   Verilated::traceEverOn(true); // Verilator must compute traced signals | ||||||
|   std::unique_ptr<VerilatedVcdFILE> vcdfd(new VerilatedVcdFILE(vcdfile)); |   std::unique_ptr<VerilatedVcdFILE> vcdfd(new VerilatedVcdFILE(vcdfile)); | ||||||
|   std::unique_ptr<VerilatedVcdC> tfp(new VerilatedVcdC(vcdfd.get())); |   std::unique_ptr<VerilatedVcdC> tfp(new VerilatedVcdC(vcdfd.get())); | ||||||
|   if (vcdfile) { |   if (vcdfile) { | ||||||
|     tile.trace(tfp.get(), 99);  // Trace 99 levels of hierarchy |     tile->trace(tfp.get(), 99);  // Trace 99 levels of hierarchy | ||||||
|     tfp->open(""); |     tfp->open(""); | ||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
| @@ -82,25 +82,25 @@ int main(int argc, char** argv) | |||||||
|  |  | ||||||
|   // reset for several cycles to handle pipelined reset |   // reset for several cycles to handle pipelined reset | ||||||
|   for (int i = 0; i < 10; i++) { |   for (int i = 0; i < 10; i++) { | ||||||
|     tile.reset = 1; |     tile->reset = 1; | ||||||
|     tile.clk = 0; |     tile->clk = 0; | ||||||
|     tile.eval(); |     tile->eval(); | ||||||
|     tile.clk = 1; |     tile->clk = 1; | ||||||
|     tile.eval(); |     tile->eval(); | ||||||
|     tile.reset = 0; |     tile->reset = 0; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   while (!dtm->done() && !tile.io_success && trace_count < max_cycles) { |   while (!dtm->done() && !tile->io_success && trace_count < max_cycles) { | ||||||
|     tile.clk = 0; |     tile->clk = 0; | ||||||
|     tile.eval(); |     tile->eval(); | ||||||
| #if VM_TRACE | #if VM_TRACE | ||||||
|     bool dump = tfp && trace_count >= start; |     bool dump = tfp && trace_count >= start; | ||||||
|     if (dump) |     if (dump) | ||||||
|       tfp->dump(trace_count * 2); |       tfp->dump(trace_count * 2); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     tile.clk = 1; |     tile->clk = 1; | ||||||
|     tile.eval(); |     tile->eval(); | ||||||
| #if VM_TRACE | #if VM_TRACE | ||||||
|     if (dump) |     if (dump) | ||||||
|       tfp->dump(trace_count * 2 + 1); |       tfp->dump(trace_count * 2 + 1); | ||||||
| @@ -132,6 +132,7 @@ int main(int argc, char** argv) | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   delete dtm; |   delete dtm; | ||||||
|  |   delete tile; | ||||||
|  |  | ||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user