google / google/xls

Add support for instantiation to the IR interpreter

Open
#551 0 comments 0 reactions 0 assignees View on GitHub
good first issue ir
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

The IR interpreter doesn't yet support the instantiation operation. The instantiation operation is a low-level op which can appear in blocks. It instantiates another XLS block. It is analogous to a Verilog module instantiation.

Initially, it'd be easiest to support instantiation of combinational blocks only to avoid having to worry about register state. The implementation would be in block_interpreter.cc. It could work by simply creating another [BlockInterpreter](https://github.com/google/xls/blob/c330e64365e56439ab9496159aa8664c6cd5eb6a/xls/interpreter/block_interpreter.cc#L25) object within the HandleInstantiation method of BlockInterpeter. This sub interpreter could evaluate the block and return the outputs and the interpretation could keep on trucking.

Stateful instantiation is much trickier. A block might be instantiated multiple times from different points of the code. Each instantiation needs its own register state. So register state needs to be keyed by instantiation stack (similar to call stack in a normal program) and register name.

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.