The Bluespec compiler provides a default name for input ports by combining the method name and the argument name. The prefix= and port=
attributes are used to specify strings to be used to create the input
port name. Using a combination of these attributes, any desired name
can be generated.
Default Naming
input port name: methodname_argumentname
Attribute Syntax
(* prefix = "prefixname" *) method type methodname ((* port = "portname" *) argumentname) ;
- The string provided to the prefix attribute replaces the methodname and the string provided to the port attribute replaces the argumentname in the Verilog generated for the port name. The prefix string may be empty, in which case the joining underscore is not added.
- The prefix= attribute may be associated with method declarations or sub-interface declarations. The port= attribute may be associated with each method prototype argument in the interface declaration.
- The prefix= attribute is ignored if the method does not have any arguments.
- The prefix= attribute may also be used on
sub-interface declarations to aid the renaming of interface
hierarchies. By default, interface hierarchies are named by prefixing
the sub-interface name to names of the methods within that interface.
Using the prefix= attribute, will replace the sub-interface name.
BSV Example 1: Prefix and Port are specified
interface GrabAndGive; (*prefix="FIRST"*) method Action grab( (* port="IN_DATA" *) Bit#(8) value); method Bit#(8) give(); endinterface
Generated Verilog 1
// action method grab input [7 : 0] FIRST_IN_DATA; // port is renamed prefix_port input EN_grab; output RDY_grab;
BSV Example 2: Prefix is an empty string
interface GrabAndGive; (*prefix=""*) method Action grab( (* port="IN_DATA" *) Bit#(8) value); method Bit#(8) give(); endinterface
Generated Verilog 2
// action method grab input [7 : 0] IN_DATA; // port is renamed with port string input EN_grab; output RDY_grab;
BSV Example 3: Prefix not specified
interface GrabAndGive; method Action grab( (* port="IN_DATA" *) Bit#(8) value); method Bit#(8) give(); endinterface
Generated Verilog 3
// action method grab input [7 : 0] grab_IN_DATA; // port is renamed methodname_port input EN_grab; output RDY_grab;
BSV Example 4: Port not specified
interface GrabAndGive; (*prefix="FIRST"*) method Action grab(Bit#(8) value); method Bit#(8) give(); endinterface
Generated Verilog 4
// action method grab input [7 : 0] FIRST_value; // port is renamed prefix_argumentname input EN_grab; output RDY_grab;
|