@celox-sim/celox / index / Simulator
Class: Simulator<P>
Defined in: packages/celox/src/simulator.ts:58
Type Parameters
P
P = Record<string, unknown>
Accessors
dut
Get Signature
get dut():
P
Defined in: packages/celox/src/simulator.ts:322
The DUT accessor object — read/write ports as plain properties.
Returns
P
warnings
Get Signature
get warnings(): readonly
string[]
Defined in: packages/celox/src/simulator.ts:327
Analyzer warnings emitted during compilation.
Returns
readonly string[]
Methods
dispose()
dispose():
void
Defined in: packages/celox/src/simulator.ts:405
Release native resources.
Returns
void
dump()
dump(
timestamp):void
Defined in: packages/celox/src/simulator.ts:399
Write current signal values to VCD at the given timestamp.
Parameters
timestamp
number
Returns
void
event()
event(
name):EventHandle
Defined in: packages/celox/src/simulator.ts:373
Resolve an event name to a handle for use with tick().
Parameters
name
string
Returns
fourState()
fourState(
portName):FourStateValue
Defined in: packages/celox/src/simulator.ts:386
Read the raw 4-state (value + mask) pair for the named port.
Parameters
portName
string
Returns
tick()
Call Signature
tick(
event?,count?):void
Defined in: packages/celox/src/simulator.ts:338
Trigger a clock edge.
Parameters
event?
Optional event handle from this.event(). If omitted, ticks the first (default) event.
number | EventHandle
count?
number
Number of ticks. Default: 1.
Returns
void
Call Signature
tick(
count?):void
Defined in: packages/celox/src/simulator.ts:339
Trigger a clock edge.
Parameters
count?
number
Number of ticks. Default: 1.
Returns
void
create()
staticcreate<P>(module,options?):Simulator<P>
Defined in: packages/celox/src/simulator.ts:97
Create a Simulator for the given module.
import { Adder } from "./generated/Adder.js";
const sim = Simulator.create(Adder);Type Parameters
P
P
Parameters
module
options?
SimulatorOptions & object
Returns
Simulator<P>
fromProject()
staticfromProject<P>(projectPath,top,options?):Simulator<P>
Defined in: packages/celox/src/simulator.ts:260
Create a Simulator from a Veryl project directory.
Searches upward from projectPath for Veryl.toml, gathers all .veryl source files, and builds the simulator using the project's clock/reset settings.
const sim = Simulator.fromProject<MyPorts>("./my-project", "Top");Type Parameters
P
P = Record<string, unknown>
Parameters
projectPath
string
top
string
options?
SimulatorOptions & object
Returns
Simulator<P>
fromSource()
staticfromSource<P>(source,top,options?):Simulator<P>
Defined in: packages/celox/src/simulator.ts:185
Create a Simulator directly from Veryl source code.
Automatically discovers ports from the NAPI layout — no ModuleDefinition needed.
const sim = Simulator.fromSource<AdderPorts>(ADDER_SOURCE, "Adder");
sim.dut.a = 100;
sim.dut.b = 200;
sim.tick();
expect(sim.dut.sum).toBe(300);Type Parameters
P
P = Record<string, unknown>
Parameters
source
string
top
string
options?
SimulatorOptions & object
Returns
Simulator<P>