Tabs in Verilog emission
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Verilog emitter uses tabs in some places to align comments. Example
In port list:

In assign statements:

Tab size/behavior heavily depend on the editor / viewer and in general don't guaranty alignment.
We use spaces for indentation and alignment in most of the cases.
Using tabs in just one particular case and in the in the middle of the line complicates handling of the code.
How to reproduce
The following FIRRTL program
circuit top_mod:
module top_mod:
input a: UInt<42>
output b: UInt
output bb: UInt
output bbb: UInt
output bbbb: UInt
b <= tail(a, 40)
bb <= tail(a, 3)
bbb <= tail(a, 2)
bbbb <= tail(a, 1)
Compiled with firtool --lower-to-hw --infer-widths --imconstprop --lowering-options=disallowPackedArrays,emittedLineLength=8192 --mlir-timing --verilog -o=$VFILE2 produces this code:
module top_mod( // a_top_mod.fir:2:10
input [41:0] a,
output [1:0] b,
output [38:0] bb,
output [39:0] bbb,
output [40:0] bbbb);
assign b = a[1:0]; // a_top_mod.fir:2:10, :8:10
assign bb = a[38:0]; // a_top_mod.fir:2:10, :9:11
assign bbb = a[39:0]; // a_top_mod.fir:2:10, :10:12
assign bbbb = a[40:0]; // a_top_mod.fir:2:10, :11:13
endmodule
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the firtool Verilog emission path responsible for port-list and assign-statement comments, using the reproducer and generated Verilog in this issue. Verify the output with the supplied FIRRTL program and confirm that tabs are removed while comment alignment remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100