1
1
# Verilog Format
2
2
3
- Java console aplication for verilog formatter .
3
+ Console application for apply format to verilog file .
4
4
5
- ![ sample] ( images/verilog-format.gif )
5
+ ![ sample] ( images/verilog-format.gif )
6
6
7
- ## How to use (Linux)
7
+ ## How to use
8
+
9
+ Application options:
10
+
11
+ ```
12
+ usage: [java -jar verilog-format.jar|./verilog-format|verilog-format.exe]
13
+ [-f <pathname>] [-h] [-p] [-s <verilog-format.properties>] [-v]
14
+ -f,--format <pathname> verilog file
15
+ -h,--help print this message
16
+ -p,--print print file formated
17
+ -s,--settings <verilog-format.properties> settings config
18
+ -v,--version verilog-format version
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ ``` sh
24
+ # # Print input_file.v formatted
25
+ $ ./verilog-format -p -f input_file.v -s verilog-format.properties
26
+
27
+ # # Format input_file.v
28
+ $ ./verilog-format -f input_file.v -s verilog-format.properties
29
+
30
+ # # Format input_file.v
31
+ # # If .verilog-format.properties exist in project folder, this is used,
32
+ # # otherwise default setting is used..
33
+ $ ./verilog-format -f input_file.v
34
+
35
+ ```
36
+
37
+ ## Install in Linux
8
38
9
39
1 . Clone repository.
10
40
@@ -28,7 +58,7 @@ Java console aplication for verilog formatter.
28
58
29
59
` $ sudo cp /opt/verilog-format/verilog-format /usr/bin/ `
30
60
31
- ## How to use ( Windows)
61
+ ## Install in Windows
32
62
33
63
1 . Clone repository or download [ verilog-format-WIN.zip] ( bin/verilog-format-WIN.zip )
34
64
@@ -40,4 +70,148 @@ For build de project, Maven is needed.
40
70
41
71
` $ cd verilog-format `
42
72
` $ mvn clean package `
43
- ` $ ls target/ `
73
+ ` $ ls target/ `
74
+
75
+ ## Verilog-Format Style Options
76
+
77
+ This options are setting in ` .verilog-format.properties ` file.
78
+
79
+ ### Example
80
+
81
+ ``` properties
82
+ # # File .verilog-format.properties
83
+ IndentWidth =4
84
+ IndentType =space
85
+ SpacesBeforeTrailingComments =0
86
+ SpacesAfterTrailingComments =0
87
+ AlignLineComments =true
88
+ AlignNoBlockingAssignments =true
89
+ AlignBlockingAssignments =true
90
+ SpacesInParentheses =false
91
+ SpacesInSquareBrackets =false
92
+ ```
93
+
94
+ ---
95
+ ### IndentWidth=[ number]
96
+
97
+ ``` verilog
98
+ // IndentWidth=4 #(default)
99
+ always @(posedge clk)
100
+ if (load == 1)
101
+ bitc <= 0;
102
+ else if (load == 0 && clk_baud == 1)
103
+ bitc <= bitc + 1;
104
+
105
+ // IndentWidth=1
106
+ always @(posedge clk)
107
+ if (load == 1)
108
+ bitc <= 0;
109
+ else if (load == 0 && clk_baud == 1)
110
+ bitc <= bitc + 1;
111
+ ```
112
+ ---
113
+ ### IndentType=[ space|tab]
114
+ ``` verilog
115
+ // IndentType=space #(default)
116
+ always @(posedge clk)
117
+ if (load == 1)
118
+ bitc <= 0;
119
+ else if (load == 0 && clk_baud == 1)
120
+ bitc <= bitc + 1;
121
+
122
+ // IndentType=tab # not recommended yet
123
+ always @(posedge clk)
124
+ <tab>if (load == 1)
125
+ <tab><tab>bitc <= 0;
126
+ <tab>else if (load == 0 && clk_baud == 1)
127
+ <tab><tab>bitc <= bitc + 1;
128
+ ```
129
+ ---
130
+ ### SpacesInParentheses=[ true|false]
131
+ ``` verilog
132
+ // SpacesInParentheses=false #(default)
133
+ always @(posedge clk)
134
+ if (load == 1)
135
+
136
+ // SpacesInParentheses=true
137
+ always @( posedge clk )
138
+ if ( load == 1 )
139
+ ```
140
+ ---
141
+
142
+ ### SpacesInSquareBrackets=[ true|false]
143
+ ``` verilog
144
+ // SpacesInSquareBrackets=false #(default)
145
+ reg [DW-1:0] rom [0:NPOS-1];
146
+
147
+ always @(posedge clk) begin
148
+ data <= rom[addr];
149
+ end
150
+
151
+ // SpacesInSquareBrackets=true
152
+ reg [ DW-1:0 ] rom [ 0:NPOS-1 ];
153
+
154
+ always @(posedge clk) begin
155
+ data <= rom[ addr ];
156
+ ```
157
+ ---
158
+ ### AlignBlockingAssignments=[ true|false]
159
+ ``` verilog
160
+ // AlignBlockingAssignments=true #(default)
161
+ assign load = (state == START) ? 1 : 0;
162
+ assign baud_en = (state == IDLE) ? 0 : 1;
163
+
164
+ // AlignBlockingAssignments=false
165
+ assign load = (state == START) ? 1 : 0;
166
+ assign baud_en = (state == IDLE) ? 0 : 1;
167
+
168
+ ```
169
+ ---
170
+ ### AlignNoBlockingAssignments=[ true|false]
171
+ ``` verilog
172
+ // AlignNoBlockingAssignments=true #(default)
173
+ state_ts <= IDLE;
174
+ state_pad <= IDLE;
175
+ state_wait <= IDLE;
176
+
177
+ // AlignNoBlockingAssignments=false
178
+ state_ts <= IDLE;
179
+ state_pad <= IDLE;
180
+ state_wait <= IDLE;
181
+ ```
182
+ ---
183
+ ### AlignLineComments=[ true|false]
184
+ ``` verilog
185
+ // AlignLineComments=false #(default)
186
+ always @(posedge clk) // always
187
+ if (load == 1) // if
188
+ bitc <= 0; //
189
+ else if (load == 0 && clk_baud == 1) // else if
190
+ bitc <= bitc + 1; //
191
+
192
+ // AlignLineComments=true
193
+ always @(posedge clk) // always
194
+ if (load == 1) // if
195
+ bitc <= 0; //
196
+ else if (load == 0 && clk_baud == 1) // else if
197
+ bitc <= bitc + 1; //
198
+ ```
199
+ ---
200
+ ### SpacesBeforeTrailingComments=[ number]
201
+ ``` verilog
202
+ // SpacesBeforeTrailingComments=1 #(default)
203
+ localparam IDLE = 0; //IDLE
204
+
205
+ // SpacesBeforeTrailingComments=0
206
+ localparam IDLE = 0;//IDLE
207
+ ```
208
+ ---
209
+ ### SpacesAfterTrailingComments=[ number]
210
+ ``` verilog
211
+ // SpacesAfterTrailingComments=0 #(default)
212
+ localparam IDLE = 0; //IDLE
213
+
214
+ // SpacesAfterTrailingComments=3
215
+ localparam IDLE = 0; // IDLE
216
+ ```
217
+ ---
0 commit comments