OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [tools/] [PythonAssembler/] [patlpp.py] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
# PATLPP assembler functions
2
 
3
pc = 0
4
 
5
def INITCODE():
6
        pc = 0
7
        print '''
8
module microcodesrc
9
(
10
        input           wire    [8:0]           addr,
11
        output  reg     [66:0]  code
12
);
13
 
14
always @(addr)
15
begin
16
        case (addr)
17
 
18
                // code: {               <jmp,rst>
19
                //                                       |      <in_rdy,out_rdy,aeof,asof>
20
                //                                       |      |        <predmode>
21
                //                                       |      |        |     <pred: fcs,eof,sof,equ,dst,src>
22
                //                                       |      |        |     |          <High Byte Reg En>
23
                //                                       |      |        |     |          |     <Output Byte Select>
24
                //                                       |      |        |     |          |     |     <Outport_reg_en, Inport_eg_en>
25
                //                                       |      |        |     |          |     |     |      <Data Mux Select>
26
                //                                       |      |        |     |          |     |     |      |     <Op 0 Select>
27
                //                                       |      |        |     |          |     |     |      |     |     <Op 1 Select>
28
                //                                       |      |        |     |          |     |     |      |     |     |     <Register Address>
29
                //                                       |      |        |     |          |     |     |      |     |     |     |       <Register Write Enables>
30
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     <FCS Add, FCS Clear>
31
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      <sr1ie,sr2ie,sr1oe,sr2oe>
32
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      |        <Flag Register>
33
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      |        |     <Compare Mode>
34
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      |        |     |     <ALU Op>
35
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      |        |     |     |     <Byte Constant>
36
                //                                       |      |        |     |          |     |     |      |     |     |     |       |     |      |        |     |     |     |       <Word Constant> }'''
37
 
38
def ENDCODE():
39
        print '''
40
        default: code <= 0;
41
        endcase
42
 
43
end
44
endmodule'''
45
 
46
def IN(dest, cond=None, flags=None):
47
        global pc
48
        "Input data from a port into the processor"
49
        if flags == None:
50
                flagss = "None"
51
        elif not isinstance(flags, list):
52
                flagss = str(flags)
53
        else:
54
                flagss = "[" + ", ".join(map(str, flags)) + "]"
55
        inst = Instruction("IN(" + str(dest) + ", Cond=" + str(cond) + ", Flags=" + flagss + ")")
56
        # Source Processing
57
        inst.data_mux_s = 3
58
        inst.input_rdy = True
59
        # Predicate Mode Processing
60
        if (cond == None):
61
                inst.pred_mode = 0
62
        elif (isinstance(cond, WHEN)):
63
                inst.pred_mode = 0
64
        elif (isinstance(cond, UNTIL)):
65
                inst.pred_mode = 1
66
        elif (isinstance(cond, IF)):
67
                inst.pred_mode = 2
68
        # Predicates
69
        inst.pred_src = True
70
        inst.processCond(cond)
71
        inst.processFlags(flags)
72
        # Destination Processing
73
        if isinstance(dest, R):
74
                inst.reg_addr = dest.address
75
                inst.reg_wen = 0
76
                if dest.low: inst.reg_wen += 1
77
                if dest.high: inst.reg_wen += 2
78
        elif isinstance(dest, SR):
79
                if dest.sr_num == 1: inst.sr1_in_en = True
80
                elif dest.sr_num == 2: inst.sr2_in_en = True
81
        elif isinstance(dest, HBR):
82
                inst.highbyte_reg_en = True
83
        elif isinstance(dest, OPR):
84
                inst.outport_reg_en = True
85
        else:
86
                print("Bad Destination")
87
                return 0;
88
        print inst
89
        pc += 1
90
 
91
def OUT(source, cond=None, flags=None):
92
        global pc
93
        if flags == None:
94
                flagss = "None"
95
        elif not isinstance(flags, list):
