PRS Macros - The HAC Language
Description: The HAC Language

Next: Pass-gates, Up: PRS Extensions

#### 15.4.1 Macros

As an alternative to a PRS-rule, one may write a macro to represent some custom topology of a netlist or as shorthand for an expansion.

We propose the following syntax for macros:

- PRS-macro : identifier `<` expr-list `>` `(` PRS-literal-list `)`
- PRS-macro : identifier `(` PRS-literal-list `)`

We do not hard-code any built-in macros into the language with keywords, rather we allow the programmer to define the meaning of each macro. Macros can also take parameters inside angle-brackets, where the expr-list is a list of comma-separated expressions. The number of arguments for a macro may also be variable, and is defined by the macro's implementation. The macro mechanism can potentially be used to attach attributes to nodes and other subnets. As the list of macros grows, they should be documented here.

Examples of macros one may wish to define:

- `passn` — <W,L>(g,s,d) W is an optional transistor width, L is an optional length. If only one parameter is passed, it is interpreted as the width. g, s, d are the gate, source, and drain, respectively. The pseudo production rule generated (`cflat prsim`) is uni-directional, i.e. the drain is driven as the output.
- `passp` — analogous to `passn`
- `pass` — full symmetric pass-gate
- `assert`
- `stat`
- `comb-fb`

The remaining sections discuss other extensions that have been proposed at other times. See which ones could be folded into a general macro!

Below are a list of macros documented in the source file Object/lang/PRS_macro_registry.cc.

— Macro: passn W L g s d

> Usage: passn<W,L>(g, s, d) or passn(g, s, d)

> Declares an NFET pass-transistor with gate g, source s, and drain d. Sizing parameters W and L are optional. In hflat prsim mode, this prints a uni-directional (sized) production rule

>               after 0  g & ~s -> d-

> In hflat lvs mode, this just prints passn(g, s, d) back out. Sizes are printed only if -fsizes is passed to hflat.

— Macro: passp W L g s d

> Usage: passp<W,L>(g, s, d) or passp(g, s, d)

> Declares a PFET pass-transistor with gate g, source s, and drain d. Sizing parameters W and L are optional. In hflat prsim mode, this prints a uni-directional (sized) production rule

>               after 0 ~g & s -> d+

> In hflat lvs mode, this just prints passp(g, s, d) back out. Sizes are printed only if -fsizes is passed to hflat.

— Macro: echo nodes...

> Diagnostic. This macro just prints echo(...) back out where the original arguments are substituted with canonical hierarchical instance (node) names. This demonstrates how one can add custom PRS macros.