ACT netlist to Verilog netlist

The act2v tool can be used to convert an ACT structural netlist into Verilog syntax. This is useful if you need a structural Verilog netlist—for example, as an input to a commercial or other third party tool (e.g. for place and route, visualization, etc.).

Usage

The usage is:

Usage: act2v [act-options] [-Bmf] [-c <cells>] [-p <proc>] <act>

Given an ACT file and the top-level process name, this prints a Verilog netlist. The tool takes the following command-line options in addition to the standard common ACT options:

  • -p <proc> : specify the top-level process name (required)
  • -c <cells> : use <cells> as the cells file, and run cell extraction (ala prs2cells) before generating the Verilog netlist. Note: for this to work properly, the top-level process should also be instantiated in the ACT.
  • -m : use mangled names rather than escaped names in the Verilog output
  • -f : fuse the wire/reg directive with input/output directives
  • -B : turns on black box mode (in case black box mode is off by default for your technology). This option is deprecated and black box mode should be turned on by default in the ACT configuration files.

Examples

As a simple example, consider the following ACT file:

example.act
defproc inverter (bool? i; bool! o)
{
  prs {
    i => o-
  }
}
 
defproc nand2 (bool? a, b; bool! c)
{
  prs {
    a & b => c-
  }
}
 
defproc and2 (bool? a, b; bool! c)
{
  nand2 n(.a=a, .b=b);
  inverter i(.i=n.c, .o=c);  // note that we don't need the intermediate name _c
}

A simple use-case would be to generate a Verilog netlist for and2, and the command is:

$ act2v -p and2 example.act > eg1.v

This will generate a netlist that looks like this:

//
// Verilog module for: inverter<>
//
module inverter(i, o);
   input i;
   output o;
 
// -- signals ---
   reg o;
   wire i;
 
// --- instances
endmodule
...
//
// Verilog module for: and2<>
//
module and2(a, b, c);
   input a;
   input b;
   output c;
 
// -- signals ---
   reg \i.i ;
   wire a;
   wire b;
   reg c;
 
// --- instances
inverter \i  (.i(\i.i ), .o(c));
nand2 \n  (.a(a), .b(b), .c(\i.i ));
endmodule

A few observations:

  • The Verilog escaping approach is used to keep the names as similar to the original ACT names as possible. In the example, the name i.i is escaped in the and2 module definition.
  • All production rules have been stripped out. That's because this is for netlist translation, and not used to generate a Verilog simulation model. This is intentional; a translated Verilog simulation model might easily pass tests in Verilog, but that may not be an accurate view of reality. ''actsim'' is a better way to simulate the circuit for functionality.

Some Verilog tools can't handle the escapes correctly; in this case, you should use the -m option to turn on name mangling, which will convert the escaped names into mangled names automatically.

Finally, some Verilog tools don't like the separate wire and input/output designations. To support those, the -f option can be used to fuse the two different declarations into a single one. Note that some tools don't like the fused syntax, which is why both approaches are supported. Adding -f and -m for the same example above produces the following output for the generic technology that comes with the ACT installation:

//
// Verilog module for: inverter<>
//
module inverter(i, o);
 
// -- signals ---
   input    wire i;
   output    reg o;
 
// --- instances
endmodule
 
//
// Verilog module for: nand2<>
//
module nand2(a, b, c);
 
// -- signals ---
   output    reg c;
   input    wire a;
   input    wire b;
 
// --- instances
endmodule
 
//
// Verilog module for: and2<>
//
module and2(a, b, c);
 
// -- signals ---
   input    wire b;
   output    reg c;
   input    wire a;
   reg i_ai;
 
// --- instances
inverter i  (.i(i_ai), .o(c));
nand2 n  (.a(a), .b(b), .c(i_ai));
endmodule

Configuration options

The behavior of the ACT library that emits Verilog from an ACT netlist is governed by a number of configuration parameters. The command-line options simply set the options in the appropriate way before calling the library to generate Verilog. The configuration parameters are all prefixed by act2v.; in other words, they can be placed in a begin act2vend group.

Parameter Type Effect
name_mangle int Verilog names are normally escaped using the backslash convention as shown in the examples above. Setting this parameter to 1 turns on ACT's name mangling convention to eliminate special characters.
fuse_signal_directives int This is 0 by default. Setting this parameter to 1 combines the direction (input/output) and wire/reg declarations. Some tools prefer this syntax.
no_signal_decl int This is 0 by default. Some tools don't want signals to be declared; setting this to 1 turns on this behavior.
emit_cells int This is 1 by default, which causes the Verilog generator to emit empty (black box) declarations for cells. Setting it to 0 suppresses the generation of the modules for cells. This is useful if, for example, there is a separate file with the description of cells that is to be merged with the emitted Verilog netlist.
stop_at_process string_table Normally this parameter is not provided. However, if it is provided, then it can be used to stop generating the Verilog netlist and treat the specified process types as black box modules. This is useful in the context of hierarchical netlist flows.