96
                flagss = str(flags)
97
        else:
98
                flagss = "[" + ", ".join(map(str, flags)) + "]"
99
        inst = Instruction("OUT(" + str(source) + ", Cond=" + str(cond) + ", Flags=" + flagss + ")")
100
        # Destination Processing
101
        inst.output_byte_s = 0
102
        inst.output_rdy = True
103
        # Predicate Mode Processing
104
        if (cond == None):
105
                inst.pred_mode = 0
106
        elif (isinstance(cond, WHEN)):
107
                inst.pred_mode = 0
108
        elif (isinstance(cond, UNTIL)):
109
                inst.pred_mode = 1
110
        elif (isinstance(cond, IF)):
111
                inst.pred_mode = 2
112
        # Predicates
113
        inst.pred_dst = True
114
        inst.processCond(cond)
115
        inst.processFlags(flags)
116
        # Source Processing
117
        if isinstance(source, C):
118
                inst.data_mux_s = 0
119
                inst.const_word = source.value
120
        elif isinstance(source, CS):
121
                inst.data_mux_s = 1
122
                if source.high_byte_s:
123
                        inst.output_byte_s = 1
124
        elif isinstance(source, R):
125
                inst.data_mux_s = 2
126
                inst.reg_addr = source.address
127
                if source.high_byte_s:
128
                        inst.output_byte_s = 1
129
        elif isinstance(source, SR):
130
                inst.data_mux_s = 4
131
                if source.sr_num == 1:
132
                        inst.sr1_out_en = True
133
                if source.sr_num == 2:
134
                        inst.sr2_out_en = True
135
        print inst
136
        pc += 1
137
 
138
def BYP(cond=None, flags=None):
139
        global pc
140
        if flags == None:
141
                flagss = "None"
142
        elif not isinstance(flags, list):
143
                flagss = str(flags)
144
        else:
145
                flagss = "[" + ", ".join(map(str, flags)) + "]"
146
        inst = Instruction("BYP(Cond=" + str(cond) + ", Flags=" + flagss + ")")
147
        inst.output_rdy = True
148
        inst.input_rdy = True
149
        inst.data_mux_s = 3
150
        # Predicate Mode Processing
151
        if (cond == None):
152
                inst.pred_mode = 0
153
        elif (isinstance(cond, WHEN)):
154
                inst.pred_mode = 0
155
        elif (isinstance(cond, UNTIL)):
156
                inst.pred_mode = 1
157
        elif (isinstance(cond, IF)):
158
                inst.pred_mode = 2
159
        inst.pred_src = True
160
        inst.pred_dst = True
161
        # Predicates
162
        inst.processCond(cond)
163
        inst.processFlags(flags)
164
        print inst
165
        pc += 1
166
 
167
def CSA(source):
168
        global pc
169
        inst = Instruction("CSA(" + str(source) + ")") # + ", Cond=" + str(cond) + ", Flags=" + str((flags.count > 0)) + ")")
170
        inst.fcs_add = True
171
        if isinstance(source, C):
172
                inst.data_mux_s = 0
173
                inst.const_word = source.value
174
        elif isinstance(source, CS):
175
                inst.data_mux_s = 1
176
                if source.high_byte_s:
177
                        inst.output_byte_s = 1
178
        elif isinstance(source, R):
179
                inst.data_mux_s = 2
180
                inst.reg_addr = source.address
181
        elif isinstance(source, P):
182
                inst.data_mux_s = 3
183
                inst.input_rdy = True
184
                inst.pred_mode = 0
185
                inst.pred_src = True
186
                if isinstance(source.address, int):
187
                        inst.const_byte = dest.address
188
                        inst.pa_s = 0
189
                elif isinstance(source.address, R):
190
                        inst.pa_s = 1
191
                        inst.reg_addr = source.address.address
192
                else:
193
                        print "Bad Source"
194
                        return 0
