Learning BSV‎ > ‎Attributes‎ > ‎

Documentation Attributes

The doc= attribute is used to specify comments to be included in the generated Verilog.

Attribute Syntax

(* doc = "documentation string" *)

To provide a multi-line comment, either use the line feed (\n) character or provide separate instances of the attribute. Examples:

 (* doc = "This is one line\nAnd this is another" *)

or

 (* doc = "This is one line" *)
(* doc = "And this is another" *)

or

 (* doc = "This is one line",
doc = "And this is another" *)

Multiple doc attributes will appear together in the order that they are given. The doc attribute can modify modules, module instantiations, and rules.

BSV Example

(* synthesize, always_enabled = "motorCntrl", always_ready = "motorCntrl" *)
(* doc = "This module controls the elevator cabin" *)
module mkCabinCntrl (IfcCabinCntrl#(Floors, Direction));
...
(* doc = "This RWire takes the value",
doc = "to store it into the destination reg" *)
RWire#(Floors) dest <- mkRWire;
...
(* doc = "if the cabin is stopped and the current floor is bigger \n than the requestedFloor\nthen output motorCntrl to Down"*)
(*doc= "otherwise Up" *)
rule inStop ((cabinState == Stopped) &&& dest.wget matches tagged Valid .value);
...
endrule
...
endmodule

Generated Verilog

...
// This module controls the elevator cabin
//
// Comments on the inlined module `dest':
// This RWire takes the value
// to store it into the destination reg
//
//
`ifdef BSV_ASSIGNMENT_DELAY
`else
`define BSV_ASSIGNMENT_DELAY
`endif
module mkCabinCntrl(CLK,
RST_N,
destinationFloor_a,
EN_destinationFloor,
RDY_destinationFloor,
EN_nearFloor,
RDY_nearFloor,
motorCntrl);
input CLK;
input RST_N;
...
// rule RL_inStop
// if the cabin is stopped and the current floor is bigger
// than the requestedFloor
// then output motorCntrl to Down
// otherwise Up
assign WILL_FIRE_RL_inStop = cabinState == 2'd2 && EN_destinationFloor ;
...
endmodule // mkCabinCntrl
Comments