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.).

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:

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:

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