@celox-sim/celox 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dut.d.ts +14 -7
- package/dist/dut.d.ts.map +1 -1
- package/dist/dut.js +103 -27
- package/dist/dut.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/napi-helpers.d.ts +62 -1
- package/dist/napi-helpers.d.ts.map +1 -1
- package/dist/napi-helpers.js +154 -19
- package/dist/napi-helpers.js.map +1 -1
- package/dist/simulation.d.ts +59 -3
- package/dist/simulation.d.ts.map +1 -1
- package/dist/simulation.js +162 -16
- package/dist/simulation.js.map +1 -1
- package/dist/simulator.d.ts +7 -1
- package/dist/simulator.d.ts.map +1 -1
- package/dist/simulator.js +35 -14
- package/dist/simulator.js.map +1 -1
- package/dist/types.d.ts +36 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/src/dut.test.ts +66 -66
- package/src/dut.ts +124 -31
- package/src/e2e.bench.ts +176 -13
- package/src/e2e.test.ts +632 -195
- package/src/index.ts +10 -2
- package/src/matchers.ts +4 -7
- package/src/napi-helpers.ts +224 -22
- package/src/simulation.test.ts +220 -12
- package/src/simulation.ts +198 -13
- package/src/simulator.test.ts +8 -8
- package/src/simulator.ts +43 -11
- package/src/types.ts +54 -3
package/dist/napi-helpers.js
CHANGED
|
@@ -34,6 +34,91 @@ export function loadNativeAddon(addonPath) {
|
|
|
34
34
|
`Build it with: pnpm run build:napi`, { cause: e });
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Signal path parsing
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
/**
|
|
41
|
+
* Parse a signal path string into instance-path + var-path components.
|
|
42
|
+
*
|
|
43
|
+
* Format: `instanceSeg1.instanceSeg2:varSeg1.varSeg2`
|
|
44
|
+
* - `:` separates instance path from variable path
|
|
45
|
+
* - Without `:`, the whole string is the variable path
|
|
46
|
+
* - Instance segments may include `[N]` array indices
|
|
47
|
+
*
|
|
48
|
+
* Examples:
|
|
49
|
+
* - `"v"` → { instancePath: [], varPath: ["v"] }
|
|
50
|
+
* - `"p2:i"` → { instancePath: [{name:"p2",index:0}], varPath: ["i"] }
|
|
51
|
+
* - `"a.b[3]:x.y"` → { instancePath: [{name:"a",index:0},{name:"b",index:3}], varPath: ["x","y"] }
|
|
52
|
+
*/
|
|
53
|
+
export function parseSignalPath(path) {
|
|
54
|
+
const colonIdx = path.indexOf(":");
|
|
55
|
+
if (colonIdx < 0) {
|
|
56
|
+
return { instancePath: [], varPath: path.split(".") };
|
|
57
|
+
}
|
|
58
|
+
const instPart = path.slice(0, colonIdx);
|
|
59
|
+
const varPart = path.slice(colonIdx + 1);
|
|
60
|
+
const instancePath = [];
|
|
61
|
+
if (instPart.length > 0) {
|
|
62
|
+
for (const seg of instPart.split(".")) {
|
|
63
|
+
const bracketIdx = seg.indexOf("[");
|
|
64
|
+
if (bracketIdx >= 0) {
|
|
65
|
+
const name = seg.slice(0, bracketIdx);
|
|
66
|
+
const index = Number.parseInt(seg.slice(bracketIdx + 1, -1), 10);
|
|
67
|
+
instancePath.push({ name, index });
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
instancePath.push({ name: seg, index: 0 });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { instancePath, varPath: varPart.split(".") };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build NapiOptions from SimulatorOptions.
|
|
78
|
+
* Returns `undefined` when no options are set (to skip the NAPI options arg).
|
|
79
|
+
*/
|
|
80
|
+
export function buildNapiOpts(options) {
|
|
81
|
+
if (!options)
|
|
82
|
+
return undefined;
|
|
83
|
+
const napiOpts = {};
|
|
84
|
+
let hasOpt = false;
|
|
85
|
+
if (options.fourState) {
|
|
86
|
+
napiOpts.fourState = options.fourState;
|
|
87
|
+
hasOpt = true;
|
|
88
|
+
}
|
|
89
|
+
if (options.vcd) {
|
|
90
|
+
napiOpts.vcd = options.vcd;
|
|
91
|
+
hasOpt = true;
|
|
92
|
+
}
|
|
93
|
+
if (options.optimize != null) {
|
|
94
|
+
napiOpts.optimize = options.optimize;
|
|
95
|
+
hasOpt = true;
|
|
96
|
+
}
|
|
97
|
+
if (options.falseLoops && options.falseLoops.length > 0) {
|
|
98
|
+
napiOpts.falseLoops = options.falseLoops.map((lb) => ({
|
|
99
|
+
from: parseSignalPath(lb.from),
|
|
100
|
+
to: parseSignalPath(lb.to),
|
|
101
|
+
}));
|
|
102
|
+
hasOpt = true;
|
|
103
|
+
}
|
|
104
|
+
if (options.trueLoops && options.trueLoops.length > 0) {
|
|
105
|
+
napiOpts.trueLoops = options.trueLoops.map((tl) => ({
|
|
106
|
+
from: parseSignalPath(tl.from),
|
|
107
|
+
to: parseSignalPath(tl.to),
|
|
108
|
+
maxIter: tl.maxIter,
|
|
109
|
+
}));
|
|
110
|
+
hasOpt = true;
|
|
111
|
+
}
|
|
112
|
+
if (options.clockType) {
|
|
113
|
+
napiOpts.clockType = options.clockType;
|
|
114
|
+
hasOpt = true;
|
|
115
|
+
}
|
|
116
|
+
if (options.resetType) {
|
|
117
|
+
napiOpts.resetType = options.resetType;
|
|
118
|
+
hasOpt = true;
|
|
119
|
+
}
|
|
120
|
+
return hasOpt ? napiOpts : undefined;
|
|
121
|
+
}
|
|
37
122
|
/**
|
|
38
123
|
* Parse the NAPI layout JSON into SignalLayout records.
|
|
39
124
|
* Returns both the full layout (with type_kind for port detection) and
|
|
@@ -58,6 +143,9 @@ export function parseNapiLayout(json) {
|
|
|
58
143
|
if (r.array_dims && r.array_dims.length > 0) {
|
|
59
144
|
entry.arrayDims = r.array_dims;
|
|
60
145
|
}
|
|
146
|
+
if (r.associated_clock) {
|
|
147
|
+
entry.associatedClock = r.associated_clock;
|
|
148
|
+
}
|
|
61
149
|
signals[name] = entry;
|
|
62
150
|
forDut[name] = sl;
|
|
63
151
|
}
|
|
@@ -72,19 +160,17 @@ export function buildPortsFromLayout(signals, _events) {
|
|
|
72
160
|
for (const [name, sig] of Object.entries(signals)) {
|
|
73
161
|
const typeKind = sig.typeKind;
|
|
74
162
|
let portType;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
portType = "logic";
|
|
87
|
-
break;
|
|
163
|
+
if (typeKind === "clock") {
|
|
164
|
+
portType = "clock";
|
|
165
|
+
}
|
|
166
|
+
else if (typeKind.startsWith("reset")) {
|
|
167
|
+
portType = "reset";
|
|
168
|
+
}
|
|
169
|
+
else if (typeKind === "bit") {
|
|
170
|
+
portType = "bit";
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
portType = "logic";
|
|
88
174
|
}
|
|
89
175
|
const port = {
|
|
90
176
|
direction: sig.direction,
|
|
@@ -99,6 +185,48 @@ export function buildPortsFromLayout(signals, _events) {
|
|
|
99
185
|
}
|
|
100
186
|
return ports;
|
|
101
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Parse the hierarchy JSON from NAPI into a HierarchyNode tree.
|
|
190
|
+
* Converts snake_case keys to camelCase and auto-detects ports.
|
|
191
|
+
*/
|
|
192
|
+
export function parseHierarchyLayout(json, events) {
|
|
193
|
+
const raw = JSON.parse(json);
|
|
194
|
+
return convertHierarchyNode(raw, events);
|
|
195
|
+
}
|
|
196
|
+
function convertHierarchyNode(raw, events) {
|
|
197
|
+
const signals = {};
|
|
198
|
+
const forDut = {};
|
|
199
|
+
for (const [name, r] of Object.entries(raw.signals)) {
|
|
200
|
+
const sl = {
|
|
201
|
+
offset: r.offset,
|
|
202
|
+
width: r.width,
|
|
203
|
+
byteSize: r.byte_size > 0 ? r.byte_size : Math.ceil(r.width / 8),
|
|
204
|
+
is4state: r.is_4state,
|
|
205
|
+
direction: r.direction,
|
|
206
|
+
};
|
|
207
|
+
const entry = {
|
|
208
|
+
...sl,
|
|
209
|
+
typeKind: r.type_kind,
|
|
210
|
+
};
|
|
211
|
+
if (r.array_dims && r.array_dims.length > 0) {
|
|
212
|
+
entry.arrayDims = r.array_dims;
|
|
213
|
+
}
|
|
214
|
+
signals[name] = entry;
|
|
215
|
+
forDut[name] = sl;
|
|
216
|
+
}
|
|
217
|
+
const ports = buildPortsFromLayout(signals, events);
|
|
218
|
+
const children = {};
|
|
219
|
+
for (const [name, instances] of Object.entries(raw.children)) {
|
|
220
|
+
children[name] = instances.map((inst) => convertHierarchyNode(inst, events));
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
moduleName: raw.module_name,
|
|
224
|
+
signals,
|
|
225
|
+
forDut,
|
|
226
|
+
ports,
|
|
227
|
+
children,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
102
230
|
// ---------------------------------------------------------------------------
|
|
103
231
|
// Handle wrapping — zero-copy direct operations
|
|
104
232
|
// ---------------------------------------------------------------------------
|
|
@@ -145,6 +273,9 @@ export function wrapDirectSimulationHandle(raw) {
|
|
|
145
273
|
time() {
|
|
146
274
|
return raw.time();
|
|
147
275
|
},
|
|
276
|
+
nextEventTime() {
|
|
277
|
+
return raw.nextEventTime();
|
|
278
|
+
},
|
|
148
279
|
evalComb() {
|
|
149
280
|
raw.evalComb();
|
|
150
281
|
},
|
|
@@ -181,13 +312,15 @@ function parseLegacyLayout(json) {
|
|
|
181
312
|
* `Simulator.create(module, { __nativeCreate: ... })`.
|
|
182
313
|
*/
|
|
183
314
|
export function createSimulatorBridge(addon) {
|
|
184
|
-
return (source, moduleName,
|
|
185
|
-
const
|
|
315
|
+
return (source, moduleName, options) => {
|
|
316
|
+
const napiOpts = buildNapiOpts(options);
|
|
317
|
+
const raw = new addon.NativeSimulatorHandle(source, moduleName, napiOpts);
|
|
186
318
|
const layout = parseLegacyLayout(raw.layoutJson);
|
|
187
319
|
const events = JSON.parse(raw.eventsJson);
|
|
320
|
+
const hierarchy = parseHierarchyLayout(raw.hierarchyJson, events);
|
|
188
321
|
const buf = raw.sharedMemory().buffer;
|
|
189
322
|
const handle = wrapDirectSimulatorHandle(raw);
|
|
190
|
-
return { buffer: buf, layout, events, handle };
|
|
323
|
+
return { buffer: buf, layout, events, handle, hierarchy };
|
|
191
324
|
};
|
|
192
325
|
}
|
|
193
326
|
/**
|
|
@@ -195,13 +328,15 @@ export function createSimulatorBridge(addon) {
|
|
|
195
328
|
* `Simulation.create(module, { __nativeCreate: ... })`.
|
|
196
329
|
*/
|
|
197
330
|
export function createSimulationBridge(addon) {
|
|
198
|
-
return (source, moduleName,
|
|
199
|
-
const
|
|
331
|
+
return (source, moduleName, options) => {
|
|
332
|
+
const napiOpts = buildNapiOpts(options);
|
|
333
|
+
const raw = new addon.NativeSimulationHandle(source, moduleName, napiOpts);
|
|
200
334
|
const layout = parseLegacyLayout(raw.layoutJson);
|
|
201
335
|
const events = JSON.parse(raw.eventsJson);
|
|
336
|
+
const hierarchy = parseHierarchyLayout(raw.hierarchyJson, events);
|
|
202
337
|
const buf = raw.sharedMemory().buffer;
|
|
203
338
|
const handle = wrapDirectSimulationHandle(raw);
|
|
204
|
-
return { buffer: buf, layout, events, handle };
|
|
339
|
+
return { buffer: buf, layout, events, handle, hierarchy };
|
|
205
340
|
};
|
|
206
341
|
}
|
|
207
342
|
//# sourceMappingURL=napi-helpers.js.map
|
package/dist/napi-helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"napi-helpers.js","sourceRoot":"","sources":["../src/napi-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"napi-helpers.js","sourceRoot":"","sources":["../src/napi-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA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@ -4,7 +4,7 @@
|
|
|
4
4
|
* Wraps a NativeSimulationHandle and provides a high-level TypeScript API
|
|
5
5
|
* for clock-driven simulation with automatic scheduling.
|
|
6
6
|
*/
|
|
7
|
-
import type { CreateResult, ModuleDefinition, NativeSimulationHandle, SimulatorOptions } from "./types.js";
|
|
7
|
+
import type { CreateResult, FourStateValue, ModuleDefinition, NativeSimulationHandle, SimulatorOptions } from "./types.js";
|
|
8
8
|
/**
|
|
9
9
|
* Placeholder for the NAPI binding's `createSimulation()`.
|
|
10
10
|
* Stream B will provide the real implementation.
|
|
@@ -21,6 +21,9 @@ export declare class Simulation<P = Record<string, unknown>> {
|
|
|
21
21
|
private readonly _dut;
|
|
22
22
|
private readonly _events;
|
|
23
23
|
private readonly _state;
|
|
24
|
+
private readonly _buffer;
|
|
25
|
+
private readonly _layout;
|
|
26
|
+
private readonly _clocks;
|
|
24
27
|
private _disposed;
|
|
25
28
|
private constructor();
|
|
26
29
|
/**
|
|
@@ -90,9 +93,14 @@ export declare class Simulation<P = Record<string, unknown>> {
|
|
|
90
93
|
/**
|
|
91
94
|
* Run the simulation until the given time.
|
|
92
95
|
* Processes all scheduled events up to and including `endTime`.
|
|
93
|
-
*
|
|
96
|
+
*
|
|
97
|
+
* When `maxSteps` is provided, steps are counted in TS and a
|
|
98
|
+
* `SimulationTimeoutError` is thrown if the budget is exhausted before
|
|
99
|
+
* reaching `endTime`. Without `maxSteps` the fast Rust path is used.
|
|
94
100
|
*/
|
|
95
|
-
runUntil(endTime: number
|
|
101
|
+
runUntil(endTime: number, opts?: {
|
|
102
|
+
maxSteps?: number;
|
|
103
|
+
}): void;
|
|
96
104
|
/**
|
|
97
105
|
* Advance to the next scheduled event.
|
|
98
106
|
*
|
|
@@ -101,6 +109,54 @@ export declare class Simulation<P = Record<string, unknown>> {
|
|
|
101
109
|
step(): number | null;
|
|
102
110
|
/** Current simulation time. */
|
|
103
111
|
time(): number;
|
|
112
|
+
/**
|
|
113
|
+
* Peek at the time of the next scheduled event without advancing.
|
|
114
|
+
*
|
|
115
|
+
* @returns The time of the next event, or `null` if no events are scheduled.
|
|
116
|
+
*/
|
|
117
|
+
nextEventTime(): number | null;
|
|
118
|
+
/**
|
|
119
|
+
* Step until `condition()` returns true.
|
|
120
|
+
*
|
|
121
|
+
* @returns The simulation time when the condition became true.
|
|
122
|
+
* @throws SimulationTimeoutError if `maxSteps` is exceeded.
|
|
123
|
+
*/
|
|
124
|
+
waitUntil(condition: () => boolean, opts?: {
|
|
125
|
+
maxSteps?: number;
|
|
126
|
+
}): number;
|
|
127
|
+
/**
|
|
128
|
+
* Wait for `count` rising edges of the given clock.
|
|
129
|
+
*
|
|
130
|
+
* Detects actual 0→1 transitions by reading the clock signal directly
|
|
131
|
+
* from the shared buffer (clock ports are excluded from the DUT proxy).
|
|
132
|
+
* The clock must have been registered via `addClock`.
|
|
133
|
+
*
|
|
134
|
+
* @returns The simulation time after the edges are observed.
|
|
135
|
+
* @throws SimulationTimeoutError if `maxSteps` is exceeded.
|
|
136
|
+
*/
|
|
137
|
+
waitForCycles(clock: string, count: number, opts?: {
|
|
138
|
+
maxSteps?: number;
|
|
139
|
+
}): number;
|
|
140
|
+
/**
|
|
141
|
+
* Assert and release a reset signal.
|
|
142
|
+
*
|
|
143
|
+
* The active level is determined automatically from the Veryl type:
|
|
144
|
+
* - `reset` / `reset_async_high` / `reset_sync_high` → active-high (1)
|
|
145
|
+
* - `reset_async_low` / `reset_sync_low` → active-low (0)
|
|
146
|
+
*
|
|
147
|
+
* For sync resets (with an associated clock from FfDeclaration), advances
|
|
148
|
+
* `activeCycles` worth of the associated clock's period using `runUntil`.
|
|
149
|
+
* For async resets without an associated clock, `duration` must be specified.
|
|
150
|
+
* An explicit `duration` overrides cycle-based calculation for either type.
|
|
151
|
+
*/
|
|
152
|
+
reset(signal: string, opts?: {
|
|
153
|
+
activeCycles?: number;
|
|
154
|
+
duration?: number;
|
|
155
|
+
}): void;
|
|
156
|
+
/**
|
|
157
|
+
* Read the raw 4-state (value + mask) pair for the named port.
|
|
158
|
+
*/
|
|
159
|
+
fourState(portName: string): FourStateValue;
|
|
104
160
|
/** Write current signal values to VCD at the given timestamp. */
|
|
105
161
|
dump(timestamp: number): void;
|
|
106
162
|
/** Release native resources. */
|
package/dist/simulation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../src/simulation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../src/simulation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EAEtB,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAYpB;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,gBAAgB,KACtB,YAAY,CAAC,sBAAsB,CAAC,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,wBAAwB,GAAG,IAAI,CAE5E;AAMD,qBAAa,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAI;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiF;IACzG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0D;IAClF,OAAO,CAAC,SAAS,CAAS;IAE1B,OA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I;IAyB7D;;;;OAIG;IACH,IAAI,IAAI,MAAM,GAAG,IAAI;IAOrB,+BAA+B;IAC/B,IAAI,IAAI,MAAM;IAKd;;;;OAIG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAK9B;;;;;OAKG;IACH,SAAS,CACP,SAAS,EAAE,MAAM,OAAO,EACxB,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,MAAM;IAoBT;;;;;;;;;OASG;IACH,aAAa,CACX,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3B,MAAM;IAuBT;;;;;;;;;;;OAWG;IACH,KAAK,CACH,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAClD,IAAI;IAyCP;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;IAY3C,iEAAiE;IACjE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK7B,gCAAgC;IAChC,OAAO,IAAI,IAAI;IAWf,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,WAAW;CAKpB"}
|
package/dist/simulation.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Wraps a NativeSimulationHandle and provides a high-level TypeScript API
|
|
5
5
|
* for clock-driven simulation with automatic scheduling.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { SimulationTimeoutError } from "./types.js";
|
|
8
|
+
import { createDut, readFourState } from "./dut.js";
|
|
9
|
+
import { loadNativeAddon, parseNapiLayout, parseHierarchyLayout, buildPortsFromLayout, wrapDirectSimulationHandle, buildNapiOpts, } from "./napi-helpers.js";
|
|
9
10
|
let _nativeCreate;
|
|
10
11
|
/**
|
|
11
12
|
* Register the NAPI binding at module load time.
|
|
@@ -22,12 +23,17 @@ export class Simulation {
|
|
|
22
23
|
_dut;
|
|
23
24
|
_events;
|
|
24
25
|
_state;
|
|
26
|
+
_buffer;
|
|
27
|
+
_layout;
|
|
28
|
+
_clocks = new Map();
|
|
25
29
|
_disposed = false;
|
|
26
|
-
constructor(handle, dut, events, state) {
|
|
30
|
+
constructor(handle, dut, events, state, buffer, layout) {
|
|
27
31
|
this._handle = handle;
|
|
28
32
|
this._dut = dut;
|
|
29
33
|
this._events = events;
|
|
30
34
|
this._state = state;
|
|
35
|
+
this._buffer = buffer;
|
|
36
|
+
this._layout = layout;
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* Create a Simulation for the given module.
|
|
@@ -48,11 +54,11 @@ export class Simulation {
|
|
|
48
54
|
throw new Error("Native simulator binding not loaded. " +
|
|
49
55
|
"Ensure @celox-sim/celox-napi is installed.");
|
|
50
56
|
}
|
|
51
|
-
const { fourState, vcd } = options ?? {};
|
|
52
|
-
const result = createFn(module.source, module.name, { fourState, vcd });
|
|
57
|
+
const { fourState, vcd, optimize, falseLoops, trueLoops, clockType, resetType } = options ?? {};
|
|
58
|
+
const result = createFn(module.source, module.name, { fourState, vcd, optimize, falseLoops, trueLoops, clockType, resetType });
|
|
53
59
|
const state = { dirty: false };
|
|
54
|
-
const dut = createDut(result.buffer, result.layout, module.ports, result.handle, state);
|
|
55
|
-
return new Simulation(result.handle, dut, result.events, state);
|
|
60
|
+
const dut = createDut(result.buffer, result.layout, module.ports, result.handle, state, result.hierarchy);
|
|
61
|
+
return new Simulation(result.handle, dut, result.events, state, result.buffer, result.layout);
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* Create a Simulation directly from Veryl source code.
|
|
@@ -68,16 +74,17 @@ export class Simulation {
|
|
|
68
74
|
*/
|
|
69
75
|
static fromSource(source, top, options) {
|
|
70
76
|
const addon = loadNativeAddon(options?.nativeAddonPath);
|
|
71
|
-
const napiOpts = options
|
|
77
|
+
const napiOpts = buildNapiOpts(options);
|
|
72
78
|
const raw = new addon.NativeSimulationHandle(source, top, napiOpts);
|
|
73
79
|
const layout = parseNapiLayout(raw.layoutJson);
|
|
74
80
|
const events = JSON.parse(raw.eventsJson);
|
|
81
|
+
const hierarchy = parseHierarchyLayout(raw.hierarchyJson, events);
|
|
75
82
|
const ports = buildPortsFromLayout(layout.signals, events);
|
|
76
83
|
const buf = raw.sharedMemory().buffer;
|
|
77
84
|
const state = { dirty: false };
|
|
78
85
|
const handle = wrapDirectSimulationHandle(raw);
|
|
79
|
-
const dut = createDut(buf, layout.forDut, ports, handle, state);
|
|
80
|
-
return new Simulation(handle, dut, events, state);
|
|
86
|
+
const dut = createDut(buf, layout.forDut, ports, handle, state, hierarchy);
|
|
87
|
+
return new Simulation(handle, dut, events, state, buf, layout.signals);
|
|
81
88
|
}
|
|
82
89
|
/**
|
|
83
90
|
* Create a Simulation from a Veryl project directory.
|
|
@@ -93,16 +100,17 @@ export class Simulation {
|
|
|
93
100
|
*/
|
|
94
101
|
static fromProject(projectPath, top, options) {
|
|
95
102
|
const addon = loadNativeAddon(options?.nativeAddonPath);
|
|
96
|
-
const napiOpts = options
|
|
103
|
+
const napiOpts = buildNapiOpts(options);
|
|
97
104
|
const raw = addon.NativeSimulationHandle.fromProject(projectPath, top, napiOpts);
|
|
98
105
|
const layout = parseNapiLayout(raw.layoutJson);
|
|
99
106
|
const events = JSON.parse(raw.eventsJson);
|
|
107
|
+
const hierarchy = parseHierarchyLayout(raw.hierarchyJson, events);
|
|
100
108
|
const ports = buildPortsFromLayout(layout.signals, events);
|
|
101
109
|
const buf = raw.sharedMemory().buffer;
|
|
102
110
|
const state = { dirty: false };
|
|
103
111
|
const handle = wrapDirectSimulationHandle(raw);
|
|
104
|
-
const dut = createDut(buf, layout.forDut, ports, handle, state);
|
|
105
|
-
return new Simulation(handle, dut, events, state);
|
|
112
|
+
const dut = createDut(buf, layout.forDut, ports, handle, state, hierarchy);
|
|
113
|
+
return new Simulation(handle, dut, events, state, buf, layout.signals);
|
|
106
114
|
}
|
|
107
115
|
/** The DUT accessor object — read/write ports as plain properties. */
|
|
108
116
|
get dut() {
|
|
@@ -118,6 +126,7 @@ export class Simulation {
|
|
|
118
126
|
this.ensureAlive();
|
|
119
127
|
const eventId = this.resolveEvent(name);
|
|
120
128
|
this._handle.addClock(eventId, opts.period, opts.initialDelay ?? 0);
|
|
129
|
+
this._clocks.set(name, { period: opts.period, eventId });
|
|
121
130
|
}
|
|
122
131
|
/**
|
|
123
132
|
* Schedule a one-shot value change for a signal.
|
|
@@ -133,11 +142,30 @@ export class Simulation {
|
|
|
133
142
|
/**
|
|
134
143
|
* Run the simulation until the given time.
|
|
135
144
|
* Processes all scheduled events up to and including `endTime`.
|
|
136
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* When `maxSteps` is provided, steps are counted in TS and a
|
|
147
|
+
* `SimulationTimeoutError` is thrown if the budget is exhausted before
|
|
148
|
+
* reaching `endTime`. Without `maxSteps` the fast Rust path is used.
|
|
137
149
|
*/
|
|
138
|
-
runUntil(endTime) {
|
|
150
|
+
runUntil(endTime, opts) {
|
|
139
151
|
this.ensureAlive();
|
|
140
|
-
|
|
152
|
+
if (opts?.maxSteps == null) {
|
|
153
|
+
this._handle.runUntil(endTime);
|
|
154
|
+
this._state.dirty = false;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const max = opts.maxSteps;
|
|
158
|
+
let steps = 0;
|
|
159
|
+
while (this._handle.time() < endTime) {
|
|
160
|
+
const t = this._handle.step();
|
|
161
|
+
if (t == null)
|
|
162
|
+
break;
|
|
163
|
+
steps++;
|
|
164
|
+
if (steps >= max) {
|
|
165
|
+
this._state.dirty = false;
|
|
166
|
+
throw new SimulationTimeoutError(`runUntil: exceeded ${max} steps at time ${this._handle.time()} (target ${endTime})`, this._handle.time(), steps);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
141
169
|
this._state.dirty = false;
|
|
142
170
|
}
|
|
143
171
|
/**
|
|
@@ -156,6 +184,124 @@ export class Simulation {
|
|
|
156
184
|
this.ensureAlive();
|
|
157
185
|
return this._handle.time();
|
|
158
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Peek at the time of the next scheduled event without advancing.
|
|
189
|
+
*
|
|
190
|
+
* @returns The time of the next event, or `null` if no events are scheduled.
|
|
191
|
+
*/
|
|
192
|
+
nextEventTime() {
|
|
193
|
+
this.ensureAlive();
|
|
194
|
+
return this._handle.nextEventTime();
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Step until `condition()` returns true.
|
|
198
|
+
*
|
|
199
|
+
* @returns The simulation time when the condition became true.
|
|
200
|
+
* @throws SimulationTimeoutError if `maxSteps` is exceeded.
|
|
201
|
+
*/
|
|
202
|
+
waitUntil(condition, opts) {
|
|
203
|
+
this.ensureAlive();
|
|
204
|
+
const max = opts?.maxSteps ?? 100_000;
|
|
205
|
+
let steps = 0;
|
|
206
|
+
while (!condition()) {
|
|
207
|
+
const t = this._handle.step();
|
|
208
|
+
this._state.dirty = false;
|
|
209
|
+
if (t == null)
|
|
210
|
+
break;
|
|
211
|
+
steps++;
|
|
212
|
+
if (steps >= max) {
|
|
213
|
+
throw new SimulationTimeoutError(`waitUntil: condition not met after ${max} steps at time ${this._handle.time()}`, this._handle.time(), steps);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return this._handle.time();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Wait for `count` rising edges of the given clock.
|
|
220
|
+
*
|
|
221
|
+
* Detects actual 0→1 transitions by reading the clock signal directly
|
|
222
|
+
* from the shared buffer (clock ports are excluded from the DUT proxy).
|
|
223
|
+
* The clock must have been registered via `addClock`.
|
|
224
|
+
*
|
|
225
|
+
* @returns The simulation time after the edges are observed.
|
|
226
|
+
* @throws SimulationTimeoutError if `maxSteps` is exceeded.
|
|
227
|
+
*/
|
|
228
|
+
waitForCycles(clock, count, opts) {
|
|
229
|
+
this.ensureAlive();
|
|
230
|
+
if (!this._clocks.has(clock)) {
|
|
231
|
+
throw new Error(`No clock registered for '${clock}'. Call addClock() first.`);
|
|
232
|
+
}
|
|
233
|
+
const sig = this._layout[clock];
|
|
234
|
+
if (!sig) {
|
|
235
|
+
throw new Error(`No layout entry for clock '${clock}'.`);
|
|
236
|
+
}
|
|
237
|
+
const view = new DataView(this._buffer);
|
|
238
|
+
const readClk = () => view.getUint8(sig.offset);
|
|
239
|
+
let prev = readClk();
|
|
240
|
+
let remaining = count;
|
|
241
|
+
return this.waitUntil(() => {
|
|
242
|
+
const curr = readClk();
|
|
243
|
+
if (prev === 0 && curr !== 0)
|
|
244
|
+
remaining--;
|
|
245
|
+
prev = curr;
|
|
246
|
+
return remaining <= 0;
|
|
247
|
+
}, opts);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Assert and release a reset signal.
|
|
251
|
+
*
|
|
252
|
+
* The active level is determined automatically from the Veryl type:
|
|
253
|
+
* - `reset` / `reset_async_high` / `reset_sync_high` → active-high (1)
|
|
254
|
+
* - `reset_async_low` / `reset_sync_low` → active-low (0)
|
|
255
|
+
*
|
|
256
|
+
* For sync resets (with an associated clock from FfDeclaration), advances
|
|
257
|
+
* `activeCycles` worth of the associated clock's period using `runUntil`.
|
|
258
|
+
* For async resets without an associated clock, `duration` must be specified.
|
|
259
|
+
* An explicit `duration` overrides cycle-based calculation for either type.
|
|
260
|
+
*/
|
|
261
|
+
reset(signal, opts) {
|
|
262
|
+
this.ensureAlive();
|
|
263
|
+
const sig = this._layout[signal];
|
|
264
|
+
if (!sig) {
|
|
265
|
+
throw new Error(`Unknown port '${signal}'. Available: ${Object.keys(this._layout).join(", ")}`);
|
|
266
|
+
}
|
|
267
|
+
const typeKind = sig.typeKind ?? "";
|
|
268
|
+
if (!typeKind.startsWith("reset")) {
|
|
269
|
+
throw new Error(`Port '${signal}' is not a reset signal (type_kind: '${typeKind}').`);
|
|
270
|
+
}
|
|
271
|
+
const isActiveLow = typeKind === "reset_async_low" || typeKind === "reset_sync_low";
|
|
272
|
+
const activeValue = isActiveLow ? 0n : 1n;
|
|
273
|
+
const inactiveValue = isActiveLow ? 1n : 0n;
|
|
274
|
+
const dut = this._dut;
|
|
275
|
+
dut[signal] = activeValue;
|
|
276
|
+
const associatedClock = sig.associatedClock;
|
|
277
|
+
if (opts?.duration != null) {
|
|
278
|
+
// Explicit duration (works for both sync and async resets)
|
|
279
|
+
this._handle.runUntil(this._handle.time() + opts.duration);
|
|
280
|
+
}
|
|
281
|
+
else if (associatedClock) {
|
|
282
|
+
// Clock-associated reset → advance by activeCycles
|
|
283
|
+
const cycles = opts?.activeCycles ?? 2;
|
|
284
|
+
this.waitForCycles(associatedClock, cycles);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// No associated clock and no explicit duration → error
|
|
288
|
+
throw new Error(`Reset '${signal}' has no associated clock. Specify opts.duration.`);
|
|
289
|
+
}
|
|
290
|
+
dut[signal] = inactiveValue;
|
|
291
|
+
this._state.dirty = false;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Read the raw 4-state (value + mask) pair for the named port.
|
|
295
|
+
*/
|
|
296
|
+
fourState(portName) {
|
|
297
|
+
this.ensureAlive();
|
|
298
|
+
const sig = this._layout[portName];
|
|
299
|
+
if (!sig) {
|
|
300
|
+
throw new Error(`Unknown port '${portName}'. Available: ${Object.keys(this._layout).join(", ")}`);
|
|
301
|
+
}
|
|
302
|
+
const [value, mask] = readFourState(this._buffer, sig);
|
|
303
|
+
return { __fourState: true, value, mask };
|
|
304
|
+
}
|
|
159
305
|
/** Write current signal values to VCD at the given timestamp. */
|
|
160
306
|
dump(timestamp) {
|
|
161
307
|
this.ensureAlive();
|
package/dist/simulation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulation.js","sourceRoot":"","sources":["../src/simulation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
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