@celox-sim/celox-napi 0.1.29 → 0.1.31

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.
Files changed (3) hide show
  1. package/index.d.ts +52 -2
  2. package/index.js +3 -0
  3. package/package.json +13 -8
package/index.d.ts CHANGED
@@ -107,6 +107,23 @@ export declare function clearJitCache(): void
107
107
  */
108
108
  export declare function genTs(projectPath: string): string
109
109
 
110
+ /**
111
+ * Generate TypeScript type information from in-memory Veryl sources.
112
+ *
113
+ * Like `gen_ts()` but does not require a Veryl.toml or filesystem access.
114
+ * Works on both native and wasm32 targets.
115
+ */
116
+ export declare function genTsFromSource(sources: Array<NapiSourceFile>): string
117
+
118
+ /** Result of a single `$assert` evaluation in a native testbench. */
119
+ export interface NapiAssertionResult {
120
+ passed: boolean
121
+ message?: string
122
+ file?: string
123
+ line?: number
124
+ column?: number
125
+ }
126
+
110
127
  /** A false-loop declaration (combinational loop to ignore). */
111
128
  export interface NapiFalseLoop {
112
129
  from: NapiSignalPath
@@ -130,18 +147,29 @@ export interface NapiOptimizeOptions {
130
147
  inlineCommitForwarding?: boolean
131
148
  eliminateDeadWorkingStores?: boolean
132
149
  reschedule?: boolean
150
+ coalesceStores?: boolean
133
151
  }
134
152
 
135
153
  /** Options for creating a simulator/simulation handle. */
136
154
  export interface NapiOptions {
137
155
  fourState?: boolean
138
156
  vcd?: string
157
+ /**
158
+ * Optimization level preset: "O0", "O1", or "O2".
159
+ * Takes precedence over `optimize` and `optimize_options`.
160
+ */
161
+ optLevel?: string
162
+ /**
163
+ * Per-pass overrides applied on top of opt_level.
164
+ * Each entry: "+sir:<pass_name>" to enable, "-sir:<pass_name>" to disable.
165
+ */
166
+ passOverrides?: Array<string>
139
167
  /**
140
168
  * Shorthand to enable/disable all SIRT optimization passes.
141
- * `true` = all on, `false` = all off. Overridden by `optimize_options` if both set.
169
+ * `true` = all on, `false` = all off. Overridden by `opt_level` or `optimize_options`.
142
170
  */
143
171
  optimize?: boolean
144
- /** Per-pass optimizer flags. */
172
+ /** Per-pass optimizer flags (legacy). Overridden by `opt_level`/`pass_overrides`. */
145
173
  optimizeOptions?: NapiOptimizeOptions
146
174
  /** Cranelift backend optimization level: "none", "speed", or "speed_and_size". */
147
175
  craneliftOptLevel?: string
@@ -183,9 +211,31 @@ export interface NapiSourceFile {
183
211
  path: string
184
212
  }
185
213
 
214
+ /** Detailed result of running a native testbench. */
215
+ export interface NapiTestResult {
216
+ passed: boolean
217
+ assertions: Array<NapiAssertionResult>
218
+ }
219
+
186
220
  /** A true-loop declaration with a convergence iteration limit. */
187
221
  export interface NapiTrueLoop {
188
222
  from: NapiSignalPath
189
223
  to: NapiSignalPath
190
224
  maxIter: number
191
225
  }
226
+
227
+ /**
228
+ * Run a native testbench from Veryl source code.
229
+ *
230
+ * Compiles the given sources and runs the `#[test]` module specified by `top`,
231
+ * collecting all assertion results.
232
+ */
233
+ export declare function runTest(sources: Array<NapiSourceFile>, top: string, options?: NapiOptions | undefined | null): NapiTestResult
234
+
235
+ /**
236
+ * Run a native testbench from a Veryl project directory.
237
+ *
238
+ * Searches upward from `project_path` for `Veryl.toml`, gathers all
239
+ * `.veryl` source files, and runs the `#[test]` module specified by `top`.
240
+ */
241
+ export declare function runTestFromProject(projectPath: string, top: string, options?: NapiOptions | undefined | null): NapiTestResult
package/index.js CHANGED
@@ -580,3 +580,6 @@ module.exports.NativeSimulationHandle = nativeBinding.NativeSimulationHandle
580
580
  module.exports.NativeSimulatorHandle = nativeBinding.NativeSimulatorHandle
581
581
  module.exports.clearJitCache = nativeBinding.clearJitCache
582
582
  module.exports.genTs = nativeBinding.genTs
583
+ module.exports.genTsFromSource = nativeBinding.genTsFromSource
584
+ module.exports.runTest = nativeBinding.runTest
585
+ module.exports.runTestFromProject = nativeBinding.runTestFromProject
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@celox-sim/celox-napi",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Celox simulator NAPI bindings",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "napi": {
8
8
  "binaryName": "celox",
9
+ "wasm": {
10
+ "browser": {
11
+ "fs": true
12
+ }
13
+ },
9
14
  "targets": [
10
15
  "x86_64-unknown-linux-gnu",
11
16
  "aarch64-unknown-linux-gnu",
@@ -44,12 +49,12 @@
44
49
  },
45
50
  "license": "MIT OR Apache-2.0",
46
51
  "optionalDependencies": {
47
- "@celox-sim/celox-napi-linux-x64-gnu": "0.1.29",
48
- "@celox-sim/celox-napi-linux-arm64-gnu": "0.1.29",
49
- "@celox-sim/celox-napi-linux-x64-musl": "0.1.29",
50
- "@celox-sim/celox-napi-linux-arm64-musl": "0.1.29",
51
- "@celox-sim/celox-napi-darwin-x64": "0.1.29",
52
- "@celox-sim/celox-napi-darwin-arm64": "0.1.29",
53
- "@celox-sim/celox-napi-win32-x64-msvc": "0.1.29"
52
+ "@celox-sim/celox-napi-linux-x64-gnu": "0.1.31",
53
+ "@celox-sim/celox-napi-linux-arm64-gnu": "0.1.31",
54
+ "@celox-sim/celox-napi-linux-x64-musl": "0.1.31",
55
+ "@celox-sim/celox-napi-linux-arm64-musl": "0.1.31",
56
+ "@celox-sim/celox-napi-darwin-x64": "0.1.31",
57
+ "@celox-sim/celox-napi-darwin-arm64": "0.1.31",
58
+ "@celox-sim/celox-napi-win32-x64-msvc": "0.1.31"
54
59
  }
55
60
  }