Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/bin/nl_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,27 @@ impl Pass for MarkCriticalPath {
}
}

register_passes!(PrimitiveCell; PrintVerilog, DotGraph, Clean, DisconnectRegisters,
DisconnectArcSet, MarkArcSet, RenameNets, ReportSccs,
ReportDepth, MarkCriticalPath);
register_passes!(PrimitiveCell;
/// A dummy pass that emits the Verilog of the netlist.
PrintVerilog,
/// Print the dot graph of the netlist
DotGraph,
/// Clean the netlist of cells which are not used
Clean,
/// Disconnect all register inputs
DisconnectRegisters,
/// Disconnect wires based on greedy arc set heuristic, creating a DAG
DisconnectArcSet,
/// Rename wires and instances that are part of the feedback arc set (prefixed with "arc_")
MarkArcSet,
/// Rename wires and instances sequentially 0, 1, ...
RenameNets,
/// Report the number of strongly connected components
ReportSccs,
/// Report the longest path in the netlist
ReportDepth,
/// Mark the node names of cells along the critical path (prefixed with "crit_")
MarkCriticalPath);

/// Netlist optimization debugging tool
#[derive(Parser, Debug)]
Expand Down
19 changes: 17 additions & 2 deletions src/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,28 @@ pub trait Pass {
}

/// Register all these passes in an enum for clap args
///
/// # Example
/// ```
/// use eqmap::register_passes;
/// use eqmap::netlist::PrimitiveCell;
/// use eqmap::pass::PrintVerilog;
/// // This defines a enum called `Passes` with unit variants.
/// // They operate on netlists containing `PrimitiveCell` cells.
/// register_passes!(PrimitiveCell;
/// /// A dummy pass that emits the Verilog of the netlist.
/// PrintVerilog);
/// ```
#[macro_export]
macro_rules! register_passes {
($i:ty ; $($pass:ident),+ $(,)?) => {
($i:ty ; $($(#[$meta:meta])* $pass:ident),+ $(,)?) => {
/// Enum containing all registered passes for argument parsing.
#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
pub enum Passes {
$($pass),+
$(
$(#[$meta])*
$pass
),+
}

impl std::fmt::Display for Passes {
Expand Down
Loading