195
        elif isinstance(source, SR):
196
                inst.data_mux_s = 4
197
                if source.sr_num == 1:
198
                        inst.sr1_out_en = True
199
                if source.sr_num == 2:
200
                        inst.sr2_out_en = True
201
        print inst
202
        pc += 1
203
 
204
def CSC():
205
        global pc
206
        inst = Instruction("CSC()")
207
        inst.fcs_clr = True
208
        print inst
209
        pc += 1
210
 
211
def JMP(loc, cond=None, flags=None):
212
        global pc
213
        if flags == None:
214
                flagss = "None"
215
        elif not isinstance(flags, list):
216
                flagss = str(flags)
217
        else:
218
                flagss = "[" + ", ".join(map(str, flags)) + "]"
219
        inst = Instruction("JMP(" + str(loc) + ", Cond=" + str(cond) + ", Flags=" + flagss + ")")
220
        if not isinstance(loc, int):
221
                if loc not in globals().keys():
222
                        print("Bad Location")
223
                        print "Loc: ", loc, ", globals().items(): ", globals().items()
224
                        return 0
225
                loc = globals[loc]
226
        inst.const_byte = loc
227
        inst.jump = True
228
        # Predicate Mode Processing
229
        if (cond == None):
230
                inst.pred_mode = 0
231
        elif (isinstance(cond, WHEN)):
232
                inst.pred_mode = 0
233
        elif (isinstance(cond, UNTIL)):
234
                inst.pred_mode = 1
235
        elif (isinstance(cond, IF)):
236
                inst.pred_mode = 2
237
        # Predicates
238
        inst.processCond(cond)
239
        inst.processFlags(flags)
240
        print inst
241
        pc += 1
242
 
243
def RST(cond=None, flags=None):
244
        global pc
245
        if flags == None:
246
                flagss = "None"
247
        elif not isinstance(flags, list):
248
                flagss = str(flags)
249
        else:
250
                flagss = "[" + ", ".join(map(str, flags)) + "]"
251
        inst = Instruction("RST(Cond=" + str(cond) + ", Flags=" + flagss + ")")
252
        inst.reset = True
253
        if (cond == None):
254
                inst.pred_mode = 0
255
        elif (isinstance(cond, WHEN)):
256
                inst.pred_mode = 0
257
        elif (isinstance(cond, UNTIL)):
258
                inst.pred_mode = 1
259
        elif (isinstance(cond, IF)):
260
                inst.pred_mode = 2
261
        # Predicates
262
        inst.processCond(cond)
263
        inst.processFlags(flags)
264
        print inst
265
        pc += 1
266
 
267
def ADD(op0, op1, dest, cond=None, flags=None):
268
        global pc
269
        if flags == None:
270
                flagss = "None"
271
        elif not isinstance(flags, list):
272
                flagss = str(flags)
273
        else:
274
                flagss = "[" + ", ".join(map(str, flags)) + "]"
275
        inst = Instruction("ADD(" + str(op0) + ", " + str(op1) + ", " + str(dest) + ", Cond=" + str(cond) + "Flags=" + flagss + ")")
276
        inst.alu_op = 0
277
        inst.data_mux_s = 5
278
        # Source 0 Processing
279
        if isinstance(op0, C):
280
                inst.op0_mux_s = 0
281
                inst.const_word = op0.value
282
        elif isinstance(op0, P):
283
                inst.op0_mux_s = 1
284
                inst.const_byte = op0.address
285
        elif isinstance(op0, FR):
286
                inst.op0_mux_s = 2
287
        elif isinstance(op0, R):
288
                inst.op0_mux_s = 3
289
                inst.reg_addr = op0.address
290
        # Source 1 Processing
291
        if isinstance(op1, C):
292
                inst.op1_mux_s = 0
293
                inst.const_word = op1.value
294
        elif isinstance(op1, R):
295
                inst.op1_mux_s = 1
