You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue lists out the next steps for implementing and testing a Calyx-to-FIRRTL backend, as described in #1552 .
Current status: I added fud2 support for the FIRRTL backend!
Primitives
Set up Chisel compiler and get it to emit LoFIRRTL code
Write one primitive in Chisel (translate from Verilog)
Implement primitives in FIRRTL
Troubling ones!
std_slice
std_pad
std_mem_*: Double check how 2,3,4 dimensional memories work? <-- Focus on 1 for now, maybe implement 2 via a one-dimensional array and calculating the array element we want to get the data from
Add discussion to suggest differential testing
test test test!!!
Problem: FIRRTL compiler and ESSENT both optimize away the non-inputs.
Use annotation to read memories from file --> No writememh equivalent in Chisel/FIRRTL
Write testbench mechanism that exposes all of the memories we need to deal with (using refs) and supply memories as inputs and outputs.
Debug language-tutorial-iterate being stuck (combinational loop?)
Write C++ test harness to read memory and write memory
Automate process of text-replacing from FIRRTL template
Create Calyx backend to find all of the primitive uses across the entire program and produces JSON
Write a python script to read the JSON and call m4 accordingly to create the primitives in question
Write a bash script to use cat (or something of the sort) to concatenate the generated FIRRTL and the necessary primitives
Add fud2 support for primitives-inst (temporary name) backend
Add option to FIRRTL backend to differentiate between extmodule generation and not.
Add fud2 support for the whole pipeline of generating FIRRTL
Cleanup after deadline
Write a backend to obtain all of the ref usages and their inputs into a JSON file instead of the extreme hack of splitting on commas. --> Using the yxi backend for this.
Use firtool instead of the deprecated FIRRTL compiler.
Put Usage comments into a formal documentation about the FIRRTL backend
Memories - the current "implementation" of std_mem_* in verilog reads memories from a hardcoded location.
Primitives - we may need to translate more primitives based on what tests we want to run
Archived: Translating Calyx language features
Guards
This can be implemented either by recursively going down the guard tree, or via flattening as done in verilog.rs. Either way it'll be a good exercise in learning Rust :)
Conditionals
Default value/invalid statements before the first guarded assignment.
Cells
Non-primitive cells
Primitive cells
Function converting cell declaration to an identifier string
Create extmodules for all of the identifiers created
FIX: need to add inputs and outputs to extmodule definition.
Cleaner solutions relating to attributes
Properly identifying clocks via @clk
We want to make sure that the clock port is given the FIRRTL Clock type. As a first pass attempt, I have a hack that checks for the name clk (that Calyx autogenerates), but I want to check for the @clk attribute instead for a cleaner solution.
Identifying @control attributes instead of @data attributes for default value/invalid statements
Currently I use the is_data_port() function from verilog.rs to check whether a port is a data or a control port. But, what I actually want to say is x is invalid for all non-control ports (this may not matter much since is invalid gets sugared down to zero assignments anyhow).
Using TopLevel attribute to find the top level component
Archived: Manual Testing and Execution via fud
Manual Testing
Calyx compiler will emit FIRRTL, get FIRRTL converted to Verilog. We also have Calyx primitives written in Verilog
Writing a test bench in Verilog that runs the FIRRTL.
Maybe it's nice to have a small bash script to do all of this once I write out the test bench?
Refer to tb.sv from fud.
Local TODOs:
Get verilator working on my local. Confirmed that using the docker image works so maybe it's a problem with versioning. Use icarus verilog for now?
Understand tb.sv
Need to figure out a simple testbench I can use to harness a simple program.
Make testbench for simple program that involves the clock.
Make testbench work for program that uses primitives (no std_mem).
Make testbench work for programs that uses std_mem.
The idea here is to create an ad-hoc verilog module that is hard-coded to get a memory from a specific dat file.
Use the readmemh and writememh constructs in the ad-hoc module
Write bash script to do all of this?
Figure out why language-tutorial-compute is not working...
FIRRTL optimizes the assignment with only one conditional.
Try manually adding other conditionals, or else block.
FIRRTL Execution
Linking FIRRTL into fud2.
Something like
fud e --from calyx --to verilog --through firrtl
Produce FIRRTL via fud2
Run the FIRRTL → System-Verilog compiler via fud2.
Simulate the resulting System-Verilog
Need to figure out how to bring the primitives into the picture.
The text was updated successfully, but these errors were encountered:
This issue lists out the next steps for implementing and testing a Calyx-to-FIRRTL backend, as described in #1552 .
Current status: I added
fud2
support for the FIRRTL backend!std_slice
std_pad
std_mem_*
: Double check how 2,3,4 dimensional memories work? <-- Focus on 1 for now, maybe implement 2 via a one-dimensional array and calculating the array element we want to get the data fromwritememh
equivalent in Chisel/FIRRTLref
s) and supply memories as inputs and outputs.language-tutorial-iterate
being stuck (combinational loop?)cat
(or something of the sort) to concatenate the generated FIRRTL and the necessary primitivesextmodule
generation and not.ref
usages and their inputs into a JSON file instead of the extreme hack of splitting on commas. --> Using theyxi
backend for this.firtool
instead of the deprecated FIRRTL compiler.readmemh
andwritememh
#1603 (comment)) --> Deferred to [fud2] Switch to custom testbench generation #2086.std_mem_*
in verilog reads memories from a hardcoded location.Archived: Translating Calyx language features
verilog.rs
. Either way it'll be a good exercise in learning Rust :)@clk
Clock
type. As a first pass attempt, I have a hack that checks for the nameclk
(that Calyx autogenerates), but I want to check for the@clk
attribute instead for a cleaner solution.@control
attributes instead of@data
attributes for default value/invalid statementsis_data_port()
function fromverilog.rs
to check whether a port is a data or a control port. But, what I actually want to say isx is invalid
for all non-control ports (this may not matter much sinceis invalid
gets sugared down to zero assignments anyhow).TopLevel
attribute to find the top level componentArchived: Manual Testing and Execution via
fud
tb.sv
from fud.tb.sv
std_mem
).std_mem
.dat
file.readmemh
andwritememh
constructs in the ad-hoc modulelanguage-tutorial-compute
is not working...The text was updated successfully, but these errors were encountered: