pub struct ChiselBackend;Expand description
Code-generation backend for Chisel 3 / Chisel 5.
Implementations§
Source§impl ChiselBackend
impl ChiselBackend
Sourcepub fn emit_type(&self, ty: &ChiselType) -> String
pub fn emit_type(&self, ty: &ChiselType) -> String
Emit the Chisel type string for a ChiselType.
Sourcepub fn io_bundle(&self, ports: &[ChiselPort]) -> String
pub fn io_bundle(&self, ports: &[ChiselPort]) -> String
Emit the val io = IO(new Bundle { ... }) declaration for a port list.
Sourcepub fn emit_module(&self, module: &ChiselModule) -> String
pub fn emit_module(&self, module: &ChiselModule) -> String
Emit a complete Chisel module class.
Sourcepub fn when_stmt(&self, cond: &str, body: &str) -> String
pub fn when_stmt(&self, cond: &str, body: &str) -> String
Emit a when block: when(cond) { body }.
Sourcepub fn when_otherwise(
&self,
cond: &str,
when_body: &str,
other_body: &str,
) -> String
pub fn when_otherwise( &self, cond: &str, when_body: &str, other_body: &str, ) -> String
Emit a when / otherwise block.
Sourcepub fn reg_init(&self, name: &str, ty: &ChiselType, init: &str) -> String
pub fn reg_init(&self, name: &str, ty: &ChiselType, init: &str) -> String
Emit a register declaration: val r = RegInit(init_val).
Sourcepub fn reg_no_reset(&self, name: &str, ty: &ChiselType) -> String
pub fn reg_no_reset(&self, name: &str, ty: &ChiselType) -> String
Emit a register declaration without reset: val r = Reg(gen).
Sourcepub fn wire_decl(&self, name: &str, ty: &ChiselType) -> String
pub fn wire_decl(&self, name: &str, ty: &ChiselType) -> String
Emit a wire declaration: val w = Wire(gen).
Sourcepub fn assert_stmt(&self, cond: &str, msg: &str) -> String
pub fn assert_stmt(&self, cond: &str, msg: &str) -> String
Emit a assert statement.
Sourcepub fn instantiate(&self, class: &str, inst_name: &str) -> String
pub fn instantiate(&self, class: &str, inst_name: &str) -> String
Emit a submodule instantiation.
Sourcepub fn emit_expr(&self, expr: &ChiselExpr) -> String
pub fn emit_expr(&self, expr: &ChiselExpr) -> String
Emit a ChiselExpr as a string.
Source§impl ChiselBackend
impl ChiselBackend
Sourcepub fn irrevocable_port(
&self,
name: &str,
data_type: &ChiselType,
is_output: bool,
) -> String
pub fn irrevocable_port( &self, name: &str, data_type: &ChiselType, is_output: bool, ) -> String
Emit an Irrevocable (valid+ready, never de-asserts valid) port.
Sourcepub fn comb_rom(
&self,
name: &str,
_data_type: &ChiselType,
values: &[&str],
) -> String
pub fn comb_rom( &self, name: &str, _data_type: &ChiselType, values: &[&str], ) -> String
Emit a combinational ROM using a Vec[UInt] initialized from a list.
Sourcepub fn log2_floor(&self, n: u32) -> u32
pub fn log2_floor(&self, n: u32) -> u32
Emit a log2Floor computation.
Sourcepub fn cover_stmt(&self, cond: &str, msg: &str) -> String
pub fn cover_stmt(&self, cond: &str, msg: &str) -> String
Emit a cover statement (Chisel formal verification).
Sourcepub fn assume_stmt(&self, cond: &str) -> String
pub fn assume_stmt(&self, cond: &str) -> String
Emit an assume statement.
Sourcepub fn sim_printf(&self, fmt_str: &str, args: &[&str]) -> String
pub fn sim_printf(&self, fmt_str: &str, args: &[&str]) -> String
Emit a ChiselSim-compatible printf for simulation only.
Sourcepub fn fill(&self, n: u32, expr: &str) -> String
pub fn fill(&self, n: u32, expr: &str) -> String
Emit a chisel3.util.Fill call (replicate a bit pattern).
Sourcepub fn oh_to_uint(&self, one_hot: &str) -> String
pub fn oh_to_uint(&self, one_hot: &str) -> String
Emit a priority encoder (OHToUInt).
Sourcepub fn uint_to_oh(&self, n: &str, width: u32) -> String
pub fn uint_to_oh(&self, n: &str, width: u32) -> String
Emit a UIntToOH call.
Sourcepub fn mux_case(&self, default: &str, cases: &[(&str, &str)]) -> String
pub fn mux_case(&self, default: &str, cases: &[(&str, &str)]) -> String
Emit a MuxCase expression.
Sourcepub fn shift_register(&self, data: &str, n: u32, reset_val: &str) -> String
pub fn shift_register(&self, data: &str, n: u32, reset_val: &str) -> String
Emit a ShiftRegister instantiation.
Sourcepub fn round_robin_arbiter(
&self,
name: &str,
data_type: &ChiselType,
n: u32,
) -> String
pub fn round_robin_arbiter( &self, name: &str, data_type: &ChiselType, n: u32, ) -> String
Emit an arbiter (RRArbiter) for n inputs of a given type.
Sourcepub fn priority_arbiter(
&self,
name: &str,
data_type: &ChiselType,
n: u32,
) -> String
pub fn priority_arbiter( &self, name: &str, data_type: &ChiselType, n: u32, ) -> String
Emit a fixed-priority arbiter.
Sourcepub fn queue_module(
&self,
name: &str,
data_type: &ChiselType,
depth: u32,
) -> String
pub fn queue_module( &self, name: &str, data_type: &ChiselType, depth: u32, ) -> String
Emit a Chisel FIFO queue module instantiation.
Sourcepub fn when_chain(
&self,
cond_body: &[(&str, &str)],
otherwise: Option<&str>,
) -> String
pub fn when_chain( &self, cond_body: &[(&str, &str)], otherwise: Option<&str>, ) -> String
Emit a when/elsewhen/otherwise chain.
Sourcepub fn counter(&self, name: &str, max_val: u32, enable: &str) -> String
pub fn counter(&self, name: &str, max_val: u32, enable: &str) -> String
Emit a counter that wraps at max_val.
Sourcepub fn reset_sync(&self, name: &str, async_rst: &str) -> String
pub fn reset_sync(&self, name: &str, async_rst: &str) -> String
Emit a reset synchronizer (2-FF synchronizer for reset deassertion).
Sourcepub fn cdc_handshake_comment(&self, from_clk: &str, to_clk: &str) -> String
pub fn cdc_handshake_comment(&self, from_clk: &str, to_clk: &str) -> String
Emit a clock domain crossing (CDC) handshake wrapper comment.
Trait Implementations§
Source§impl Clone for ChiselBackend
impl Clone for ChiselBackend
Source§fn clone(&self) -> ChiselBackend
fn clone(&self) -> ChiselBackend
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more