296
                inst.reg_addr = op1.address
297
        # Destination Processing
298
        if isinstance(dest, R):
299
                inst.reg_addr = dest.address
300
                inst.reg_wen = 0
301
                if dest.low: inst.reg_wen += 1
302
                if dest.high: inst.reg_wen += 2
303
        elif isinstance(dest, SR):
304
                if dest.sr_num == 1: inst.sr1_in_en = True
305
                elif dest.sr_num == 2: inst.sr2_in_en = True
306
        else:
307
                print("Bad Destination")
308
                return 0;
309
        # Predicates
310
        inst.processCond(cond)
311
        inst.processFlags(flags)
312
        print inst
313
        pc += 1
314
 
315
def SUB(op0, op1, dest, cond=None, flags=None):
316
        global pc
317
        if flags == None:
318
                flagss = "None"
319
        elif not isinstance(flags, list):
320
                flagss = str(flags)
321
        else:
322
                flagss = "[" + ", ".join(map(str, flags)) + "]"
323
        inst = Instruction("SUB(" + str(op0) + ", " + str(op1) + ", " + str(dest) + ", Cond=" + str(cond) + "Flags=" + flagss + ")")
324
        inst.alu_op = 1
325
        inst.data_mux_s = 5
326
        # Source 0 Processing
327
        if isinstance(op0, C):
328
                inst.op0_mux_s = 0
329
                inst.const_word = op0.value
330
        elif isinstance(op0, P):
331
                inst.op0_mux_s = 1
332
                inst.const_byte = op0.address
333
        elif isinstance(op0, FR):
334
                inst.op0_mux_s = 2
335
        elif isinstance(op0, R):
336
                inst.op0_mux_s = 3
337
                inst.reg_addr = op0.address
338
        # Source 1 Processing
339
        if isinstance(op1, C):
340
                inst.op1_mux_s = 0
341
                inst.const_word = op1.value
342
        elif isinstance(op1, R):
343
                inst.op1_mux_s = 1
344
                inst.reg_addr = op1.address
345
        # Destination Processing
346
        if isinstance(dest, R):
347
                inst.reg_addr = dest.address
348
                inst.reg_wen = 0
349
                if dest.low: inst.reg_wen += 1
350
                if dest.high: inst.reg_wen += 2
351
        elif isinstance(dest, SR):
352
                if dest.sr_num == 1: inst.sr1_in_en = True
353
                elif dest.sr_num == 2: inst.sr2_in_en = True
354
        else:
355
                print("Bad Destination")
356
                return 0;
357
        # Predicates
358
        inst.processCond(cond)
359
        inst.processFlags(flags)
360
        print inst
361
        pc += 1
362
 
363
def MOV(source, dest, cond=None, flags=None):
364
        global pc
365
        if flags == None:
366
                flagss = "None"
367
        elif not isinstance(flags, list):
368
                flagss = str(flags)
369
        else:
370
                flagss = "[" + ", ".join(map(str, flags)) + "]"
371
        inst = Instruction("MOV(" + str(source) + "," + str(dest) + ", Cond=" + str(cond) + ", Flags=" + flagss + ")")
372
        # Source Processing
373
        if isinstance(source, C):
374
                inst.data_mux_s = 0
375
                inst.const_word = source.value
376
        elif isinstance(source, CS):
377
                inst.data_mux_s = 1
378
        elif isinstance(source, R):
379
                inst.data_mux_s = 2
380
                inst.reg_addr = source.address
381
        elif isinstance(source, SR):
382
                inst.data_mux_s = 4
383
                if source.sr_num == 1:
384
                        inst.sr1_out_en = True
385
                if source.sr_num == 2:
386
                        inst.sr2_out_en = True
387
        elif isinstance(source, FR):
388
                inst.data_mux_s = 6
389
        # Destination Processing
390
        if isinstance(dest, R):
391
                inst.reg_addr = dest.address
392
                inst.reg_wen = 0
393
                if dest.low: inst.reg_wen += 1
394
                if dest.high: inst.reg_wen += 2
395
        elif isinstance(dest, SR):
396
                if dest.sr_num == 1: inst.sr1_in_en = True
397
                elif dest.sr_num == 2: inst.sr2_in_en = True
398
        elif isinstance(dest, OPR):
399
                inst.outport_reg_en = True
400
        elif isinstance(dest, IPR):
401
                inst.inport_reg_en = True
402
        else:
403
                print("Bad Destination")
404
                return 0;
405
        # Predicates
406
        inst.processCond(cond)
407
        inst.processFlags(flags)
408
        print inst
409
        pc += 1
410
 
411
def LAB(label):
412
        return
413
 
414
def MAN(inst):
415
        global pc
416
        print inst
417
        pc += 1
418
 
419
class AEOF:
420
        def __str__(self): return "<AEOF>"
421
 
422
class ASOF:
423
        def __str__(self): return "<ASOF>"
424
 
425
class EOF:
426
        def __str__(self): return "<EOF>"
427
 
428
class SOF:
429
        def __str__(self): return "<SOF>"
430
 
431
class EQU:
432
        op0 = None
433
        op1 = None
434
        bytewide = False
435
 
436
        def __init__(self, op0, op1, bytewide=False):
437
                self.op0 = op0
438
                self.op1 = op1
439
                self.bytewide = bytewide
440
 
441
        def __str__(self): return "<" + str(self.op0) + "==" + str(self.op1) + ", Bytewide: " + str(self.bytewide) + ">"
442
 
443
class NEQ:
444
        op0 = None
445
        op1 = None
446
        bytewide = False
447
 
448
        def __init__(self, op0, op1, bytewide=False):
449
                self.op0 = op0
450
                self.op1 = op1
451
                self.bytewide = bytewide
452
 
453
        def __str__(self): return "<" + str(self.op0) + "!=" + str(self.op1) + ", Bytewide: " + str(self.bytewide) + ">"
454
 
455
class DST:
456
        def __str__(self): return "DST"
457
 
458
class SRC:
459
        def __str__(self): return "SRC"
460
 
461
class FCS:
462
        def __str__(self): return "FCS"
463
 
464
class IF:
465
        preds = None
466
 
467
        def __init__(self, preds=None):
468
                self.preds = preds
469
 
470
        def __str__(self):
471
                if self.preds == None:
472
                        preds = "None"
473
                elif not isinstance(self.preds, list):
474
                        preds = str(self.preds)
475
                else:
476
                        preds = ", ".join(map(str, self.preds))
477
                return "<IF: pred=[" + preds + "]>"
478
 
479
class WHEN:
480
        preds = None
481
 
482
        def __init__(self, preds=None):
483
                self.preds = preds
484
 
485
        def __str__(self):
486
                if self.preds == None:
487
                        preds = "None"
488
                elif not isinstance(self.preds, list):
489
                        preds = str(self.preds)
490
                else:
491
                        preds = ", ".join(map(str, self.preds))
492
                return "<WHEN: pred=[" + preds + "]>"
493
 
494
class UNTIL:
495
        preds = None
496
 
497
        def __init__(self, preds=None):
498
                self.preds = preds
499
 
500
        def __str__(self):
501
                if self.preds == None:
502
                        preds = "None"
503
                elif not isinstance(self.preds, list):
504
                        preds = str(self.preds)
505
                else:
506
                        preds = ", ".join(map(str, self.preds))
507
                return "<UNTIL: pred=[" + preds + "]>"
508
 
509
class P:
510
 
511
        def __str__(self):
512
                return "<Port>"
513
 
514
class R:
515
        address = 0
516
        high = True
517
        low = True
518
        high_byte_s = False
519
 
520
        def __init__(self, addr, high=True, low=True, hbs=False):
521
                self.address = addr
522
                self.high = high
523
                self.low = low
524
                self.high_byte_s = hbs
525
 
526
        def __str__(self):
527
                return "<Register: address=%d, high=%s, low=%s, high_byte_s=%s>" % (self.address, self.high, self.low, self.high_byte_s)
528
 
529
class C:
530
        value = 0
531
 
532
        def __init__(self, value):
533
                self.value = value
534
 
535
        def __str__(self):
536
                return "<Constant: value=%d>" % self.value
537
 
538
class SR:
539
        sr_num = 1
540
 
541
        def __init__(self, sr_num):
542
                self.sr_num = sr_num
543
 
544
        def __str__(self):
545
                return "<Shif Register: sr_num=%d>" % self.sr_num
546
 
547
class CS:
548
        high_byte_s = False
549
 
550
        def __init__(self, hbs=False):
551
                self.high_byte_s = hbs
552
 
553
        def __str__(self):
554
                return "<Checksum: high_byte_s=%s>" % (self.high_byte_s)
555
 
556
class FR:
557
 
558
        def __str__(self):
559
                return "<Flag Register>"
560
 
561
class HBR:
562
 
563
        def __str__(self):
564
                return "<High Byte Register>"
565
 
566
class OPR:
567
 
568
        def __str__(self):
569
                return "<Output Port Register>"
570
 
571
class IPR:
572
 
573
        def __str__(self):
574
                return "<Input Port Register>"
575
 
576
class Instruction:
577
        jump = False
578
        reset = False
579
 
580
        input_rdy = False
581
        output_rdy = False
582
        sof_out = False
583
        eof_out = False
584
 
585
        pred_mode = 0 # 0: when, 1: until, 2: if
586
        pred_fcs = False
587
        pred_eof = False
588
        pred_sof = False
589
        pred_cmp = False
590
        pred_dst = False
591
        pred_src = False
592
 
593
        highbyte_reg_en = False
594
        output_byte_s = 0
595
 
596
        outport_reg_en = 0
597
        inport_reg_en = 0
598
 
599
        data_mux_s = 0
600
        op0_mux_s = 0
601
        op1_mux_s = 0
602
 
603
        reg_addr = 0
604
        reg_wen = 0
605
 
606
        fcs_add = False
607
        fcs_clr = False
608
 
609
        sr1_in_en = False
610
        sr2_in_en = False
611
        sr1_out_en = False
612
        sr2_out_en = False
613
 
614
        flag_reg_en = False
615
 
616
        comp_mode = 0
617
 
618
        alu_op = 0
619
 
620
        const_byte = 0
621
        const_word = 0
622
 
623
        loc = ""
624
 
625
        def __init__(self, loc):
626
                self.loc = loc
627
 
628
        def __str__(self):
629
                ret = "\t\t%03d:\t\t\tcode <= {" % pc
630
                ret += "2'b%1d%1d, " % (self.jump, self.reset)
631
                ret += "4'b%1d%1d%1d%1d, " % (self.input_rdy, self.output_rdy, self.sof_out, self.eof_out)
632
                ret += "2'd%1d, " % self.pred_mode
633
                ret += "6'b%1d%1d%1d%1d%1d%1d, " % (self.pred_fcs, self.pred_eof, self.pred_sof, self.pred_cmp, self.pred_dst, self.pred_src)
634
                ret += "1'b%1d, " % self.highbyte_reg_en
635
                ret += "1'd%1d, " % self.output_byte_s
636
                ret += "2'b%1d%1d, " % (self.outport_reg_en, self.inport_reg_en)
637
                ret += "3'd%1d, " % self.data_mux_s
638
                ret += "2'd%1d, " % self.op0_mux_s
639
                ret += "1'd%1d, " % self.op1_mux_s
640
                ret += "4'd%02d, " % self.reg_addr
641
                ret += "2'd%1d, " % self.reg_wen
