@@ -23,8 +23,6 @@ def __init__(self, name, cond, flags):
23
23
self .prefix = ''
24
24
self .multiple = False
25
25
self .multiple_first_op_index = - 1
26
- self .num_cycles = 0
27
- self .num_steps = 0
28
26
self .step_index = - 1
29
27
self .extra_step_index = - 1
30
28
self .mcycles = []
@@ -263,13 +261,6 @@ def expand_optable():
263
261
op_index += 1 ; stampout_op ('' , - 1 , op_index , find_opdesc ('int_im2' ))
264
262
op_index += 1 ; stampout_op ('' , - 1 , op_index , find_opdesc ('nmi' ))
265
263
266
- # compute number of tcycles in an instruction
267
- def compute_tcycles (op ):
268
- cycles = 0
269
- for mcycle in op .mcycles :
270
- cycles += mcycle .tcycles
271
- return cycles
272
-
273
264
# generate code for one op
274
265
def gen_decoder ():
275
266
indent = 2
@@ -298,40 +289,39 @@ def add(action):
298
289
if flag (op , 'redundant' ):
299
290
next_step = OPS [op .multiple_first_op_index ].extra_step_index
300
291
action = action .replace ("$NEXTSTEP" , f'{ next_step } ' )
301
- l (f'case { cur_step :4} : { action } _goto({ next_step } ); // { op .name } T: { op_step } ' )
292
+ l (f'case { cur_step :4} : { action } _goto({ next_step } ); // { op .name } ( { op_step } ) ' )
302
293
cur_step += 1
303
294
else :
304
295
# do not write a payload for redundant ops
305
296
if not flag (op , 'redundant' ):
306
297
next_step = cur_extra_step + 1
307
298
action = action .replace ("$NEXTSTEP" , f'{ next_step } ' )
308
- lx (f'case { cur_extra_step :4} : { action } _goto({ next_step } ); // { op .name } T: { op_step } ' )
299
+ lx (f'case { cur_extra_step :4} : { action } _goto({ next_step } ); // { op .name } ( { op_step } ) ' )
309
300
cur_extra_step += 1
310
301
op_step += 1
311
302
312
303
def add_fetch (action ):
313
304
nonlocal cur_step , cur_extra_step , op_step , op
314
305
if op_step == 0 and not flag (op , 'special' ):
315
- l (f'case { cur_step :4} : { action } _fetch(); // { op .name } T: { op_step } ' )
306
+ l (f'case { cur_step :4} : { action } _fetch(); // { op .name } ( { op_step } ) ' )
316
307
cur_step += 1
317
308
else :
318
- lx (f'case { cur_extra_step :4} : { action } _fetch(); // { op .name } T: { op_step } ' )
309
+ lx (f'case { cur_extra_step :4} : { action } _fetch(); // { op .name } ( { op_step } ) ' )
319
310
cur_extra_step += 1
320
311
op_step += 1
321
312
322
313
def add_stepto (action ):
323
314
nonlocal cur_step , cur_extra_step , op_step , op
324
315
if op_step == 0 :
325
- l (f'case { cur_step :4} : { action } goto step_to; // { op .name } T: { op_step } ' )
316
+ l (f'case { cur_step :4} : { action } goto step_to; // { op .name } ( { op_step } ) ' )
326
317
cur_step += 1
327
318
else :
328
- lx (f'case { cur_extra_step :4} : { action } goto step_to; // { op .name } T: { op_step } ' )
319
+ lx (f'case { cur_extra_step :4} : { action } goto step_to; // { op .name } ( { op_step } ) ' )
329
320
cur_extra_step += 1
330
321
op_step += 1
331
322
332
323
for op in OPS :
333
324
op_step = 0
334
- op .num_cycles = compute_tcycles (op )
335
325
op .step_index = cur_step
336
326
op .extra_step_index = cur_extra_step
337
327
@@ -341,7 +331,7 @@ def add_stepto(action):
341
331
pass
342
332
elif mcycle .type == 'mread' :
343
333
addr = mcycle .items ['ab' ]
344
- store = mcycle .items ['dst' ]. replace ( '_X_' , '_gd()' )
334
+ store = mcycle .items ['dst' ]
345
335
add ('' )
346
336
add (f'_wait();_mread({ addr } );' )
347
337
add (f'{ store } =_gd();{ action } ' )
@@ -357,7 +347,7 @@ def add_stepto(action):
357
347
add ('' )
358
348
elif mcycle .type == 'ioread' :
359
349
addr = mcycle .items ['ab' ]
360
- store = mcycle .items ['dst' ]. replace ( '_X_' , '_gd()' )
350
+ store = mcycle .items ['dst' ]
361
351
add ('' )
362
352
add ('' )
363
353
add (f'_wait();_ioread({ addr } );' )
@@ -390,7 +380,6 @@ def add_stepto(action):
390
380
else :
391
381
# regular case, jump to the shared fetch block after the
392
382
add_fetch (f'{ action } ' )
393
- op .num_steps = op_step
394
383
return { 'out_lines' : out_lines + out_extra_lines , 'max_step' : cur_extra_step }
395
384
396
385
def extra_step_defines_string (max_step ):
0 commit comments