[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  Schedule::Load
  SVN::S4
  Synopsys-modes
  SystemPerl
  Verilog-Pli
  Voneline
  Vregs
General Info
  Papers

control module port list indentation?

Added by David Rogoff 3 months ago

I'm trying to clean up all my indentation settings but can't find any varibles for these:

module top
  (   // what controls the indentation of the opening paren?

   // everything else appears to always be indented one more than the paren. Can I control this?
   input a,
   ...

Thanks!


Replies (4)

RE: control module port list indentation? - Added by Wilson Snyder 3 months ago

I don't think there's a setting for that, but I don't know for sure.

code folding / RE: control module port list indentation? - Added by David Rogoff 3 months ago

Can you point me to where this is done in the code so I can try modifying it?

This is all connected with the code folding I've been working on. It's almost there and it's great. I'm using outline-minor-mode. I just add stars to comments to mark them as headlines:

// * Module header
module top
   (
    // * Port list

    // ** inputs
    input a,
    input b, 

    // ** outputs
    output logic a1,
    output logic b1
   );

// * signal declarations

     etc

This let's me collapse parts I don't care about at the moment. It's great on huge files or collapsing the insides of each state of an FSM to see the big picture.

This brings up a philosophical issue: What should the levels be?

outline-mode (and org-mode) normally expect all headlines (and therefore the stars) to start in column zero. Right away, we need to subtract 3 for "// " - comment-start. No problem yet. However, verilog-mode indents comments to match the rest of the code. I think this is good and will automatically increase the headline depth, which is handy. However, this raises a problem and a question: The problem is to know what the indent level is in the code. That's why I put in this post in the first place. I set all my indent variables to '2'. Then, I can just count the number of leading spaces on the line and divide by verilog-indent-level. The problem is that I can't set the indentation for the port list.

The philosophical question is how much is a code-indent worth? In my code example, the module header is level 1. Should the port list be level 2? I manually add more stars to force the inputs and outputs to be a lower level than the port list. Should they be level 3? The catch is, what if I'm back at column zero and manually add a second star for a virtual sub section that's not indented by verilog-mode. Should that be equivalent to the port list? Should code indents count more? Does any of this matter :)

Thanks for any pointers to modify the code or useful functions I could look at.

David

RE: control module port list indentation? - Added by Wilson Snyder 3 months ago

Sorry, I've happily left the indent stuff to Mac. You'll need to poke around to find it.

Perhaps I'm missing something, but from your description I don't think the outline stars really need to have a fixed location, or maybe I misunderstood. Why can't outline-regexp match " // *[\]+" i.e. arbitrary spaces, then look for stars. You'd then define a outline-level function that counts only the stars.

There's also some neat examples described in outline-heading-alist that suggests you could autobuild levels at "module", "function" etc.

RE: control module port list indentation? - Added by David Rogoff 3 months ago

Wilson, I have hacked together some defuns that just count the number of stars. What I was trying to do was also use the verilog-mode's indentation as input to the outline-level for some automatic creation of sublevels as opposed to the coder having to manually control all the sublevels with number of stars. I'll have to check out the outline-heading-alist to see if I can use this as you suggest.

(1-4/4)