google / google/xls

[enhancement] developer should be able to choose how to simulate their DSLX code

Open
#1,573 2 comments 0 reactions 1 assignee Claimed by @allight View on GitHub
enhancement ux
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

### What's hard to do? (limit 100 words)

Currently when choosing between the DSLX interpreter, the IR interpreter, the JIT or a Verilog simulator to run a set of DSLX tests: developers have to go thru very disjoint experiences (both on the command line and thru bazel rules).

### Current best alternative workaround (limit 100 words)

### DSLX interpreter

Just use `interpreter_main` w/ input and assertion from tests; for bazel: `xls_dslx_test`.

### IR interpreter

`ir_converter_main | opt_main | eval_ir --use_llvm_jit=false` w/ inputs from the command line and `--input_validator_expr` or `--input_validator_path` to validate the result; for bazel: `xls_dslx_ir ← xls_opt_ir ← xls_eval_ir_test`.

### JIT

`ir_converter_main | opt_main | eval_ir --use_llvm_jit=true ` w/ inputs from the command line and `--input_validator_expr` or `--input_validator_path` to validate the result; for bazel: `xls_dslx_ir` ← `xls_opt_ir` ←`cc_xls_ir_jit_wrapper` ← `cc_test`.

### Verilog

`codegen_main` and write a verilog test bench.

### Your view of the "best case XLS enhancement" (limit 100 words)

Ideally we would have only one command line/bazel rule w/ a flag to choose the simulation environment.

### DSLX interpreter

```
dslx test path/to/example.x
```
```
xls_dslx_test(
name = "e_dslx_test",
srcs = [ "example.x" ],
)
```

### IR interpreter

```
dslx test --simulator=dslx path/to/example.x
```
```
xls_dslx_test(
name = "e_dslx_test",
srcs = [ "example.x" ],
simulator = "dslx",
)
```

### JIT

```
dslx test --simulator=jit path/to/example.x
```
```
xls_dslx_test(
name = "e_dslx_test",
srcs = [ "example.x" ],
simulator = "jit",
)
```

### Verilog

```
dslx test --simulator=iverilog path/to/example.x
```
```
xls_dslx_test(
name = "e_dslx_test",
srcs = [ "example.x" ],
simulator = "verilog",
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.