Skip to content

Commit 509f1e8

Browse files
committed
Fix Verilog style variable value rendering.
1 parent 71027d2 commit 509f1e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/model/styling.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ export function variableValue(style: DisplayStyle, variable: Variable, value: bi
9191
}
9292

9393
case DisplayStyle.Verilog:
94-
return `${radix}'${value.toString(radix)}`;
94+
switch (radix) {
95+
case 2: return `${variable.width}'b${value.toString(2)}`;
96+
case 8: return `${variable.width}'o${value.toString(8)}`;
97+
case 10: return `${variable.width}'d${value.toString(10)}`;
98+
case 16: return `${variable.width}'h${value.toString(16)}`;
99+
}
95100

96101
case DisplayStyle.VHDL:
97102
switch (radix) {

0 commit comments

Comments
 (0)