642
                ret += "2'b%1d%1d, " % (self.fcs_add, self.fcs_clr)
643
                ret += "4'b%1d%1d%1d%1d, " % (self.sr1_in_en, self.sr2_in_en, self.sr1_out_en, self.sr2_out_en)
644
                ret += "1'b%1d, " % self.flag_reg_en
645
                ret += "3'd%1d, " % self.comp_mode
646
                ret += "2'd%1d, " % self.alu_op
647
                ret += "9'd%03d, " % self.const_byte
648
                ret += "16'd%05d" % self.const_word
649
                ret += "}; // %s" % self.loc
650
 
651
                return ret
652
 
653
        def processCond(inst, cond):
654
                if (cond != None):
655
                        if (cond.preds == None): preds = []
656
                        elif not isinstance(cond.preds, list): preds = [cond.preds]
657
                        else: preds = cond.preds
658
                        for pred in preds:
659
                                if (isinstance(pred, EOF)):
660
                                        inst.pred_eof = True
661
                                elif (isinstance(pred, SOF)):
662
                                        inst.pred_sof = True
663
                                elif (isinstance(pred, EQU)):
664
                                        inst.pred_cmp = True
665
                                        inst.alu_op = 1
666
                                        if (pred.bytewide):
667
                                                inst.comp_mode += 4
668
                                        if (isinstance(pred.op0,C)):
669
                                                inst.op0_mux_s = 0
670
                                                inst.const_word = pred.op0.value
671
                                        elif (isinstance(pred.op0,P)):
672
                                                inst.op0_mux_s = 1
673
                                        elif (isinstance(pred.op0,FR)):
674
                                                inst.op0_mux_s = 2
675
                                        elif (isinstance(pred.op0,R)):
676
                                                inst.op0_mux_s = 3
677
                                                inst.reg_addr = pred.op0.address
678
                                        if (isinstance(pred.op1,C)):
679
                                                inst.op1_mux_s = 0
680
                                                inst.const_word = pred.op1.value
681
                                        elif (isinstance(pred.op1,R)):
682
                                                inst.op1_mux_s = 1
683
                                                inst.reg_addr = pred.op1.address
684
                                elif (isinstance(pred, NEQ)):
685
                                        inst.pred_cmp = True
686
                                        inst.alu_op = 1
687
                                        inst.comp_mode = 3
688
                                        if (pred.bytewide):
689
                                                inst.comp_mode += 4
690
                                        if (isinstance(pred.op0,C)):
691
                                                inst.op0_mux_s = 0
692
                                                inst.const_word = pred.op0.value
693
                                        elif (isinstance(pred.op0,P)):
694
                                                inst.op0_mux_s = 1
695
                                        elif (isinstance(pred.op0,FR)):
696
                                                inst.op0_mux_s = 2
697
                                        elif (isinstance(pred.op0,R)):
698
                                                inst.op0_mux_s = 3
699
                                                inst.reg_addr = pred.op0.address
700
                                        if (isinstance(pred.op1,C)):
701
                                                inst.op1_mux_s = 0
702
                                                inst.const_word = pred.op1.value
703
                                        elif (isinstance(pred.op1,R)):
704
                                                inst.op1_mux_s = 1
705
                                                inst.reg_addr = pred.op1.address
706
                                elif (isinstance(pred, DST)):
707
                                        inst.pred_dst = True
708
                                elif (isinstance(pred, SRC)):
709
                                        inst.pred_src = True
710
                                elif (isinstance(pred, FCS)):
711
                                        inst.pred_fcs = True
712
 
713
        def processFlags(self, flags):
714
                if (flags != None and len(flags) > 0):
715
                        for flag in flags:
716
                                if (isinstance(flag, AEOF)):
717
                                        self.eof_out = True
718
                                elif (isinstance(flag, ASOF)):
719
                                        self.sof_out = True

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.