Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: AUTOINST with naming convention that indicates input or output signals #346

Closed
veripoolbot opened this issue May 10, 2011 · 1 comment
Labels

Comments

@veripoolbot
Copy link
Collaborator


Author Name: Wilson Snyder (@wsnyder)
Original Redmine Message: 516 from https://www.veripool.org


Jacky Ma asked how to support naming conventions that add i_ for inputs of a block, and o_ for outputs of a block when using AUTOINST. The problem is that a signal name may need to change when the submodule's inputs are no longer inputs/outputs on the upper level.

Here's an example

module test (
    // Ports for module A
    input  i_A_outsidei,
    output o_A_outsideo,

    // Ports for module B
    input  i_B_outsidei,
    output o_B_outsideo );

    /*AUTOWIRE*/
 
    moduleA u0(
      /*AUTOINST*/
        // Note o_ and i_ added or stripped
               // Outputs
               .o_A_outsideo             (o_A_outsideo),
               .o_A_internal             (A_internal),
               // Inputs
               .i_A_outsidei             (i_A_outsidei),
               .i_B_internal             (B_internal));

    moduleB u1(
        /*AUTOINST*/
        // Note o_ and i_ added or stripped
              // Outputs
              .o_B_outsideo              (o_B_outsideo),
              .o_B_internal              (B_internal),
              // Inputs
              .i_B_outsidei              (i_B_outsidei),
              .i_A_internal              (A_internal));

endmodule

module moduleA (
     input  i_A_outsidei,
     output o_A_outsideo,

     input  i_B_internal,
     output o_A_internal
  );
  /*AUTOTIEOFF*/
endmodule

module moduleB (
     input  i_B_outsidei,
     output o_B_outsideo,

     input  i_A_internal,
     output o_B_internal
  );
  /*AUTOTIEOFF*/
endmodule

@veripoolbot
Copy link
Collaborator Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2011-05-10T06:38:19Z


First, I'd suggest that naming conventions that change the signal name as it crosses the hiearchy aren't recommended. This convention is also going to cause great difficulty when moving towards SystemVerilog interfaces.

That out of the way, make a special function in your site's .emacs file as follows:

  (defun vl-site-i-o (basename)
         (cond ((assoc (concat "i_" basename)
                       (verilog-decls-get-inputs moddecls))
                "i_")
               ((assoc (concat "o_" basename)
                       (verilog-decls-get-outputs moddecls))
                "o_")
               ((assoc (concat "t_" basename)
                       (verilog-decls-get-inouts moddecls))
                "t_")
               (t "")))

Then call it in a template on the base signal name with i_ and o_ stripped:

    /* moduleA AUTO_TEMPLATE (
        .[iot]_\(.*\)    (@"(vl-site-i-o \\"\1\\")"\1[]),
      ); */

Also note Verilog-mode computes AUTOINPUT and AUTOOUTPUT after the submodule pins, so AUTOINPUT/AUTOOUTPUT won't work with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant