Repository navigation
Expand file tree
/
Copy pathdriver.cpp
More file actions
33 lines (32 loc) · 1.46 KB
/
Copy pathdriver.cpp
File metadata and controls
33 lines (32 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* OpenRTL-Header-Begin
* OpenRTL — Open-source hardware accelerators.
* Organization: https://github.com/OpenRTL-Lab
* Website: https://openrtl.top/
*
* Project: Goldilocks Batch Inversion Hardware Accelerator
* Chisel hardware for Goldilocks batch inversion and division with interleaved contexts.
* Repository: https://github.com/OpenRTL-Lab/batch-inversion-goldilocks
* File: operators/batch-inversion/sim/driver.cpp
*
* SPDX-FileCopyrightText: 2026 Goldilocks Batch Inversion contributors
* Copyright applies to original project contributions only.
* SPDX-License-Identifier: MIT
* See LICENSE and applicable third-party notices.
* OpenRTL-Header-End
*/
#include "VBatchInversionSimTop.h"
#include "verilated.h"
#include <cstdint>
#include <cstdlib>
#include <iostream>
int main(int argc,char **argv){
VerilatedContext ctx;ctx.commandArgs(argc,argv);VBatchInversionSimTop top{&ctx};
auto tick=[&](){top.clock=0;top.eval();ctx.timeInc(1);top.clock=1;top.eval();ctx.timeInc(1);};
top.reset=1;top.trigger=0;top.testMode=argc>1?std::atoi(argv[1]):0;
for(int i=0;i<8;i++)tick();top.reset=0;tick();top.trigger=1;tick();top.trigger=0;
for(std::uint64_t i=0;!top.done && !ctx.gotFinish() && i<50000020ULL;i++)tick();
bool ok=top.done && top.pass && top.mismatchCount==0;
std::cout<<"RESULT pass="<<ok<<" checked="<<top.checked<<" mismatches="<<top.mismatchCount
<<" completed="<<top.completedCount<<" cycles="<<top.cycles<<"\n";top.final();return ok?0:1;
}