@@ -132,15 +132,16 @@ def test_reg_to_reg_simulation(self):
132
132
class RenderTraceBase (unittest .TestCase ):
133
133
def setUp (self ):
134
134
pyrtl .reset_working_block ()
135
- a , b = pyrtl .input_list ('a/8 b/8' )
135
+ a , b , c = pyrtl .input_list ('a/8 b/8 c/1 ' )
136
136
o = pyrtl .Output ()
137
- o <<= a + b
137
+ o <<= a + b - c
138
138
139
139
def check_rendered_trace (self , expected , ** kwargs ):
140
140
sim = pyrtl .Simulation ()
141
141
sim .step_multiple ({
142
142
'a' : [1 , 4 , 9 , 11 , 12 ],
143
143
'b' : [2 , 23 , 43 , 120 , 0 ],
144
+ 'c' : [0 , 1 , 1 , 0 , 1 ]
144
145
})
145
146
buff = io .StringIO ()
146
147
sim .tracer .render_trace (file = buff , render_cls = pyrtl .simulation .AsciiWaveRenderer ,
@@ -150,32 +151,36 @@ def check_rendered_trace(self, expected, **kwargs):
150
151
def test_hex_trace (self ):
151
152
expected = (
152
153
" -0 \n "
153
- "a 0x1 x0x4 x0x9 x0xb x0xc \n "
154
- "b 0x2 x0x17 x0x2b x0x78 x0x0 \n "
154
+ "a 0x1 x0x4 x0x9 x0xb x0xc \n "
155
+ "b 0x2 x0x17x0x2bx0x78x0x0 \n "
156
+ "c _____/---------\\ ____/----\n " # escaped backslash
155
157
)
156
158
self .check_rendered_trace (expected )
157
159
158
- def test_hex_trace (self ):
160
+ def test_oct_trace (self ):
159
161
expected = (
160
162
" -0 \n "
161
- "a 0o1 x0o4 x0o11 x0o13 x0o14 \n "
162
- "b 0o2 x0o27 x0o53 x0o170 x0o0 \n "
163
+ "a 0o1 x0o4 x0o11 x0o13 x0o14 \n "
164
+ "b 0o2 x0o27 x0o53 x0o170x0o0 \n "
165
+ "c ______/-----------\\ _____/-----\n " # escaped backslash
163
166
)
164
167
self .check_rendered_trace (expected , repr_func = oct , symbol_len = None )
165
168
166
169
def test_bin_trace (self ):
167
170
expected = (
168
171
" -0 \n "
169
- "a 0b1 x0b100 x0b1001 x0b1011 x0b1100 \n "
170
- "b 0b10 x0b10111 x0b101011 x0b1111000 x0b0 \n "
172
+ "a 0b1 x0b100 x0b1001 x0b1011 x0b1100 \n "
173
+ "b 0b10 x0b10111 x0b101011 x0b1111000x0b0 \n "
174
+ "c __________/-------------------\\ _________/---------\n " # escaped backslash
171
175
)
172
176
self .check_rendered_trace (expected , repr_func = bin , symbol_len = None )
173
177
174
178
def test_decimal_trace (self ):
175
179
expected = (
176
180
" -0 \n "
177
- "a 1 x4 x9 x11 x12 \n "
178
- "b 2 x23 x43 x120 x0 \n "
181
+ "a 1 x4 x9 x11 x12 \n "
182
+ "b 2 x23 x43 x120x0 \n "
183
+ "c ____/-------\\ ___/---\n " # escaped backslash
179
184
)
180
185
self .check_rendered_trace (expected , repr_func = str , symbol_len = None )
181
186
@@ -217,9 +222,9 @@ class Foo(IntEnum):
217
222
extra_line = None , repr_per_name = {'state' : Foo }, symbol_len = None )
218
223
expected = (
219
224
" -0 \n "
220
- " i 0x1 x0x2 x0x4 x0x8 x0x0 \n "
221
- " o 0x0 x0x1 x0x2 x0x3 \n "
222
- "state Foo.A xFoo.B xFoo.C xFoo.D \n "
225
+ " i 0x1 x0x2 x0x4 x0x8 x0x0 \n "
226
+ " o 0x0 x0x1 x0x2 x0x3 \n "
227
+ "state Foo.A xFoo.BxFoo.CxFoo.D \n "
223
228
)
224
229
self .assertEqual (buff .getvalue (), expected )
225
230
0 commit comments