Re: Verilog 2000 attributes

From: Adam Krolnik (krolnik@lsil.com)
Date: Thu Feb 10 2000 - 14:01:51 PST


Good afternoon:

Thanks James for bringing up this ambiguity. I apologize for not
being on the call - 2 hours earlier I was ready for the call...

<p>I wanted to be able to add a attribute to several statements
and noticed only a few were supported. I see that adding
an attribute as a statement item is not what I really wanted.

I concur with your and Steve's suggestions that the attributes
be pulled off the statements and instead be in front. This is a COMPLETE
CHANGE as it seems that every place an attribute instance can be
put (except for inside expressions, port connections, udp input/output
declarations, case items) it needs to be removed and these productions
substituted:

description ::= [ attribute_instance ] description
...

tatement ::= [ attribute_instance ] statement
...
function_statement ::= [ attribute_instance ] function_statement
...

module_or_generate_item ::= [ attribute_instance]
module_or_generate_item
...

udp_output_declaration ::= [attribute_instance] udp_output_declaration
...

udp_input_declaration ::= [attribute_instance] udp_input_declaration
...

task_item_declaration ::= [attribute_instance] task_item_declaration
...

task_port_item ::= [attribute] task_port_item
...

function_item_declaration ::= [attribute_instance]
function_item_declaration
...
function_port_item ::= [attribute_instance] function_port_item
...

block_item_declaration ::= [attribute_instance] block_item_declaration

There are possibly more - it would be easier if the BNF was still in
text...

<p>So the rule would be 'an attribute is attached to the element it
preceeds.' Something that sounds reasonable. E.g.

<p>(* power_level=2 *)
module afoo (
  (* rtl_clk *) input clk;
  (* rtl_ctl *) output reg stop, retry;

<p>(* my_fsm *) // attached to the always statement.
always @(posedge clk) begin
...

always // Attribute attached to @(...)
  (* the clock *) @(posedge clk) begin
...

always @(posedge clk)
  (* the block *) begin // Attribute attached to entire block.
...

initial begin
  (* special stuff *) // Attached to the 'if' statement.
  if (this_is_true) $display("hello");
  
  case (my_value)
    (* item1 *) 4'h0, 4'h1 : anout = 2;
    (* item2 *) 4'h2 : anout = 3;
  
    (* ignore *) default $display("bad, bad, bad.");
  endcase
end

<p>(* x_coordinate=1027, y_coordinate=523 *)
acore c1 (
          (* rtl_clk *) .clk(clk),
          ...);

acore c2 ((* ignore *) $time, (* addr=32 *) addr_in);

(* behav *)
reg [31:0] my_big = 2;

(* from_fred *)
localparam thenum = 5;

(* watch_this *)
task automatic send_cmd;
  (* first *)
  input [31:0] address;
  input [4:0] cmd;

  (* ablock *)
  begin
  ...
  end
endtask



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:11 PDT and
sponsored by Boyd Technology, Inc.