OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [sparc_ffu_ctl.v] - Blame information for rev 105

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 95 fafa1971
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: sparc_ffu_ctl.v
4
// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6
// 
7
// The above named program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public
9
// License version 2 as published by the Free Software Foundation.
10
// 
11
// The above named program is distributed in the hope that it will be 
12
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// General Public License for more details.
15
// 
16
// You should have received a copy of the GNU General Public
17
// License along with this work; if not, write to the Free Software
18
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19
// 
20
// ========== Copyright Header End ============================================
21
////////////////////////////////////////////////////////////////////////
22
/*
23
//  Module Name: sparc_ffu_ctl
24
//      Description: This is the ffu control block.
25
*/
26
 
27
/*
28
/* ========== Copyright Header Begin ==========================================
29
*
30
* OpenSPARC T1 Processor File: iop.h
31
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
32
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
33
*
34
* The above named program is free software; you can redistribute it and/or
35
* modify it under the terms of the GNU General Public
36
* License version 2 as published by the Free Software Foundation.
37
*
38
* The above named program is distributed in the hope that it will be
39
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
40
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
41
* General Public License for more details.
42
*
43
* You should have received a copy of the GNU General Public
44
* License along with this work; if not, write to the Free Software
45
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
46
*
47
* ========== Copyright Header End ============================================
48
*/
49
//-*- verilog -*-
50
////////////////////////////////////////////////////////////////////////
51
/*
52
//
53
//  Description:        Global header file that contain definitions that
54
//                      are common/shared at the IOP chip level
55
*/
56
////////////////////////////////////////////////////////////////////////
57
 
58
 
59
// Address Map Defines
60
// ===================
61
 
62
 
63
 
64
 
65
// CMP space
66
 
67
 
68
 
69
// IOP space
70
 
71
 
72
 
73
 
74
                               //`define ENET_ING_CSR     8'h84
75
                               //`define ENET_EGR_CMD_CSR 8'h85
76
 
77
 
78
 
79
 
80
 
81
 
82
 
83
 
84
 
85
 
86
 
87
 
88
 
89
 
90
 
91
// L2 space
92
 
93
 
94
 
95
// More IOP space
96
 
97
 
98
 
99
 
100
 
101
//Cache Crossbar Width and Field Defines
102
//======================================
103
 
104
 
105
 
106
 
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
 
118
 
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 
135
 
136
 
137
 
138
 
139
 
140
 
141
 
142
 
143
 
144
 
145
 
146
 
147
 
148
//bits 133:128 are shared by different fields
149
//for different packet types.
150
 
151
 
152
 
153
 
154
 
155
 
156
 
157
 
158
 
159
 
160
 
161
 
162
 
163
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
 
176
 
177
 
178
 
179
 
180
 
181
 
182
 
183
 
184
 
185
 
186
 
187
 
188
 
189
 
190
 
191
 
192
 
193
 
194
 
195
 
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
 
207
 
208
 
209
 
210
 
211
 
212
//End cache crossbar defines
213
 
214
 
215
// Number of COS supported by EECU 
216
 
217
 
218
 
219
// 
220
// BSC bus sizes
221
// =============
222
//
223
 
224
// General
225
 
226
 
227
 
228
 
229
// CTags
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
// reinstated temporarily
244
 
245
 
246
 
247
 
248
// CoS
249
 
250
 
251
 
252
 
253
 
254
 
255
// L2$ Bank
256
 
257
 
258
 
259
// L2$ Req
260
 
261
 
262
 
263
 
264
 
265
 
266
 
267
 
268
 
269
 
270
 
271
 
272
 
273
// L2$ Ack
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
 
282
// Enet Egress Command Unit
283
 
284
 
285
 
286
 
287
 
288
 
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
// Enet Egress Packet Unit
298
 
299
 
300
 
301
 
302
 
303
 
304
 
305
 
306
 
307
 
308
 
309
 
310
 
311
// This is cleaved in between Egress Datapath Ack's
312
 
313
 
314
 
315
 
316
 
317
 
318
 
319
 
320
// Enet Egress Datapath
321
 
322
 
323
 
324
 
325
 
326
 
327
 
328
 
329
 
330
 
331
 
332
 
333
 
334
 
335
 
336
 
337
// In-Order / Ordered Queue: EEPU
338
// Tag is: TLEN, SOF, EOF, QID = 15
339
 
340
 
341
 
342
 
343
 
344
 
345
// Nack + Tag Info + CTag
346
 
347
 
348
 
349
 
350
// ENET Ingress Queue Management Req
351
 
352
 
353
 
354
 
355
 
356
 
357
 
358
 
359
 
360
 
361
 
362
 
363
// ENET Ingress Queue Management Ack
364
 
365
 
366
 
367
 
368
 
369
 
370
 
371
 
372
// Enet Ingress Packet Unit
373
 
374
 
375
 
376
 
377
 
378
 
379
 
380
 
381
 
382
 
383
 
384
 
385
// ENET Ingress Packet Unit Ack
386
 
387
 
388
 
389
 
390
 
391
 
392
 
393
// In-Order / Ordered Queue: PCI
394
// Tag is: CTAG
395
 
396
 
397
 
398
 
399
 
400
// PCI-X Request
401
 
402
 
403
 
404
 
405
 
406
 
407
 
408
 
409
 
410
 
411
 
412
// PCI_X Acknowledge
413
 
414
 
415
 
416
 
417
 
418
 
419
 
420
 
421
 
422
 
423
 
424
//
425
// BSC array sizes
426
//================
427
//
428
 
429
 
430
 
431
 
432
 
433
 
434
 
435
 
436
 
437
 
438
 
439
 
440
// ECC syndrome bits per memory element
441
 
442
 
443
 
444
 
445
//
446
// BSC Port Definitions
447
// ====================
448
//
449
// Bits 7 to 4 of curr_port_id
450
 
451
 
452
 
453
 
454
 
455
 
456
 
457
 
458
// Number of ports of each type
459
 
460
 
461
// Bits needed to represent above
462
 
463
 
464
// How wide the linked list pointers are
465
// 60b for no payload (2CoS)
466
// 80b for payload (2CoS)
467
 
468
//`define BSC_OBJ_PTR   80
469
//`define BSC_HD1_HI    69
470
//`define BSC_HD1_LO    60
471
//`define BSC_TL1_HI    59
472
//`define BSC_TL1_LO    50
473
//`define BSC_CT1_HI    49
474
//`define BSC_CT1_LO    40
475
//`define BSC_HD0_HI    29
476
//`define BSC_HD0_LO    20
477
//`define BSC_TL0_HI    19
478
//`define BSC_TL0_LO    10
479
//`define BSC_CT0_HI     9
480
//`define BSC_CT0_LO     0
481
 
482
 
483
 
484
 
485
 
486
 
487
 
488
 
489
 
490
 
491
 
492
 
493
 
494
 
495
 
496
 
497
 
498
 
499
 
500
 
501
 
502
 
503
 
504
 
505
 
506
 
507
 
508
 
509
 
510
 
511
 
512
 
513
 
514
 
515
// I2C STATES in DRAMctl
516
 
517
 
518
 
519
 
520
 
521
 
522
 
523
//
524
// IOB defines
525
// ===========
526
//
527
 
528
 
529
 
530
 
531
 
532
 
533
 
534
 
535
 
536
 
537
 
538
 
539
 
540
 
541
 
542
 
543
 
544
 
545
 
546
//`define IOB_INT_STAT_WIDTH   32
547
//`define IOB_INT_STAT_HI      31
548
//`define IOB_INT_STAT_LO       0
549
 
550
 
551
 
552
 
553
 
554
 
555
 
556
 
557
 
558
 
559
 
560
 
561
 
562
 
563
 
564
 
565
 
566
 
567
 
568
 
569
 
570
 
571
 
572
 
573
 
574
 
575
 
576
 
577
 
578
 
579
 
580
 
581
 
582
 
583
 
584
 
585
 
586
 
587
 
588
 
589
 
590
 
591
 
592
 
593
 
594
 
595
 
596
 
597
 
598
// fixme - double check address mapping
599
// CREG in `IOB_INT_CSR space
600
 
601
 
602
 
603
 
604
 
605
 
606
 
607
 
608
 
609
 
610
// CREG in `IOB_MAN_CSR space
611
 
612
 
613
 
614
 
615
 
616
 
617
 
618
 
619
 
620
 
621
 
622
 
623
 
624
 
625
 
626
 
627
 
628
 
629
 
630
 
631
 
632
 
633
 
634
 
635
 
636
 
637
 
638
 
639
 
640
 
641
 
642
 
643
 
644
 
645
 
646
 
647
 
648
// Address map for TAP access of SPARC ASI
649
 
650
 
651
 
652
 
653
 
654
 
655
 
656
 
657
 
658
 
659
 
660
 
661
 
662
//
663
// CIOP UCB Bus Width
664
// ==================
665
//
666
//`define IOB_EECU_WIDTH       16  // ethernet egress command
667
//`define EECU_IOB_WIDTH       16
668
 
669
//`define IOB_NRAM_WIDTH       16  // NRAM (RLDRAM previously)
670
//`define NRAM_IOB_WIDTH        4
671
 
672
 
673
 
674
 
675
//`define IOB_ENET_ING_WIDTH   32  // ethernet ingress
676
//`define ENET_ING_IOB_WIDTH    8
677
 
678
//`define IOB_ENET_EGR_WIDTH    4  // ethernet egress
679
//`define ENET_EGR_IOB_WIDTH    4
680
 
681
//`define IOB_ENET_MAC_WIDTH    4  // ethernet MAC
682
//`define ENET_MAC_IOB_WIDTH    4
683
 
684
 
685
 
686
 
687
//`define IOB_BSC_WIDTH         4  // BSC
688
//`define BSC_IOB_WIDTH         4
689
 
690
 
691
 
692
 
693
 
694
 
695
 
696
//`define IOB_CLSP_WIDTH        4  // clk spine unit
697
//`define CLSP_IOB_WIDTH        4
698
 
699
 
700
 
701
 
702
 
703
//
704
// CIOP UCB Buf ID Type
705
// ====================
706
//
707
 
708
 
709
 
710
//
711
// Interrupt Device ID
712
// ===================
713
//
714
// Caution: DUMMY_DEV_ID has to be 9 bit wide
715
//          for fields to line up properly in the IOB.
716
 
717
 
718
 
719
//
720
// Soft Error related definitions 
721
// ==============================
722
//
723
 
724
 
725
 
726
//
727
// CMP clock
728
// =========
729
//
730
 
731
 
732
 
733
 
734
//
735
// NRAM/IO Interface
736
// =================
737
//
738
 
739
 
740
 
741
 
742
 
743
 
744
 
745
 
746
 
747
 
748
//
749
// NRAM/ENET Interface
750
// ===================
751
//
752
 
753
 
754
 
755
 
756
 
757
 
758
 
759
//
760
// IO/FCRAM Interface
761
// ==================
762
//
763
 
764
 
765
 
766
 
767
 
768
 
769
//
770
// PCI Interface
771
// ==================
772
// Load/store size encodings
773
// -------------------------
774
// Size encoding
775
// 000 - byte
776
// 001 - half-word
777
// 010 - word
778
// 011 - double-word
779
// 100 - quad
780
 
781
 
782
 
783
 
784
 
785
 
786
//
787
// JBI<->SCTAG Interface
788
// =======================
789
// Outbound Header Format
790
 
791
 
792
 
793
 
794
 
795
 
796
 
797
 
798
 
799
 
800
 
801
 
802
 
803
 
804
 
805
 
806
 
807
 
808
 
809
 
810
 
811
 
812
 
813
 
814
 
815
 
816
 
817
// Inbound Header Format
818
 
819
 
820
 
821
 
822
 
823
 
824
 
825
 
826
 
827
 
828
 
829
 
830
 
831
 
832
 
833
 
834
 
835
 
836
 
837
 
838
//
839
// JBI->IOB Mondo Header Format
840
// ============================
841
//
842
 
843
 
844
 
845
 
846
 
847
 
848
 
849
 
850
 
851
 
852
 
853
 
854
 
855
 
856
// JBI->IOB Mondo Bus Width/Cycle
857
// ==============================
858
// Cycle  1 Header[15:8]
859
// Cycle  2 Header[ 7:0]
860
// Cycle  3 J_AD[127:120]
861
// Cycle  4 J_AD[119:112]
862
// .....
863
// Cycle 18 J_AD[  7:  0]
864
 
865
 
866
 
867
 
868
 
869
 
870
 
871
 
872
 
873
 
874
 
875
 
876
 
877
 
878
module sparc_ffu_ctl (/*AUTOARG*/
879
   // Outputs
880
   ffu_exu_rsr_data_mid_m, ffu_exu_rsr_data_lo_m,
881
   ffu_exu_rsr_data_hi_m, ctl_vis_subtract, ctl_vis_sel_log,
882
   ctl_vis_sel_align, ctl_vis_sel_add, ctl_vis_log_sel_xor,
883
   ctl_vis_log_sel_pass, ctl_vis_log_sel_nor, ctl_vis_log_sel_nand,
884
   ctl_vis_log_pass_rs2, ctl_vis_log_pass_rs1,
885
   ctl_vis_log_pass_const, ctl_vis_log_invert_rs2,
886
   ctl_vis_log_invert_rs1, ctl_vis_log_constant, ctl_vis_cin,
887
   ctl_vis_align_odd, ctl_vis_align6, ctl_vis_align4, ctl_vis_align2,
888
   ctl_vis_align0, ctl_vis_add32, ctl_dp_wsr_data_w2, ctl_dp_thr_e,
889
   ctl_dp_gsr_wsr_w2, so, ctl_dp_rst_l, ffu_ifu_fpop_done_w2,
890
   ffu_ifu_cc_vld_w2, ffu_ifu_cc_w2, ffu_ifu_tid_w2,
891
   ffu_ifu_stallreq, ffu_ifu_ecc_ce_w2, ffu_ifu_ecc_ue_w2,
892
   ffu_ifu_err_reg_w2, ffu_ifu_err_synd_w2, ffu_ifu_fst_ce_w,
893
   ffu_lsu_kill_fst_w, ffu_ifu_inj_ack, ffu_lsu_data,
894
   ffu_lsu_fpop_rq_vld, ffu_lsu_blk_st_va_e, ffu_lsu_blk_st_e,
895
   ffu_tlu_trap_ieee754, ffu_tlu_trap_other, ffu_tlu_trap_ue,
896
   ffu_tlu_ill_inst_m, ffu_tlu_fpu_tid, ffu_tlu_fpu_cmplt,
897
   ctl_frf_ren, ctl_frf_wen, ctl_frf_addr, ctl_dp_fp_thr,
898
   ctl_dp_fcc_w2, ctl_dp_ftt_w2, ctl_dp_exc_w2, ctl_dp_ecc_sel_frf,
899
   ctl_dp_output_sel_rs1, ctl_dp_output_sel_rs2,
900
   ctl_dp_output_sel_frf, ctl_dp_output_sel_fsr, ctl_dp_rs2_frf_read,
901
   ctl_dp_rs2_sel_vis, ctl_dp_rs2_sel_fpu_lsu, ctl_dp_rs2_keep_data,
902
   ctl_dp_rd_ecc, ctl_dp_fsr_sel_ld, ctl_dp_fsr_sel_fpu,
903
   ctl_dp_fsr_sel_old, ctl_dp_noshift64_frf, ctl_dp_shift_frf_right,
904
   ctl_dp_shift_frf_left, ctl_dp_zero_low32_frf, ctl_dp_new_rs1,
905
   ctl_dp_sign, ctl_dp_flip_fpu, ctl_dp_flip_lsu, ctl_dp_noflip_fpu,
906
   ctl_dp_noflip_lsu, ctl_frf_write_synd,
907
   // Inputs
908
   ifu_tlu_sraddr_d, exu_ffu_wsr_inst_e, exu_ffu_gsr_scale_m,
909
   exu_ffu_gsr_rnd_m, exu_ffu_gsr_mask_m, exu_ffu_gsr_align_m,
910
   dp_ctl_gsr_scale_e, dp_ctl_gsr_mask_e, rclk, si, se, grst_l,
911
   arst_l, rst_tri_en, dp_ctl_rs2_sign, cpx_vld, cpx_fcmp, cpx_req,
912
   cpx_fccval, cpx_fpexc, dp_ctl_fsr_fcc, dp_ctl_fsr_rnd,
913
   dp_ctl_fsr_tem, dp_ctl_fsr_aexc, dp_ctl_fsr_cexc,
914
   dp_ctl_synd_out_low, dp_ctl_synd_out_high, ifu_ffu_fpop1_d,
915
   ifu_ffu_fpop2_d, ifu_ffu_visop_d, ifu_ffu_fpopcode_d,
916
   ifu_ffu_frs1_d, ifu_ffu_frs2_d, ifu_ffu_frd_d, ifu_ffu_fld_d,
917
   ifu_ffu_fst_d, ifu_ffu_ldst_single_d, ifu_ffu_tid_d,
918
   ifu_ffu_fcc_num_d, ifu_ffu_mvcnd_m, ifu_ffu_inj_frferr,
919
   ifu_exu_ecc_mask, ifu_ffu_ldfsr_d, ifu_ffu_ldxfsr_d,
920
   ifu_ffu_stfsr_d, ifu_ffu_quad_op_e, ifu_tlu_inst_vld_w,
921
   lsu_ffu_flush_pipe_w, ifu_tlu_flush_w, lsu_ffu_ack,
922
   lsu_ffu_ld_vld, lsu_ffu_bld_cnt_w, dp_ctl_ld_fcc, ifu_exu_nceen_e,
923
   ifu_exu_disable_ce_e, lsu_ffu_blk_asi_e, exu_ffu_ist_e,
924
   ifu_tlu_flsh_inst_e, ifu_lsu_ld_inst_e, lsu_ffu_stb_full0,
925
   lsu_ffu_stb_full1, lsu_ffu_stb_full2, lsu_ffu_stb_full3,
926
//sotheas,8/17/04: fixed eco 6529
927
   lsu_ffu_st_dtlb_perr_g
928
//////////////////////////////
929
   ) ;
930
   /*AUTOINPUT*/
931
   // Beginning of automatic inputs (from unused autoinst inputs)
932
   input [31:0]         dp_ctl_gsr_mask_e;      // To visctl of sparc_ffu_ctl_visctl.v
933
   input [4:0]          dp_ctl_gsr_scale_e;     // To visctl of sparc_ffu_ctl_visctl.v
934
   input [2:0]          exu_ffu_gsr_align_m;    // To visctl of sparc_ffu_ctl_visctl.v
935
   input [31:0]         exu_ffu_gsr_mask_m;     // To visctl of sparc_ffu_ctl_visctl.v
936
   input [2:0]          exu_ffu_gsr_rnd_m;      // To visctl of sparc_ffu_ctl_visctl.v
937
   input [4:0]          exu_ffu_gsr_scale_m;    // To visctl of sparc_ffu_ctl_visctl.v
938
   input                exu_ffu_wsr_inst_e;     // To visctl of sparc_ffu_ctl_visctl.v
939
   input [6:0]          ifu_tlu_sraddr_d;       // To visctl of sparc_ffu_ctl_visctl.v
940
   // End of automatics
941
   input rclk;
942
   input si;
943
   input se;
944
   input grst_l;
945
   input arst_l;
946
   input rst_tri_en;
947
   input [1:0] dp_ctl_rs2_sign;
948
 
949
   input          cpx_vld;
950
   input          cpx_fcmp;
951
   input [3:0]    cpx_req;
952
   input [1:0]    cpx_fccval;
953
   input [4:0]    cpx_fpexc;
954
   input [7:0] dp_ctl_fsr_fcc;
955
   input [1:0] dp_ctl_fsr_rnd;
956
   input [4:0] dp_ctl_fsr_tem;
957
         input [4:0] dp_ctl_fsr_aexc;
958
         input [4:0] dp_ctl_fsr_cexc;
959
 
960
   input [6:0] dp_ctl_synd_out_low;   // signals for ecc errors
961
   input [6:0] dp_ctl_synd_out_high;
962
 
963
   input       ifu_ffu_fpop1_d;
964
   input       ifu_ffu_fpop2_d;
965
   input       ifu_ffu_visop_d;
966
   input [8:0] ifu_ffu_fpopcode_d;
967
   input [4:0] ifu_ffu_frs1_d;
968
   input [4:0] ifu_ffu_frs2_d;
969
   input [4:0] ifu_ffu_frd_d;
970
   input       ifu_ffu_fld_d;
971
   input       ifu_ffu_fst_d;
972
   input       ifu_ffu_ldst_single_d;
973
   input [1:0] ifu_ffu_tid_d;
974
   input [1:0] ifu_ffu_fcc_num_d;
975
   input       ifu_ffu_mvcnd_m;
976
 
977
   input       ifu_ffu_inj_frferr;
978
   input [6:0] ifu_exu_ecc_mask;
979
 
980
   input       ifu_ffu_ldfsr_d,
981
               ifu_ffu_ldxfsr_d,
982
               ifu_ffu_stfsr_d;
983
   input       ifu_ffu_quad_op_e;
984
 
985
   input       ifu_tlu_inst_vld_w;
986
   input       lsu_ffu_flush_pipe_w;
987
   input       ifu_tlu_flush_w;
988
 
989
   input        lsu_ffu_ack;
990
   input        lsu_ffu_ld_vld;
991
   input [2:0]  lsu_ffu_bld_cnt_w;
992
   input [7:0]  dp_ctl_ld_fcc;
993
 
994
   input        ifu_exu_nceen_e;// enable ecc traps
995
   input        ifu_exu_disable_ce_e; // all ce are treated as ue
996
   input        lsu_ffu_blk_asi_e;
997
   input        exu_ffu_ist_e;
998
   input        ifu_tlu_flsh_inst_e;
999
   input        ifu_lsu_ld_inst_e;
1000
   input        lsu_ffu_stb_full0;
1001
   input        lsu_ffu_stb_full1;
1002
   input        lsu_ffu_stb_full2;
1003
   input        lsu_ffu_stb_full3;
1004
 
1005
   input        lsu_ffu_st_dtlb_perr_g; //sotheas,8/17/04: fixed eco 6529, when asserted terminated
1006
                                        //                 block store
1007
 
1008
   /*AUTOOUTPUT*/
1009
   // Beginning of automatic outputs (from unused autoinst outputs)
1010
   output [3:0]         ctl_dp_gsr_wsr_w2;      // From visctl of sparc_ffu_ctl_visctl.v
1011
   output [3:0]         ctl_dp_thr_e;           // From visctl of sparc_ffu_ctl_visctl.v
1012
   output [36:0]        ctl_dp_wsr_data_w2;     // From visctl of sparc_ffu_ctl_visctl.v
1013
   output               ctl_vis_add32;          // From visctl of sparc_ffu_ctl_visctl.v
1014
   output               ctl_vis_align0;         // From visctl of sparc_ffu_ctl_visctl.v
1015
   output               ctl_vis_align2;         // From visctl of sparc_ffu_ctl_visctl.v
1016
   output               ctl_vis_align4;         // From visctl of sparc_ffu_ctl_visctl.v
1017
   output               ctl_vis_align6;         // From visctl of sparc_ffu_ctl_visctl.v
1018
   output               ctl_vis_align_odd;      // From visctl of sparc_ffu_ctl_visctl.v
1019
   output               ctl_vis_cin;            // From visctl of sparc_ffu_ctl_visctl.v
1020
   output               ctl_vis_log_constant;   // From visctl of sparc_ffu_ctl_visctl.v
1021
   output               ctl_vis_log_invert_rs1; // From visctl of sparc_ffu_ctl_visctl.v
1022
   output               ctl_vis_log_invert_rs2; // From visctl of sparc_ffu_ctl_visctl.v
1023
   output               ctl_vis_log_pass_const; // From visctl of sparc_ffu_ctl_visctl.v
1024
   output               ctl_vis_log_pass_rs1;   // From visctl of sparc_ffu_ctl_visctl.v
1025
   output               ctl_vis_log_pass_rs2;   // From visctl of sparc_ffu_ctl_visctl.v
1026
   output               ctl_vis_log_sel_nand;   // From visctl of sparc_ffu_ctl_visctl.v
1027
   output               ctl_vis_log_sel_nor;    // From visctl of sparc_ffu_ctl_visctl.v
1028
   output               ctl_vis_log_sel_pass;   // From visctl of sparc_ffu_ctl_visctl.v
1029
   output               ctl_vis_log_sel_xor;    // From visctl of sparc_ffu_ctl_visctl.v
1030
   output               ctl_vis_sel_add;        // From visctl of sparc_ffu_ctl_visctl.v
1031
   output               ctl_vis_sel_align;      // From visctl of sparc_ffu_ctl_visctl.v
1032
   output               ctl_vis_sel_log;        // From visctl of sparc_ffu_ctl_visctl.v
1033
   output               ctl_vis_subtract;       // From visctl of sparc_ffu_ctl_visctl.v
1034
   output [31:0]        ffu_exu_rsr_data_hi_m;  // From visctl of sparc_ffu_ctl_visctl.v
1035
   output [7:0]         ffu_exu_rsr_data_lo_m;  // From visctl of sparc_ffu_ctl_visctl.v
1036
   output [2:0]         ffu_exu_rsr_data_mid_m; // From visctl of sparc_ffu_ctl_visctl.v
1037
   // End of automatics
1038
   output               so;
1039
   output               ctl_dp_rst_l;
1040
   output       ffu_ifu_fpop_done_w2;
1041
   output [3:0] ffu_ifu_cc_vld_w2;// one hot valid for each set of fcc
1042
   output [7:0] ffu_ifu_cc_w2;// all 4 sets of fcc
1043
   output [1:0] ffu_ifu_tid_w2;
1044
   output       ffu_ifu_stallreq; // stall pipe so blk st can issue
1045
 
1046
   output       ffu_ifu_ecc_ce_w2;  // correctable ecc error
1047
   output       ffu_ifu_ecc_ue_w2;  // uncorrectable ecc error
1048
   output [5:0] ffu_ifu_err_reg_w2;
1049
   output [13:0] ffu_ifu_err_synd_w2;
1050
   output       ffu_ifu_fst_ce_w;
1051
   output       ffu_lsu_kill_fst_w;
1052
   output       ffu_ifu_inj_ack;
1053
 
1054
   output [80:64] ffu_lsu_data;
1055
   output         ffu_lsu_fpop_rq_vld ;   // ffu dispatches fpop issue request.
1056
   output [5:3]  ffu_lsu_blk_st_va_e;
1057
   output        ffu_lsu_blk_st_e;
1058
 
1059
   output         ffu_tlu_trap_ieee754;
1060
   output         ffu_tlu_trap_other;
1061
   output     ffu_tlu_trap_ue;
1062
   output     ffu_tlu_ill_inst_m;
1063
 
1064
   output [1:0] ffu_tlu_fpu_tid;
1065
   output       ffu_tlu_fpu_cmplt;
1066
 
1067
   output       ctl_frf_ren;
1068
   output [1:0] ctl_frf_wen;
1069
   output [6:0] ctl_frf_addr;
1070
 
1071
   output [3:0] ctl_dp_fp_thr;
1072
 
1073
   output [7:0] ctl_dp_fcc_w2;
1074
   output [2:0] ctl_dp_ftt_w2;
1075
   output [9:0] ctl_dp_exc_w2;
1076
 
1077
   output ctl_dp_ecc_sel_frf;
1078
 
1079
 
1080
   // mux selects
1081
   output       ctl_dp_output_sel_rs1;
1082
   output       ctl_dp_output_sel_rs2;
1083
   output       ctl_dp_output_sel_frf;
1084
   output       ctl_dp_output_sel_fsr;
1085
 
1086
   output       ctl_dp_rs2_frf_read;
1087
   output       ctl_dp_rs2_sel_vis;
1088
   output       ctl_dp_rs2_sel_fpu_lsu;
1089
   output       ctl_dp_rs2_keep_data;
1090
   output   ctl_dp_rd_ecc;
1091
 
1092
   output [3:0] ctl_dp_fsr_sel_ld,
1093
                ctl_dp_fsr_sel_fpu,
1094
                ctl_dp_fsr_sel_old;
1095
 
1096
   output       ctl_dp_noshift64_frf;
1097
   output       ctl_dp_shift_frf_right;
1098
   output       ctl_dp_shift_frf_left;
1099
   output       ctl_dp_zero_low32_frf;
1100
 
1101
   output ctl_dp_new_rs1;
1102
 
1103
   output [1:0] ctl_dp_sign;
1104
 
1105
   output       ctl_dp_flip_fpu;
1106
   output       ctl_dp_flip_lsu;
1107
   output       ctl_dp_noflip_fpu;
1108
   output       ctl_dp_noflip_lsu;
1109
 
1110
 
1111
   wire     clk;
1112
   wire     reset;
1113
   wire     ffu_reset_l;
1114
   // FPOP is broken into parts:
1115
   // [8:4] fpop_high
1116
   // [3:2] fpop_mid
1117
   // [1:0] fpop_size
1118
   wire         fpop_size_0;    // 2 lsbs of fpop
1119
   wire         fpop_size_1;
1120
 
1121
   wire         fpop_high_0;    // 4 msbs of fpop
1122
   wire         fpop_high_2;
1123
   wire         fpop_high_4;
1124
   wire         fpop_high_5;
1125
   wire         fpop_high_6;
1126
   wire         fpop_high_8;
1127
   wire         fpop_high_a;
1128
   wire         fpop_high_c;
1129
   wire         fpop_high_d;
1130
   wire         fpop_high_e;
1131
   wire         fpop_high_10;
1132
   wire         fpop_high_18;
1133
   wire    fpop_low_1;
1134
   wire    fpop_low_2;
1135
   wire    fpop_low_4;
1136
   wire    fpop_low_5;
1137
   wire    fpop_low_6;
1138
   wire    fpop_low_8;
1139
   wire    fpop_low_9;
1140
   wire    fpop_low_a;
1141
   wire    fpop_low_d;
1142
   wire    fpop_low_e;
1143
 
1144
   wire         source_single_e;
1145
   wire         source_single_next;
1146
   wire         source_single;
1147
 
1148
   wire         dest_single_e;
1149
   wire         dest_single_next;
1150
   wire         dest_single;
1151
 
1152
   wire [4:0]   frs1_e;
1153
   wire [5:0]   rs1_e;
1154
   wire [5:0]   rs1_next;
1155
   wire [5:0]   rs1;
1156
   wire [4:0]   frs2_e;
1157
   wire [5:0]   rs2_e;
1158
   wire [4:0]   frd_e;
1159
   wire         ldst_single_e;
1160
   wire [5:0]   rd_e;
1161
   wire [5:1]   st_rd_d;
1162
   wire [5:1]   write_addr;
1163
 
1164
   wire [5:0]    rs2_next;
1165
   wire [5:0]    rs2;
1166
   wire [5:0]    rd_next;
1167
   wire [5:0]    rd;
1168
   wire [5:1]   blk_rd;
1169
 
1170
   wire         is_fpop_d;
1171
   wire    shift_frf_rs2_m;
1172
   wire    shift_frf_rs1_w;
1173
   wire    shift_frf_right_next;
1174
   wire    shift_frf_right;
1175
   wire    shift_frf_left_next;
1176
   wire    shift_frf_left;
1177
   wire    noshift64_frf_next;
1178
   wire    noshift64_frf;
1179
 
1180
   wire         abs_w;
1181
   wire         neg_w;
1182
   wire         cond_move_e;
1183
   wire         cond_move_m;
1184
   wire         move_e;
1185
   wire         move_m;
1186
   wire         move_m_valid;
1187
   wire         move_w;
1188
   wire   move_w_valid;
1189
   wire   move_w2;
1190
   wire   move_w2_vld;
1191
   wire   move_wen_m;
1192
   wire   move_wen_w;
1193
   wire         move_wen_w2;
1194
   wire         move_wen_w2_valid;
1195
 
1196
   wire   vis_nofrf_e;
1197
   wire         ren_rs2_e;
1198
   wire         ren_rs2_e_vld;
1199
   wire         ren_rs2_m;
1200
   wire         ren_rs2_m_vld;
1201
   wire         ren_rs2_w;
1202
   wire         ren_rs2_w2;
1203
   wire         ren_rs2_w3;
1204
   wire         ren_rs2_w4;
1205
   wire         ren_rs1_e;
1206
   wire         ren_rs1_m;
1207
   wire         ren_rs1_w;
1208
   wire         ren_rs1_w_vld;
1209
   wire         ren_rs1_w2_vld;
1210
   wire         ren_rs1_w2;
1211
   wire         ren_rs1_w3;
1212
   wire         ren_rs1_w4;
1213
   wire         ren_rs1_w5;
1214
   wire         read_rs1;
1215
   wire         read_rs2;
1216
   wire   read_rd;
1217
   wire         read_bst;
1218
 
1219
   wire         fpu_op_e;
1220
   wire         fpu_op_m;
1221
   wire         fpu_op_w_vld;
1222
   wire         fpu_op_w;
1223
   wire         fpu_op_w2;
1224
   wire         fpu_op_w2_vld;
1225
   wire         fpu_op_w3;
1226
   wire         fpu_op_w3_vld;
1227
   wire         any_op_e;
1228
   wire         any_op_m;
1229
   wire         any_op_w;
1230
   wire         any_op_w2;
1231
   wire         any_op_m_valid;
1232
   wire   visop_e;
1233
   wire   visop_m;
1234
   wire   visop_w_vld;
1235
 
1236
   wire         fld_e;
1237
   wire         fld_m;
1238
   wire         fst_e;
1239
   wire         fst_m;
1240
   wire         fst_w;
1241
   wire         zero_lower_data_next;
1242
 
1243
   wire   fpop1_e;
1244
   wire   fpop2_e;
1245
   wire   fpop1_next;
1246
   wire   fpop1;
1247
   wire   fpop2_next;
1248
   wire   fpop2;
1249
   wire   visop_next;
1250
   wire   visop;
1251
   wire         kill_m;
1252
   wire         killed_w;
1253
   wire         kill_w;
1254
   wire         kill_unimpl_w;
1255
   wire         kill_fp;
1256
   wire         kill_eccchk_w;
1257
   wire   flush_w;
1258
   wire   flush_w2;
1259
 
1260
   wire [1:0]    tid_next;
1261
   wire [1:0]   tid;
1262
   wire [1:0]   extra_tid;
1263
   wire [8:0]    opf_next;
1264
   wire [8:0]    opf;
1265
   wire [5:1]   early_frf_rnum;
1266
   wire [5:1]   frf_rnum;
1267
   wire [1:0]   frf_tid;
1268
   wire [1:0]   fpu_rnd;
1269
 
1270
   wire         thr_match_mw2;
1271
   wire         thr_match_ww2;
1272
   wire         thr_match_fpw2;
1273
   wire [1:0]    tid_e,
1274
                tid_m,
1275
                tid_w,
1276
                tid_w2;
1277
 
1278
   wire         fpop1_ready_w2_next;
1279
   wire         fpop2_ready_w3_next;
1280
   wire         fpop1_ready_w2;
1281
   wire         fpop2_ready_w3;
1282
   wire   issue_fpop2;
1283
 
1284
   wire         ldfsr,
1285
                ldxfsr,
1286
                stfsr_e,
1287
                stfsr_w,
1288
                stfsr_qual_w,
1289
                ldfsr_vld,
1290
                ldxfsr_vld;
1291
   wire   stfsr_w2;
1292
   wire   stfsr_w2_vld;
1293
 
1294
   wire   clear_ftt;
1295
 
1296
   wire [1:0]    ldfsr_next;
1297
 
1298
   wire         is_fpu_result;
1299
 
1300
   wire   output_sel_rs1_next;
1301
   wire   output_sel_frf_next;
1302
   wire   output_sel_fsr_next;
1303
   wire   output_sel_rs2_next;
1304
   wire   output_sel_rs1;
1305
   wire   output_sel_frf;
1306
   wire   output_sel_fsr;
1307
   wire   output_sel_rs2;
1308
 
1309
   wire   ffu_op_done_next;
1310
   wire   ffu_op_done;
1311
   wire   ffu_op_done_vld;
1312
   wire         external_wen_next;
1313
   wire         lsu_pkt_vld;
1314
   wire [1:0]    lsu_pkt_type;
1315
   wire         store_ready;
1316
   wire         load_pending;
1317
   wire         load_pending_next;
1318
   wire   blk_ld_done;
1319
   wire   blk_ld_m;
1320
   wire         blk_load_pending;
1321
   wire         blk_load_pending_next;
1322
   wire         fp_pending,
1323
                fp_pending_next;
1324
 
1325
   wire [3:0]    fcc_num_dec;
1326
   wire [1:0]    fcc_num,
1327
                fcc_num_next;
1328
 
1329
   wire [7:0]    fpu_fcc;
1330
   wire [9:0]    fp_exc_w2;
1331
 
1332
   wire         fcc_sel_fpu;
1333
   wire         fcc_sel_ldx;
1334
   wire         fcc_sel_ld;
1335
   wire         fcc_sel_old;
1336
   wire         cc_changed;
1337
   wire         rf_wen;
1338
   wire   rf_wen_next;
1339
   wire   rf_ecc_gen_next;
1340
   wire   rf_ecc_gen;
1341
   wire   vis_wen_next;
1342
   wire   vis_result;
1343
 
1344
   wire [4:0] fsr_tem_d1;
1345
   wire       ieee_trap;
1346
   wire         take_ieee_trap;
1347
   wire         take_other_trap;
1348
   wire [4:0]    ieee_trap_vec;
1349
   wire         fpexc_nxc;
1350
   wire   fpexc_ofc;
1351
   wire   fpexc_ufc;
1352
 
1353
   wire [1:0] error_detected;
1354
   wire [1:0] possible_ue;
1355
   wire [1:0] ce;
1356
   wire [1:0] prev_err_detected;
1357
   wire [1:0] prev_poss_ue;
1358
   wire       rollback_fst_m;
1359
   wire       rollback_fst_w;
1360
   wire       rollback_rs2_w2;
1361
   wire       rollback_rs1_w3;
1362
   wire       rollback_c1_next;
1363
   wire   rollback_c1;
1364
   wire   rollback_c1_vld;
1365
   wire   rollback_c2;
1366
   wire   rollback_c3;
1367
   wire   rolled_back_next;
1368
   wire   rolled_back;
1369
   wire   chk_rs1_w2;
1370
   wire         check_ecc_next;
1371
   wire [1:0] chk_ecc_m;
1372
   wire [1:0] chk_ecc_w;
1373
   wire [1:0] chk_ecc_w2;
1374
   wire [1:0] chk_ecc;
1375
   wire [1:0] chk_ecc_prev;
1376
   wire   disable_ce_m;
1377
   wire   disable_ce_w;
1378
   wire         fst_ce_w;
1379
   wire         fst_ue_w;
1380
   wire         fst_ce_w2;
1381
   wire         fst_ue_w2;
1382
   wire         rs2_ce_w2;
1383
   wire         rs2_ue_w2;
1384
   wire         rs2_fst_ce_w2_vld;
1385
   wire         rs2_fst_ue_w2_vld;
1386
   wire         rs2_fst_ce_w3;
1387
   wire         rs2_fst_ue_w3;
1388
   wire   rs1_ce_w3;
1389
   wire         ce_w3;
1390
   wire         ue_w3;
1391
   wire   nceen;
1392
   wire   nceen_next;
1393
   wire   ue_trap_w3;
1394
   wire [1:0]    previous_ce;
1395
   wire         previous_ue;
1396
   wire [1:0]    ecc_wen_next;
1397
   wire [1:0]    ecc_wen_gen_next;
1398
   wire [1:0]    ecc_wen_gen;
1399
   wire [1:0]    ecc_wen;
1400
   wire         inject_err_next;
1401
   wire [6:0]    err_data;
1402
   wire         inject_err;
1403
   wire   wen_rs1_ecc;
1404
   wire   wen_rs2_ecc;
1405
   wire   ecc_kill_rs2_w2;
1406
   wire [13:0] new_err_synd;
1407
   wire [13:0] err_synd_d1;
1408
   wire [13:0] err_synd_next;
1409
   wire [5:0]  new_err_reg;
1410
   wire [5:0]  err_reg_next;
1411
   wire [5:0]  err_reg_d1;
1412
   wire        log_new_err;
1413
   wire   kill_st_ce_w;
1414
   wire   possible_kill_st_ue_m;
1415
   wire   possible_kill_st_ce_m;
1416
   wire   possible_kill_st_ue_w;
1417
   wire   possible_kill_st_ce_w;
1418
 
1419
   wire         unimpl_op_e,
1420
                unimpl_op_all_e,
1421
                unimpl_op_m,
1422
                unimpl_op_w,
1423
                unimpl_qual_w,
1424
                unimpl_qual_w2,
1425
                unimpl_op_w2;
1426
   wire    illegal_vis_e;
1427
   wire    illegal_vis_m;
1428
   wire    illegal_blk_m;
1429
   wire    illegal_rs1_e;
1430
   wire    illegal_field_e;
1431
   wire    convert_op_e;
1432
 
1433
   wire          cpx_vld_d1;
1434
   wire          cpx_fcmp_d1;
1435
   wire [3:0]    cpx_req_d1;
1436
   wire [1:0]    cpx_fccval_d1;
1437
   wire [4:0]    cpx_fpexc_d1;
1438
 
1439
   wire   bst_m;
1440
   wire   bst_w;
1441
   wire   st_dtlb_perr_w2_l;
1442
   wire   can_issue_bst_c2;
1443
   wire   other_mem_op_e;
1444
   wire [5:0] bst_rs;
1445
   wire [2:0] bst_cnt;
1446
   wire [2:0] bst_cnt_next;
1447
   wire       bst_read_req;
1448
   wire       bst_issue_c1;
1449
   wire       bst_issue_c2;
1450
   wire       bst_issue_c3;
1451
   wire       bst_issue_c4;
1452
   wire       bst_issue_c5;
1453
   wire       bst_issue_c6;
1454
   wire       bst_issue_c1_next;
1455
   wire       bst_issue_c2_next;
1456
   wire       bst_issue_c3_next;
1457
   wire       bst_issue_c4_next;
1458
   wire       bst_issue_c5_next;
1459
   wire       bst_issue_c6_next;
1460
   wire       bst_done;
1461
   wire [2:0] bld_cnt_d1;
1462
   wire [2:0] bld_cnt_d2;
1463
   wire [2:0] bld_cnt_d3;
1464
   wire       stb_full0;
1465
   wire       stb_full1;
1466
   wire       stb_full2;
1467
   wire       stb_full3;
1468
   wire       stb_full_c2;
1469
   wire [5:0] bst_stall_cnt;
1470
   wire [5:0] bst_stall_cnt_next;
1471
   wire       bst_stall_req;
1472
   wire       bst_stall_req_next;
1473
   wire       fld_done;
1474
   wire       ld_ret;
1475
   wire   bst_ce_c4;
1476
   wire   bst_ue_c4;
1477
   wire   fixed_bst_ce;
1478
   wire   fixed_bst_ce_next;
1479
   wire   blk_asi_m;
1480
 
1481
//
1482
// Code begins here
1483
//
1484
   assign clk = rclk;
1485
   // Reset flop
1486
    dffrl_async rstff(.din (grst_l),
1487
                        .q   (ffu_reset_l),
1488
                        .clk (clk),
1489
                        .rst_l (arst_l), .si(), .so(), .se(se));
1490
   assign        ctl_dp_rst_l = ffu_reset_l;
1491
   assign        reset = ~ffu_reset_l;
1492
   // Stage cpx data by one cycle
1493
   dff #(13) cpx_dff(.din({cpx_vld, cpx_fcmp, cpx_req[3:0], cpx_fccval[1:0], cpx_fpexc[4:0]}),
1494
                     .q({cpx_vld_d1, cpx_fcmp_d1, cpx_req_d1[3:0], cpx_fccval_d1[1:0], cpx_fpexc_d1[4:0]}),
1495
                     .clk(clk), .se(se), .si(), .so());
1496
   dff #(3) lsu_bld_cnt1_dff(.din({lsu_ffu_bld_cnt_w[2:0]}), .clk(clk),
1497
                         .q({bld_cnt_d1[2:0]}), .se(se), .si(), .so());
1498
   dff #(3) lsu_bld_cnt2_dff(.din({bld_cnt_d1[2:0]}), .clk(clk),
1499
                         .q({bld_cnt_d2[2:0]}), .se(se), .si(), .so());
1500
   dff #(3) lsu_bld_cnt3_dff(.din({bld_cnt_d2[2:0]}), .clk(clk),
1501
                         .q({bld_cnt_d3[2:0]}), .se(se), .si(), .so());
1502
 
1503
//----------------------------------------
1504
// Decode Instruction From IFU
1505
//----------------------------------------
1506
   dff #(3) fpop_d2e(.din({ifu_ffu_fpop1_d, ifu_ffu_fpop2_d, ifu_ffu_visop_d}), .clk(clk),
1507
                     .q({fpop1_e, fpop2_e, visop_e}), .se(se), .si(), .so());
1508
   assign        fpop1_next = (any_op_e | reset)? fpop1_e: fpop1;
1509
   assign        fpop2_next = (any_op_e | reset)? fpop2_e: fpop2;
1510
   assign        visop_next = (any_op_e | reset)? visop_e: visop;
1511
   dff #(3) fpop_dff(.din({fpop1_next,fpop2_next,visop_next}),
1512
                     .q({fpop1,fpop2,visop}),
1513
                     .clk(clk), .se(se), .si(), .so());
1514
 
1515
   assign  fpop_size_0 = ~opf[1] & ~opf[0];
1516
   assign  fpop_size_1 = ~opf[1] & opf[0];
1517
 
1518
   assign  fpop_low_1 = ~opf[3] & ~opf[2] & ~opf[1] & opf[0];
1519
   assign  fpop_low_2 = ~opf[3] & ~opf[2] & opf[1] & ~opf[0];
1520
   assign  fpop_low_4 = ~opf[3] & opf[2] & ~opf[1] & ~opf[0];
1521
   assign  fpop_low_5 = ~opf[3] & opf[2] & ~opf[1] & opf[0];
1522
   assign  fpop_low_6 = ~opf[3] & opf[2] & opf[1] & ~opf[0];
1523
   assign  fpop_low_8 = opf[3] & ~opf[2] & ~opf[1] & ~opf[0];
1524
   assign  fpop_low_9 = opf[3] & ~opf[2] & ~opf[1] & opf[0];
1525
   assign  fpop_low_a = opf[3] & ~opf[2] & opf[1] & ~opf[0];
1526
   assign  fpop_low_d = opf[3] & opf[2] & ~opf[1] & opf[0];
1527
   assign  fpop_low_e = opf[3] & opf[2] & opf[1] & ~opf[0];
1528
 
1529
   assign  fpop_high_0 = ~opf[8] & ~opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
1530
   assign  fpop_high_2 = ~opf[8] & ~opf[7] & ~opf[6] & opf[5] & ~opf[4];
1531
   assign  fpop_high_4 = ~opf[8] & ~opf[7] & opf[6] & ~opf[5] & ~opf[4];
1532
   assign  fpop_high_5 = ~opf[8] & ~opf[7] & opf[6] & ~opf[5] & opf[4];
1533
   assign  fpop_high_6 = ~opf[8] & ~opf[7] & opf[6] & opf[5] & ~opf[4];
1534
   assign  fpop_high_a = ~opf[8] & opf[7] & ~opf[6] & opf[5] & ~opf[4];
1535
   assign  fpop_high_8 = ~opf[8] & opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
1536
   assign  fpop_high_c = ~opf[8] & opf[7] & opf[6] & ~opf[5] & ~opf[4];
1537
   assign  fpop_high_d = ~opf[8] & opf[7] & opf[6] & ~opf[5] & opf[4];
1538
   assign  fpop_high_e = ~opf[8] & opf[7] & opf[6] & opf[5] & ~opf[4];
1539
   assign  fpop_high_10 = opf[8] & ~opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
1540
   assign  fpop_high_18 = opf[8] & opf[7] & ~opf[6] & ~opf[5] & ~opf[4];
1541
 
1542
   assign  unimpl_op_e = ~((fpop_low_1 | fpop_low_2) & (fpop_high_0 | fpop_high_4 | fpop_high_8 |
1543
                                                        fpop1_e & fpop_high_d |
1544
                                                        fpop2_e & (fpop_high_5 | fpop_high_c |
1545
                                                                           fpop_high_10 | fpop_high_18)) |
1546
                           (fpop_low_4 | fpop_low_8) & fpop1_e & (fpop_high_8 | fpop_high_c) |
1547
                           (fpop_low_5 | fpop_low_6) & (fpop_high_4 |
1548
                                                        fpop1_e & fpop_high_0 |
1549
                                                        fpop2_e & (fpop_high_2 | fpop_high_5 |
1550
                                                                           fpop_high_6 | fpop_high_a |
1551
                                                                           fpop_high_c | fpop_high_e)) |
1552
                           fpop_low_6 & fpop1_e & fpop_high_c |
1553
                           fpop_low_9 & fpop1_e & (fpop_high_0 | fpop_high_4 | fpop_high_6 |
1554
                                                           fpop_high_c) |
1555
                           fpop_low_a & fpop1_e & (fpop_high_0 | fpop_high_4) |
1556
                           (fpop_low_d | fpop_low_e) & fpop1_e & fpop_high_4) & (fpop1_e | fpop2_e);
1557
   assign illegal_field_e = fpop2_e & (fpop_high_5 & |rd_e[4:2] |// bits 29:27 must be zero on fcmp
1558
                                       ~opf[4] & ~opf[2] & rs1_e[4]);// bit 18 must be zero on fmovcc
1559
 
1560
 
1561
   assign  convert_op_e = fpop1_e & opf[7];
1562
   assign  illegal_rs1_e = (frs1_e[4:0] != 5'b00000) & (move_e & ~rollback_c3 | convert_op_e);
1563
 
1564
//
1565
// Decode size of source and destination. don't care for unimplemented ops
1566
//
1567
   assign source_single_e = (fpop_high_c & fpop_size_0) | //32b int
1568
                                 (opf[0]);// single (also quad but those are illegal
1569
 
1570
/* -----\/----- EXCLUDED -----\/-----
1571
   assign  convert_op = (ifu_ffu_fpopcode_d[7] |fpop_high_6_d) & ifu_ffu_fpop1_d;
1572
   assign dest_single_d = (is_fpop_d)? (fpop_size_1_d & ~convert_op) | // sgl and not conv
1573
                                         (ifu_ffu_fpop1_d & ifu_ffu_fpopcode_d[7] & ~ifu_ffu_fpopcode_d[3] &
1574
                                          (~fpop_high_8_d | ifu_ffu_fpopcode_d[2])) |// int to s or float to short int
1575
                                           (ifu_ffu_visop_d & ifu_ffu_fpopcode_d[0]) :// vis single
1576
                                        ifu_ffu_ldst_single_d;
1577
 -----/\----- EXCLUDED -----/\----- */
1578
   assign dest_single_e = (fpop1_e & (~opf[1] & opf[0] & ~(opf[7] |fpop_high_6) | // sgl and not conv
1579
                                              opf[7] & ~opf[3] &
1580
                                              (~fpop_high_8 | opf[2])) |// int to s or float to short int
1581
                           fpop2_e & fpop_size_1 |
1582
                           visop_e & opf[0] | // vis single
1583
                           (fst_e | fld_e) & ldst_single_e);
1584
 
1585
   assign unimpl_op_all_e = (unimpl_op_e | ifu_ffu_quad_op_e |
1586
                             illegal_rs1_e | illegal_field_e);
1587
 
1588
   dff #1 qopm_ff(.din (unimpl_op_all_e),
1589
                  .q   (unimpl_op_m),
1590
                  .clk (clk), .se(se), .si(), .so());
1591
 
1592
   dff #1 qopw_ff(.din (unimpl_op_m),
1593
                  .q   (unimpl_op_w),
1594
                  .clk (clk), .se(se), .si(), .so());
1595
   assign unimpl_qual_w = unimpl_op_w & ~kill_unimpl_w;
1596
   assign unimpl_qual_w2 = unimpl_op_w2 & ~flush_w2;
1597
 
1598
   dff #1 qopw2_ff(.din (unimpl_qual_w),
1599
                   .q   (unimpl_op_w2),
1600
                   .clk (clk), .se(se), .si(), .so());
1601
 
1602
 
1603
   // Decode register encoding (bit[5] wrapped to bit[0] for non singles)
1604
   // Also the storage is flopped around so odd regs are at even addresses 
1605
   // in the regfile for singles.  this helps because everything external 
1606
   // expects data to be [63:0] not [31:0, 63:32] on doubles.
1607
 
1608
   assign rs1_e[5] = frs1_e[0] & ~source_single_e;// zero for singles
1609
   assign rs1_e[4:2] = frs1_e[4:2];
1610
   assign rs1_e[1] = frs1_e[1];
1611
   assign rs1_e[0] = frs1_e[0] & source_single_e;// only nonzro for sgl
1612
 
1613
   assign rs2_e[5] = frs2_e[0] & ~source_single_e;// zero for singles
1614
   assign rs2_e[4:2] = frs2_e[4:2];
1615
   assign rs2_e[1] = frs2_e[1];
1616
   assign rs2_e[0] = frs2_e[0] & source_single_e;// only nonzro for sgl
1617
 
1618
   assign rd_e[5] = frd_e[0] & ~dest_single_e;// zero for singles
1619
   assign rd_e[4:2] = frd_e[4:2];
1620
   assign rd_e[1] = frd_e[1];
1621
   assign rd_e[0] = frd_e[0] & dest_single_e;// only nonzro for sgl
1622
 
1623
 
1624
   // Decode general type of operation
1625
   assign is_fpop_d = ifu_ffu_fpop1_d | ifu_ffu_fpop2_d | ifu_ffu_visop_d;
1626
 
1627
   // Do locally
1628
   assign move_e = fpop_high_0 & (fpop1_e | (fpop1 & rollback_c3)) |
1629
                                                (rollback_c3 & fpop2 & ~opf[4]);// rollback cond_move
1630
   // cond moves don't get rollback because they either don't happen or become unconditional
1631
   assign cond_move_e = fpop2_e & ~opf[4];
1632
 
1633
   assign abs_w = move_w & fpop_high_0 & opf[3];
1634
   assign neg_w = move_w & fpop_high_0 & opf[2];
1635
 
1636
   // Send to FPU
1637
   assign fpu_op_e = ((~fpop_high_0 & fpop1_next) | (fpop_high_5 & fpop2_next)) & (any_op_e | rollback_c3);
1638
 
1639
   // FRF read indication
1640
   assign ren_rs2_e = (fpop1_e | fpop2_e | visop_e) | rollback_c3;
1641
   assign ren_rs2_e_vld = ren_rs2_e & ~vis_nofrf_e;
1642
   assign ren_rs2_m_vld = ren_rs2_m & (cond_move_m & ifu_ffu_mvcnd_m | ~cond_move_m);
1643
   assign ren_rs1_e = ((~vis_nofrf_e & visop_e) | // all vis except siam read rs1
1644
                       (rollback_c3 & visop) |
1645
                       ((fpop2_next & opf[4]) | //FCMP
1646
                        (fpop1_next & ~opf[7] & opf[6])) &      // add,sub,mul,div
1647
                       (any_op_e | rollback_c3 & ~reset));
1648
   assign ren_rs1_w_vld = ren_rs1_w & ~kill_eccchk_w;
1649
   assign ren_rs1_w2_vld = ren_rs1_w2 & ~flush_w2;
1650
 
1651
   //------------------------------------
1652
   // Store and wait for FPop to complete
1653
   //------------------------------------
1654
   // Storage of control signals
1655
 
1656
   // >>>>> added ~kill_fp
1657
   // set these in e so that kill_fp doesn't kill spuriously
1658
   assign load_pending_next = fld_e |          // set
1659
                (load_pending & ~lsu_ffu_ld_vld & ~kill_fp & ~blk_ld_m);
1660
   assign fld_done = lsu_ffu_ld_vld & ~kill_fp & load_pending;
1661
   dffr ldpend_dff(.din (load_pending_next),
1662
                               .q   (load_pending),
1663
                               .clk (clk),
1664
                               .rst (reset),
1665
                               .se(se), .si(), .so());
1666
 
1667
   assign blk_ld_m = fld_m & blk_asi_m;
1668
   assign blk_ld_done = lsu_ffu_ld_vld & ~kill_fp & (bld_cnt_d1[2:0] == 3'b111) & blk_load_pending;
1669
   assign blk_load_pending_next = (blk_ld_m & ~kill_m)  | // set
1670
          (blk_load_pending & ~kill_fp & ~ffu_ifu_fpop_done_w2);
1671
   dffr blk_ldpend_dff(.din(blk_load_pending_next),
1672
                       .q(blk_load_pending),
1673
                       .clk(clk),
1674
                       .rst(reset),
1675
                       .se(se), .si(), .so());
1676
 
1677
   assign fp_pending_next = fpu_op_e |   // set
1678
                            (fp_pending & ~is_fpu_result & ~kill_fp);
1679
   dffr fppend_dff(.din(fp_pending_next),
1680
                               .q(fp_pending),
1681
                               .clk(clk),
1682
                               .rst (reset),
1683
                               .se(se), .si(), .so());
1684
 
1685
   // rs1
1686
   dff #(5) rs1_d2e(.din(ifu_ffu_frs1_d[4:0]), .clk(clk), .q(frs1_e[4:0]), .se(se), .si(), .so());
1687
   mux2ds #(6) rs1_mux(.dout (rs1_next[5:0]),
1688
                          .in0  (rs1[5:0]),
1689
                          .in1  (rs1_e[5:0]),
1690
                          .sel0  (~any_op_e),
1691
                          .sel1  (any_op_e));
1692
   dff #(6) rs1_dff(.din(rs1_next[5:0]),
1693
                                .clk(clk),
1694
                                .q(rs1[5:0]),
1695
                    .se(se), .si(), .so());
1696
   // rs2
1697
   dff #(5) rs2_d2e(.din(ifu_ffu_frs2_d[4:0]), .clk(clk), .q(frs2_e[4:0]), .se(se), .si(), .so());
1698
   mux2ds #(6) rs2_mux(.dout(rs2_next[5:0]),
1699
                       .in0 (rs2[5:0]),
1700
                       .in1 (rs2_e[5:0]),
1701
                       .sel0(~any_op_e),
1702
                       .sel1 (any_op_e));
1703
   dff #(6) rs2_dff(.din (rs2_next[5:0]),
1704
                                .clk (clk),
1705
                                .q   (rs2[5:0]),
1706
                    .se(se), .si(), .so());
1707
   // rd
1708
   dff #(6) rd_d2e(.din({ifu_ffu_ldst_single_d,ifu_ffu_frd_d[4:0]}), .clk(clk),
1709
                   .q({ldst_single_e,frd_e[4:0]}),
1710
                   .se(se), .si(), .so());
1711
   mux2ds #(6) rd_mux(.dout (rd_next[5:0]),
1712
                      .in0  (rd[5:0]),
1713
                      .in1  (rd_e[5:0]),
1714
                      .sel0 (~any_op_e),
1715
                      .sel1  (any_op_e));
1716
   dff #(6) rd_dff(.din (rd_next[5:0]),
1717
                               .clk (clk),
1718
                               .q    (rd[5:0]),
1719
                   .se  (se), .si(), .so());
1720
   // rs size
1721
   mux2ds source_single_mux(.dout (source_single_next),
1722
                            .in0  (source_single),
1723
                            .in1  (source_single_e),
1724
                            .sel0(~any_op_e),
1725
                            .sel1 (any_op_e));
1726
   dff source_single_dff(.din(source_single_next),
1727
                                           .clk(clk),
1728
                                           .q(source_single),
1729
                         .se(se), .si(), .so());
1730
   // rd size
1731
   assign dest_single_next = (any_op_e)? dest_single_e: dest_single;
1732
   dff dest_single_dff(.din (dest_single_next),
1733
                                            .clk (clk),
1734
                                            .q   (dest_single),
1735
                          .se  (se), .si(), .so());
1736
   // thread
1737
   mux2ds #(2) tid_mux(.dout (tid_next[1:0]),
1738
                       .in0  (tid[1:0]),
1739
                       .in1  (tid_e[1:0]),
1740
                       .sel0 (~any_op_e),
1741
                       .sel1  (any_op_e));
1742
   dff #(2) tid_dff(.din(tid_next[1:0]),
1743
                                .clk(clk),
1744
                                .q(tid[1:0]),
1745
                    .se(se), .si(), .so());
1746
   // extra tid to help fanout for critical signals
1747
   dff #(2) extra_tid_dff(.din(tid_next[1:0]),
1748
                          .clk(clk), .q(extra_tid[1:0]), .se(se), .si(), .so());
1749
   // fcc num
1750
   mux2ds #(2) fcc_mux(.dout (fcc_num_next[1:0]),
1751
                       .in0   (fcc_num[1:0]),
1752
                       .in1   (ifu_ffu_fcc_num_d[1:0]),
1753
                       .sel0 (~is_fpop_d),
1754
                       .sel1   (is_fpop_d));
1755
   dff #(2) fcc_dff(.din (fcc_num_next[1:0]),
1756
                                .clk (clk),
1757
                                .q   (fcc_num[1:0]),
1758
                    .se  (se), .si(), .so());
1759
 
1760
   // ldfsr
1761
   mux2ds #(2) ldfsr_mux(.dout (ldfsr_next[1:0]),
1762
                         .in0  ({ldfsr, ldxfsr}),
1763
                         .in1  ({ifu_ffu_ldfsr_d, ifu_ffu_ldxfsr_d}),
1764
                         .sel0  (~ifu_ffu_fld_d),
1765
                         .sel1  (ifu_ffu_fld_d));
1766
   dff #(2) ldfsr_dff(.din (ldfsr_next[1:0]),
1767
                                  .clk (clk),
1768
                                  .q   ({ldfsr, ldxfsr}),
1769
                      .se  (se), .si(), .so());
1770
 
1771
   // op code
1772
   mux2ds #(9) opf_mux(.dout (opf_next[8:0]),
1773
                       .in0  (opf[8:0]),
1774
                       .in1  (ifu_ffu_fpopcode_d[8:0]),
1775
                       .sel0  (~is_fpop_d),
1776
                       .sel1  (is_fpop_d));
1777
   dff #(9) opf_dff(.din(opf_next[8:0]),
1778
                                .clk(clk),
1779
                                .q(opf[8:0]),
1780
                   .se(se), .si(), .so());
1781
   //----------
1782
   // FP Pipe
1783
   //----------
1784
   dff fop_e2m(.din(any_op_e), .clk(clk),
1785
                     .q(any_op_m),
1786
                     .se(se), .si(), .so());
1787
 
1788
   dff fop_m2w(.din(any_op_m_valid), .clk(clk),
1789
                     .q(any_op_w),
1790
                     .se(se), .si(), .so());
1791
   dff fop_w2w2(.din(any_op_w), .clk(clk),
1792
                     .q(any_op_w2),
1793
                     .se(se), .si(), .so());
1794
 
1795
   dff fst_d2e(.din(ifu_ffu_fst_d),  .clk(clk),
1796
                     .q  (fst_e),
1797
                     .se(se), .si(), .so());
1798
   dff fst_e2m(.din(fst_e), .clk(clk),
1799
                     .q  (fst_m),
1800
                     .se(se), .si(), .so());
1801
   dff fst_m2w(.din(fst_m), .clk(clk),
1802
                     .q  (fst_w),
1803
                     .se(se), .si(), .so());
1804
   dff fld_d2e(.din(ifu_ffu_fld_d),  .clk(clk),
1805
                     .q  (fld_e),
1806
                     .se(se), .si(), .so());
1807
   dff fld_e2m(.din(fld_e),  .clk(clk),
1808
                     .q  (fld_m),
1809
                     .se(se), .si(), .so());
1810
 
1811
   dff ren_rs2_e2m(.din(ren_rs2_e_vld), .clk(clk),
1812
                               .q(ren_rs2_m),
1813
                               .se(se), .si(), .so());
1814
   dff ren_rs2_m2w(.din(ren_rs2_m_vld), .clk(clk),
1815
                               .q(ren_rs2_w),
1816
                               .se(se), .si(), .so());
1817
   dff ren_rs2_w2w2(.din(ren_rs2_w), .clk(clk),
1818
                                .q(ren_rs2_w2),
1819
                                .se(se), .si(), .so());
1820
   dff ren_rs2_w22w3(.din(ren_rs2_w2), .clk(clk),
1821
                                .q(ren_rs2_w3),
1822
                                .se(se), .si(), .so());
1823
   dff ren_rs2_w32w4(.din(ren_rs2_w3), .clk(clk),
1824
                                .q(ren_rs2_w4),
1825
                                .se(se), .si(), .so());
1826
 
1827
   dff ren_rs1_e2m(.din(ren_rs1_e), .clk(clk),
1828
                               .q(ren_rs1_m),
1829
                               .se(se), .si(), .so());
1830
   dff ren_rs1_m2w(.din(ren_rs1_m), .clk(clk),
1831
                               .q(ren_rs1_w),
1832
                               .se(se), .si(), .so());
1833
   dff ren_rs1_w2w2(.din(ren_rs1_w_vld), .clk(clk),
1834
                               .q(ren_rs1_w2),
1835
                               .se(se), .si(), .so());
1836
   dff ren_rs1_w22w3(.din(ren_rs1_w2_vld), .clk(clk),
1837
                               .q(ren_rs1_w3),
1838
                               .se(se), .si(), .so());
1839
   dff ren_rs1_w32w4(.din(ren_rs1_w3), .clk(clk),
1840
                               .q(ren_rs1_w4),
1841
                               .se(se), .si(), .so());
1842
   dff ren_rs1_w42w5(.din(ren_rs1_w4), .clk(clk),
1843
                               .q(ren_rs1_w5),
1844
                               .se(se), .si(), .so());
1845
 
1846
   dff cond_move_e2m(.din(cond_move_e), .clk(clk),
1847
                                 .q(cond_move_m),
1848
                                 .se(se), .si(), .so());
1849
 
1850
   dff move_e2m(.din(move_e), .clk(clk),
1851
                            .q(move_m),
1852
                            .se(se), .si(), .so());
1853
   dff move_m2w(.din(move_m_valid), .clk(clk),
1854
                            .q(move_w),
1855
                            .se(se), .si(), .so());
1856
   dff move_wen_m2w(.din(move_wen_m), .clk(clk), .q(move_wen_w),
1857
                    .se(se), .si(), .so());
1858
   dff move_wen_w2w2(.din(move_wen_w), .clk(clk), .q(move_wen_w2),
1859
                    .se(se), .si(), .so());
1860
   dff move_wdff(.din(move_w_valid), .clk(clk), .q(move_w2), .se(se), .si(), .so());
1861
 
1862
   dff stfsr_d2e(.din(ifu_ffu_stfsr_d),
1863
                             .q(stfsr_e),
1864
                             .clk(clk),
1865
                             .se(se), .si(), .so());
1866
 
1867
   dff fpu_op_e2m(.din(fpu_op_e), .clk(clk),
1868
                              .q(fpu_op_m),
1869
                              .se(se), .si(), .so());
1870
   dff fpu_op_m2w(.din(fpu_op_m), .clk(clk),
1871
                              .q(fpu_op_w),
1872
                              .se(se), .si(), .so());
1873
   dff fpu_op_w2w2(.din(fpu_op_w_vld), .clk(clk),
1874
                              .q(fpu_op_w2),
1875
                              .se(se), .si(), .so());
1876
   dff fpu_op_w22w3(.din(fpu_op_w2_vld), .clk(clk),
1877
                              .q(fpu_op_w3),
1878
                              .se(se), .si(), .so());
1879
 
1880
   dff #(2) tid_d2e(.din(ifu_ffu_tid_d[1:0]),
1881
                                .clk(clk),
1882
                                .q(tid_e[1:0]),
1883
                                .se(se), .si(), .so());
1884
 
1885
   dff #(2) tid_e2m(.din(tid_e[1:0]),
1886
                                .clk(clk),
1887
                                .q(tid_m[1:0]),
1888
                                .se(se), .si(), .so());
1889
 
1890
   dff #(2) tid_m2w(.din(tid_m[1:0]),
1891
                                .clk(clk),
1892
                                .q(tid_w[1:0]),
1893
                                .se(se), .si(), .so());
1894
 
1895
   dff #(2) tid_w2w2(.din(tid_w[1:0]),
1896
                                 .clk(clk),
1897
                                 .q(tid_w2[1:0]),
1898
                                 .se(se), .si(), .so());
1899
 
1900
   dff dff_killed_w(.din(kill_m),
1901
                                .clk(clk),
1902
                                .q(killed_w),
1903
                                .se(se), .si(), .so());
1904
 
1905
   dff dff_flush_w2(.din(flush_w), .clk(clk), .q(flush_w2), .se(se), .si(), .so());
1906
 
1907
   assign  thr_match_mw2 = ~((tid_m[1] ^ tid_w2[1]) |
1908
                           (tid_m[0] ^ tid_w2[0]));
1909
   assign  thr_match_ww2 = ~((tid_w[1] ^ tid_w2[1]) |
1910
                           (tid_w[0] ^ tid_w2[0]));
1911
 
1912
   assign thr_match_fpw2 = ~((tid[1] ^ tid_w2[1]) |
1913
                           (tid[0] ^ tid_w2[0]));
1914
 
1915
   // new fpops squash previous ones (only possible in m or w, but w will also have ifu_tlu_flush_w)
1916
   // all kill_w signals do not include lsu_ffu_flush_pipe_w.  This must be included at the final destination
1917
   assign flush_w = (lsu_ffu_flush_pipe_w | ifu_tlu_flush_w) & ~rolled_back;
1918
   assign any_op_e = fpop1_e | fpop2_e | fst_e | fld_e | visop_e;
1919
   assign any_op_m_valid = any_op_m & ~any_op_e;
1920
   assign  kill_m = (thr_match_mw2 & flush_w2) | any_op_e;
1921
   assign  kill_eccchk_w = (~ifu_tlu_inst_vld_w | killed_w | unimpl_op_w | any_op_e |
1922
                            (thr_match_ww2 & flush_w2)) & ~rolled_back;
1923
   // unimplemented ops don't check rolled_back because they trap before rollback happens
1924
   assign  kill_unimpl_w = (~ifu_tlu_inst_vld_w | killed_w | any_op_e
1925
                          | (thr_match_ww2 & flush_w2));
1926
   assign  kill_w = (~ifu_tlu_inst_vld_w | killed_w | any_op_e |
1927
                          unimpl_op_w | ffu_lsu_kill_fst_w | (thr_match_ww2 & flush_w2)) & ~rolled_back;
1928
   // this kills the "pending" signals that are set in the E stage.
1929
   // Since they are set in E all the kills can be delayed by one cycle without
1930
   // squashing a new, valid op
1931
   assign  kill_fp = (thr_match_fpw2 & flush_w2 | any_op_e |
1932
                                  any_op_w & (~ifu_tlu_inst_vld_w | unimpl_op_w)) & ~rolled_back;
1933
 
1934
 
1935
//----------------------------
1936
// Control for muxes that manipulate data to/from FRF
1937
//----------------------------
1938
   // implement fmov/fmovcc
1939
   assign  move_wen_m = move_m | (cond_move_m & ifu_ffu_mvcnd_m);
1940
   assign  move_wen_w2_valid = move_wen_w2 & move_w2_vld;
1941
   assign  move_m_valid = (move_m | cond_move_m);
1942
   // used for updating fsr
1943
   assign  move_w_valid = move_w & ~kill_w;
1944
   assign  move_w2_vld = move_w2 & ~flush_w2 & ~rollback_rs2_w2 & ~(rs2_ue_w2 & nceen);
1945
 
1946
   // negation or absolute value happen to rs2 in the m_stage if needed
1947
   assign  ctl_dp_sign[1] = (dp_ctl_rs2_sign[1] ^ neg_w) & ~abs_w;
1948
   assign  ctl_dp_sign[0] = (source_single) ?
1949
                             (dp_ctl_rs2_sign[0] ^ neg_w) & ~abs_w :
1950
                              dp_ctl_rs2_sign[0];
1951
 
1952
   //
1953
   // Shifts to align sgl precision 32b data
1954
   //
1955
   // mux for moving around single data from frf
1956
 
1957
   // shift on moves or stores
1958
   assign shift_frf_rs2_m = (rs2[0] ^ rd[0]) & (move_m | cond_move_m | visop_m) & ~fst_e;
1959
   assign shift_frf_rs1_w = (rs1[0] ^ rd[0]) & visop_w_vld; //check for squash
1960
 
1961
   assign  shift_frf_right_next = (source_single & shift_frf_rs2_m & ~rs2[0]) |
1962
                                      (source_single & shift_frf_rs1_w & ~rs1[0]) |
1963
                                      (dest_single_e & fst_e & ~rd_e[0]);
1964
 
1965
   assign  shift_frf_left_next = ((source_single & rs2[0] & (shift_frf_rs2_m | fpu_op_m & ~fst_e) |
1966
                                   source_single & rs1[0] & (shift_frf_rs1_w | fpu_op_w_vld))
1967
                                  & ~shift_frf_right_next);
1968
 
1969
   assign  noshift64_frf_next = ~(shift_frf_right_next | shift_frf_left_next);
1970
 
1971
   assign  ctl_dp_shift_frf_right = shift_frf_right & ~rst_tri_en;
1972
   assign  ctl_dp_shift_frf_left = shift_frf_left & ~rst_tri_en;
1973
   assign  ctl_dp_noshift64_frf = noshift64_frf | rst_tri_en;
1974
 
1975
   // fpu expects lower 32 bits to be zero on single operands
1976
   assign  zero_lower_data_next = ((source_single & ~rs1[0] & fpu_op_w_vld) |
1977
                                   (source_single & ~rs2[0] & fpu_op_m));
1978
 
1979
   dff shift_frf_right_dff(.din(shift_frf_right_next), .clk(clk), .q(shift_frf_right),
1980
                           .se(se), .si(), .so());
1981
   dff shift_frf_left_dff(.din(shift_frf_left_next), .clk(clk), .q(shift_frf_left),
1982
                           .se(se), .si(), .so());
1983
   dff noshift64_dff(.din(noshift64_frf_next), .clk(clk), .q(noshift64_frf),
1984
                     .se(se), .si(), .so());
1985
   dff noshift32_dff(.din(zero_lower_data_next), .clk(clk), .q(ctl_dp_zero_low32_frf),
1986
                     .se(se), .si(), .so());
1987
 
1988
   wire    flip_fpu;
1989
   wire    flip_lsu;
1990
   // mux for rearranging data from fpu
1991
   // data comes in with msb always at b63.  This means that singles with an odd
1992
   // rd must be flipped so that the data ends up in the correct
1993
   //  registers.
1994
   assign  flip_fpu = (dest_single & rd[0]);// single with odd rd
1995
 
1996
   // mux for rearranging data from lsu
1997
   // data comes in [63:0].  This means that singles with an even
1998
   // rd must be flipped so that the data ends up in the correct
1999
   //  registers.
2000
   assign  flip_lsu = (dest_single & ~rd[0]);// single with even rd
2001
 
2002
   assign  ctl_dp_noflip_lsu = ld_ret & ~flip_lsu;
2003
   assign  ctl_dp_flip_lsu = ld_ret & flip_lsu;
2004
   assign  ctl_dp_noflip_fpu = ~ld_ret & ~flip_fpu & is_fpu_result & ~cpx_fcmp_d1;
2005
   assign  ctl_dp_flip_fpu = ~ld_ret & ~ctl_dp_noflip_fpu;
2006
 
2007
 
2008
//---------------------------------
2009
// LSU Interface
2010
//---------------------------------
2011
 
2012
   // Note that stores fit into the standard pipeline so they are automatically 
2013
   // accepted and do not require an ACK.  The lsu will check for kills in m and w.
2014
 
2015
   assign  store_ready = fst_m | bst_issue_c3;
2016
   assign  fpu_op_w_vld = fpu_op_w & ~kill_w;
2017
   assign  fpu_op_w2_vld = fpu_op_w2 & ~flush_w2 & ~ecc_kill_rs2_w2;
2018
   assign  fpu_op_w3_vld = fpu_op_w3 & ~ue_trap_w3 & ~rollback_rs1_w3;
2019
   // don't qual with inst_vld since it takes too much time?
2020
   // Resolved with Sanjay:
2021
   //    Will never receive ack in the same cycle req was first made
2022
   assign  fpop1_ready_w2_next = (fpu_op_w3_vld |
2023
                                                         (fpop1_ready_w2 & ~lsu_ffu_ack));
2024
 
2025
   dffr #1 fpop1_w2_dff(.din (fpop1_ready_w2_next),
2026
                                   .q   (fpop1_ready_w2),
2027
                                   .rst (reset),
2028
                                   .clk (clk), .se(se), .si(), .so());
2029
 
2030
   // once op1 has been accepted, move to w2, and in the next cycle op2 is ready
2031
   //
2032
   // C1 -- recv ack, send op1 (fpop1_ready_w2)
2033
   // C2 -- send op2 (fpop2_ready_w3)
2034
   assign fpop2_ready_w3_next = fpop1_ready_w2 & lsu_ffu_ack;
2035
 
2036
   dff fpop2_w22w3(.din (fpop2_ready_w3_next),
2037
                               .q   (fpop2_ready_w3),
2038
                               .clk(clk), .se(se), .si(), .so());
2039
 
2040
 
2041
   // request in W2 and wait till an ack is received
2042
   //    Will never receive ack in the same cycle req was first made
2043
   assign ffu_lsu_fpop_rq_vld = fpu_op_w3_vld;
2044
 
2045
   // valid pkt sent to lsu (after request)
2046
   assign issue_fpop2 = fpop2_ready_w3 & ~opf[7];// not conversion op
2047
   assign  lsu_pkt_vld = fpop1_ready_w2 | fpu_op_w3_vld | issue_fpop2 | store_ready;
2048
 
2049
   assign lsu_pkt_type[1:0] = {store_ready, fpop2_ready_w3};
2050
 
2051
   // Create packet for LSU: ffu_lsu_data[80:0]
2052
   //     80 = vld
2053
   //     79:78 = type (00 = fpu operand 1, 01 = fpu operand 2, 10 = fp store)
2054
   //     77:76 = tid
2055
   //     75:68 = floating point opcode
2056
   //     67:66 = fcc
2057
   //     65:64 = rounding mode
2058
   //     63:0 = data
2059
   assign ffu_lsu_data[80:64] = {lsu_pkt_vld,
2060
                                 lsu_pkt_type[1:0],
2061
                                 extra_tid[1:0],
2062
                                 opf[7:0],
2063
                                 fcc_num[1:0],
2064
                                 fpu_rnd[1:0]};  // rounding mode
2065
 
2066
   // Select data to send to LSU.  This is calculated one cycle early and flopped
2067
   assign output_sel_rs1_next = fpop2_ready_w3_next & ~fst_e & ~bst_issue_c3_next;     // rs2 is sent first (fpop1)
2068
   assign output_sel_frf_next = fst_e & ~stfsr_e | bst_issue_c3_next;   // store data
2069
   assign output_sel_fsr_next = fst_e & stfsr_e & ~bst_issue_c3_next;
2070
   assign output_sel_rs2_next = ~(fpop2_ready_w3_next | fst_e | bst_issue_c3_next);
2071
   assign ctl_dp_output_sel_rs1 = output_sel_rs1 & ~rst_tri_en;
2072
   assign ctl_dp_output_sel_frf = output_sel_frf & ~rst_tri_en;
2073
   assign ctl_dp_output_sel_fsr = output_sel_fsr & ~rst_tri_en;
2074
   assign ctl_dp_output_sel_rs2 = output_sel_rs2 | rst_tri_en;
2075
   dff #(4) output_sel_dff(.din({output_sel_rs1_next,output_sel_rs2_next,output_sel_frf_next,output_sel_fsr_next}),
2076
                           .q({output_sel_rs1,output_sel_rs2,output_sel_frf,output_sel_fsr}),
2077
                           .clk(clk), .se(se), .si(), .so());
2078
 
2079
 
2080
   dff #1 sfsrw_ff(.din (ctl_dp_output_sel_fsr),
2081
                               .q   (stfsr_w),
2082
                               .clk (clk), .se(se), .si(), .so());
2083
   dff stfsr_wdff(.din(stfsr_qual_w), .clk(clk), .q(stfsr_w2), .se(se), .si(), .so());
2084
   assign stfsr_qual_w =  (stfsr_w & ~kill_w);
2085
   assign stfsr_w2_vld = stfsr_w2 & ~flush_w2;
2086
 
2087
 
2088
   //------------------------------------------------------
2089
   //  Block Stores
2090
   //------------------------------------------------------
2091
   // interface with lsu.  bst packet issues in c3
2092
   // check for stb_full so it doesn't confuse lsu.  Don't have to count inflight packets
2093
   // because none exist by bst_issue_c2
2094
   assign        ffu_lsu_blk_st_e = bst_issue_c2 & ~stb_full_c2;
2095
   assign        ffu_lsu_blk_st_va_e[5:3] = bst_cnt[2:0];
2096
   assign        bst_done = bst_issue_c4 & (bst_cnt[2:0] == 3'b111) & ~bst_ce_c4 & ~(bst_ue_c4 & nceen);
2097
 
2098
   mux4ds stb_full_mux (.dout(stb_full_c2),
2099
                        .in0(stb_full0),
2100
                        .in1(stb_full1),
2101
                        .in2(stb_full2),
2102
                        .in3(stb_full3),
2103
                        .sel0(ctl_dp_fp_thr[0]),
2104
                        .sel1(ctl_dp_fp_thr[1]),
2105
                        .sel2(ctl_dp_fp_thr[2]),
2106
                        .sel3(ctl_dp_fp_thr[3]));
2107
 
2108
   assign        other_mem_op_e = exu_ffu_ist_e | ifu_tlu_flsh_inst_e | ifu_lsu_ld_inst_e;
2109
   assign        can_issue_bst_c2  = (~other_mem_op_e & ~stb_full_c2);
2110
   assign bst_m = fst_m & blk_asi_m;
2111
 
2112
   assign bst_rs[5:0] = {rd[5:4], bst_cnt[2:0], 1'b0};
2113
 
2114
   // bst starts when bst hits w and is done when the 7th pckt has issued
2115
   assign bst_issue_c1_next = ((bst_w & ~kill_w) |
2116
                               (bst_issue_c4 & ~(bst_cnt[2:0] == 3'b111) & ~bst_ce_c4 &
2117
                                ~(bst_ue_c4 & nceen)) | bst_issue_c6);
2118
 
2119
   // sotheas,9/14/04: fixed eco 6910, suppress block store start on dtlb perr
2120
   //                  using registered version of lsu_ffu_st_dtlb_perr_g
2121
   //   WAS:
2122
   //        assign bst_issue_c2_next = ((bst_issue_c1 & ~(any_op_w2 & flush_w2)) | (bst_issue_c2 & ~can_issue_bst_c2)) & ~reset;
2123
   //   IS:
2124
   dff #1 st_dtlbperr_ff(.din (!lsu_ffu_st_dtlb_perr_g),
2125
                               .q   (st_dtlb_perr_w2_l),
2126
                               .clk (clk), .se(se), .si(), .so());
2127
   assign bst_issue_c2_next = ((bst_issue_c1 & ~(any_op_w2 & flush_w2) & st_dtlb_perr_w2_l)
2128
                             | (bst_issue_c2 & ~can_issue_bst_c2)) & ~reset;
2129
   assign bst_issue_c3_next = bst_issue_c2 & can_issue_bst_c2 & ~reset;
2130
   assign bst_issue_c4_next = bst_issue_c3 & ~reset;
2131
   assign bst_issue_c5_next = bst_issue_c4 & bst_ce_c4 & ~reset;
2132
   assign bst_issue_c6_next = bst_issue_c5 & ~reset;
2133
 
2134
   // bst keeps reading in both c1 and c2 in case it stalls in c2
2135
   assign bst_read_req = bst_issue_c1 | bst_issue_c2;
2136
   // counter resets to 1 when bst hits w, increments when one is issued to lsu without ce
2137
   assign bst_cnt_next[2:0] = (bst_w?                            3'b001:
2138
                               (bst_issue_c4 & ~bst_ce_c4)?  (bst_cnt[2:0] + 3'b001):
2139
                                               bst_cnt[2:0]);
2140
 
2141
   ///////////////////
2142
   // bst starvation
2143
   //----------------
2144
   // when six bit counter saturates then a req to stall inst issue is made
2145
   // The request stays high until a bst gets issued
2146
   ///////////////////
2147
   assign ffu_ifu_stallreq = bst_stall_req;
2148
   assign bst_stall_req_next = ((bst_stall_cnt[5:0] == 6'b111111) & bst_issue_c2 & ~can_issue_bst_c2 |
2149
                                bst_stall_req & other_mem_op_e);
2150
   assign bst_stall_cnt_next[5:0] = (~bst_issue_c2)? 6'd0: bst_stall_cnt[5:0] + 6'd1;
2151
 
2152
   /////////////////////
2153
   // bst ecc control
2154
   /////////////////////
2155
   // if a ce occurs even after correction then it is converted to a ue
2156
   assign bst_ue_c4 = bst_issue_c4 & (previous_ue | (fixed_bst_ce & |previous_ce[1:0]));
2157
   assign bst_ce_c4 = bst_issue_c4 & |previous_ce[1:0] & ~fixed_bst_ce & ~previous_ue;
2158
   assign fixed_bst_ce_next = bst_ce_c4 | (fixed_bst_ce & ~bst_issue_c4);
2159
 
2160
   dff #(4) stb_full_dff(.din({lsu_ffu_stb_full0,lsu_ffu_stb_full1,lsu_ffu_stb_full2,lsu_ffu_stb_full3}),
2161
                         .q({stb_full0, stb_full1, stb_full2, stb_full3}),
2162
                         .clk(clk), .se(se), .si(), .so());
2163
   dff blk_asi_dff(.din(lsu_ffu_blk_asi_e), .clk(clk), .q(blk_asi_m),
2164
                   .se(se), .si(), .so());
2165
   dffr bst_fix_ce_dff(.din(fixed_bst_ce_next), .clk(clk), .q(fixed_bst_ce),
2166
                       .se(se), .si(), .so(), .rst(reset));
2167
   dff #(3) bst_cnt_dff(.din(bst_cnt_next[2:0]), .clk(clk), .q(bst_cnt[2:0]),
2168
                        .se(se), .si(), .so());
2169
   dff bst_m2w(.din(bst_m), .clk(clk), .q(bst_w), .se(se), .si(), .so());
2170
   dff bst_issue_c1_dff(.din(bst_issue_c1_next), .clk(clk), .q(bst_issue_c1), .se(se),
2171
                     .si(), .so());
2172
   dff bst_issue_c2_dff(.din(bst_issue_c2_next), .clk(clk), .q(bst_issue_c2), .se(se),
2173
                     .si(), .so());
2174
   dff bst_issue_c3_dff(.din(bst_issue_c3_next), .clk(clk), .q(bst_issue_c3), .se(se),
2175
                     .si(), .so());
2176
   dff bst_issue_c4_dff(.din(bst_issue_c4_next), .clk(clk), .q(bst_issue_c4), .se(se),
2177
                     .si(), .so());
2178
   dff bst_issue_c5_dff(.din(bst_issue_c5_next), .clk(clk), .q(bst_issue_c5), .se(se),
2179
                     .si(), .so());
2180
   dff bst_issue_c6_dff(.din(bst_issue_c6_next), .clk(clk), .q(bst_issue_c6), .se(se),
2181
                     .si(), .so());
2182
   dff #(6) bst_stall_cntdff(.din(bst_stall_cnt_next[5:0]), .clk(clk), .q(bst_stall_cnt[5:0]),
2183
                             .se(se), .si(), .so());
2184
   dffr bst_stall_reqdff(.din(bst_stall_req_next), .clk(clk), .q(bst_stall_req),
2185
                        .se(se), .si(), .so(), .rst(reset));
2186
 
2187
//----------------------------------------
2188
// Decode Returning FPU/LSU packets
2189
//----------------------------------------
2190
 
2191
   // FPU result pulled off of cpx
2192
   assign is_fpu_result = (cpx_req_d1 == 4'b1000) ?
2193
                           cpx_vld_d1 & fp_pending : 1'b0;
2194
   assign ld_ret = lsu_ffu_ld_vld & ~(thr_match_fpw2 & flush_w2) & (blk_load_pending | load_pending);
2195
 
2196
   // select frf write data
2197
   // don't write data on Fcompares
2198
   assign ctl_dp_rs2_sel_fpu_lsu = is_fpu_result & ~cpx_fcmp_d1 | ld_ret;
2199
   assign ctl_dp_rs2_sel_vis = vis_result & ~ctl_dp_rs2_sel_fpu_lsu;
2200
   assign ctl_dp_rs2_frf_read = (ren_rs2_w | ctl_dp_rd_ecc) & ~ctl_dp_rs2_sel_fpu_lsu & ~vis_result;
2201
   assign ctl_dp_rs2_keep_data = ~(ren_rs2_w | ctl_dp_rd_ecc | vis_result |
2202
                                   ctl_dp_rs2_sel_fpu_lsu);
2203
 
2204
   // selects for rs2 result mux
2205
   assign ctl_dp_rd_ecc = fst_ce_w | rollback_rs2_w2 | bst_ce_c4 | rollback_rs1_w3;
2206
 
2207
   // Selects for rs1 mux
2208
   assign ctl_dp_new_rs1 = ren_rs1_w2;
2209
 
2210
//----------------------------------------
2211
// FRF Controls
2212
//----------------------------------------   
2213
   // WEN for frf from load, FPU result or mov
2214
   assign external_wen_next = ld_ret & ~(ldfsr | ldxfsr) | (is_fpu_result & ~cpx_fcmp_d1 & ~take_ieee_trap);
2215
   assign rf_ecc_gen_next = external_wen_next | vis_wen_next;
2216
 
2217
   dff rf_eccgen_dff(.din(rf_ecc_gen_next), .q(rf_ecc_gen), .clk(clk), .se(se), .si(), .so());
2218
   dff rf_wen_dff(.din(rf_wen_next), .q(rf_wen), .clk(clk), .se(se), .si(), .so());
2219
   // check for flush_pipe for moves
2220
   assign rf_wen_next = rf_ecc_gen & ~(any_op_w2 & flush_w2) | move_wen_w2_valid;
2221
 
2222
 
2223
   // REN and WEN must be mutually exclusive.  This works because WEN is always after W
2224
   // if a new fpop has arrived to cancel it.
2225
   // The even register is the upper half, odd is the lower half
2226
   assign ctl_frf_wen[1] = ((rf_wen & ~rd[0]) | ecc_wen[1]) & ~ctl_frf_ren;   // double or even sgl
2227
   assign ctl_frf_wen[0] = ((rf_wen & (~dest_single | rd[0])) | ecc_wen[0]) & ~ctl_frf_ren; // dbl or odd sgl
2228
 
2229
   // REN for frf  -- rd rs2 in D, rs1 in E
2230
   assign read_rs2 = ren_rs2_e;
2231
   assign read_rs1 = ren_rs1_m;
2232
   assign read_rd = ifu_ffu_fst_d;
2233
   assign read_bst = bst_read_req;
2234
   // expanded out the terms for reading rs2 to help timing
2235
   assign ctl_frf_ren = (read_rs1 | read_rs2 |
2236
                         ifu_ffu_fst_d | bst_read_req);
2237
 
2238
   assign early_frf_rnum[5:1] = read_rs2?  rs2_next[5:1]:
2239
                                read_rs1?  rs1[5:1]:
2240
                                read_bst?  bst_rs[5:1]:
2241
                                           write_addr[5:1];
2242
   assign     st_rd_d[5:1] = {ifu_ffu_frd_d[0] & ~ifu_ffu_ldst_single_d, ifu_ffu_frd_d[4:1]};
2243
   mux2ds #5 frf_rnum_mux(.dout(frf_rnum[5:1]),
2244
                            .in0(early_frf_rnum[5:1]),
2245
                            .in1(st_rd_d[5:1]),
2246
                            .sel0(~read_rd),
2247
                            .sel1(read_rd));
2248
 
2249
   assign frf_tid[1:0] = (read_rd)? ifu_ffu_tid_d[1:0]: tid_next[1:0];
2250
 
2251
   assign wen_rs2_ecc = |ecc_wen[1:0] & ren_rs2_w4;
2252
   assign wen_rs1_ecc = |ecc_wen[1:0] & ren_rs1_w5;
2253
   assign blk_rd[5:1] = rd[5:1] + {2'b0, bld_cnt_d3[2:0]};
2254
   assign write_addr[5:1] = wen_rs2_ecc?          rs2[5:1] :
2255
                            wen_rs1_ecc?          rs1[5:1] :
2256
                            bst_issue_c6?         bst_rs[5:1]:
2257
                            blk_load_pending?     blk_rd[5:1]:
2258
                                                  rd[5:1];
2259
 
2260
   // Address is combination of tid and rnum
2261
   assign ctl_frf_addr[6:0] = {frf_tid[1:0], frf_rnum[5:1]};
2262
 
2263
//----------------------------------------
2264
// Data from FPU forwarded to IFU
2265
//----------------------------------------
2266
   // Send thrid to IFU
2267
   assign ffu_ifu_tid_w2[1:0] = tid;
2268
 
2269
   // completion is always signalled after the w-stage so that flush_pipe, etc.
2270
   // can be checked.  For lds and fpops this is signalled after they write.
2271
   // ecc_kill_rs2_w is checked for move and fst because the "compeletion"
2272
   // is signalled over a separate interface so rollback can occur.
2273
   // This is staged 2 cycles to allow for the cycle of ecc generation.
2274
   //
2275
   assign ffu_op_done_next = ((is_fpu_result & ~take_ieee_trap) | fld_done |
2276
                              blk_ld_done | bst_done | vis_result |
2277
                              fst_w & ~bst_w & ~kill_w);
2278
   dff ffu_op_done_dff(.din(ffu_op_done_next), .clk(clk), .q(ffu_op_done),
2279
                       .se(se), .si(), .so());
2280
   // sotheas,9/14/04: fixed eco 6910, send done on dtlb perr for block store
2281
   //                  using registered version of lsu_ffu_st_dtlb_perr_g
2282
   //   WAS:
2283
   //     assign ffu_op_done_vld = ffu_op_done & ~(any_op_w2 & flush_w2) | move_w2_vld;
2284
   assign ffu_op_done_vld = (ffu_op_done | (bst_issue_c1 & !st_dtlb_perr_w2_l) )
2285
                            & ~(any_op_w2 & flush_w2) | move_w2_vld;
2286
   dff ffu_op_done2_dff(.din(ffu_op_done_vld), .clk(clk), .q(ffu_ifu_fpop_done_w2),
2287
                        .se(se), .si(), .so());
2288
 
2289
//------------------------------------------
2290
// FSR Controls
2291
//------------------------------------------
2292
 
2293
   assign ctl_dp_fp_thr[0] = ~extra_tid[1] & ~extra_tid[0];
2294
   assign ctl_dp_fp_thr[1] = ~extra_tid[1] &  extra_tid[0];
2295
   assign ctl_dp_fp_thr[2] =  extra_tid[1] & ~extra_tid[0];
2296
   assign ctl_dp_fp_thr[3] =  extra_tid[1] &  extra_tid[0];
2297
 
2298
   // CC's
2299
   assign fcc_num_dec[0] = ~fcc_num[1] & ~fcc_num[0];
2300
   assign fcc_num_dec[1] = ~fcc_num[1] & fcc_num[0];
2301
   assign fcc_num_dec[2] = fcc_num[1] & ~fcc_num[0];
2302
   assign fcc_num_dec[3] = fcc_num[1] & fcc_num[0];
2303
 
2304
   // selects to load next fsr from
2305
   // stfsr or fmov always clear ftt
2306
   assign clear_ftt = stfsr_w2_vld | move_w2_vld | is_fpu_result;
2307
 
2308
   assign ctl_dp_fsr_sel_fpu[3:0] = ({4{is_fpu_result | move_w2_vld | take_other_trap | stfsr_w2_vld}}
2309
                                     & ctl_dp_fp_thr[3:0]);
2310
   assign ctl_dp_fsr_sel_ld[3:0] =  ({4{ld_ret & (ldfsr | ldxfsr)}} &
2311
                                     ~ctl_dp_fsr_sel_fpu[3:0] & ctl_dp_fp_thr[3:0]);
2312
   assign ctl_dp_fsr_sel_old[3:0] =  (~ctl_dp_fsr_sel_fpu[3:0] & ~ctl_dp_fsr_sel_ld[3:0]);
2313
 
2314
   // align fcc depending on which fcc_num was used
2315
   mux4ds #8 fcc_ret_mux(.dout (fpu_fcc[7:0]),
2316
                         .in0  ({dp_ctl_fsr_fcc[7:2], cpx_fccval_d1[1:0]}),
2317
                         .in1  ({dp_ctl_fsr_fcc[7:4], cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[1:0]}),
2318
                         .in2  ({dp_ctl_fsr_fcc[7:6], cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[3:0]}),
2319
                         .in3  ({cpx_fccval_d1[1:0], dp_ctl_fsr_fcc[5:0]}),
2320
                         .sel0 (fcc_num_dec[0]),
2321
                         .sel1 (fcc_num_dec[1]),
2322
                         .sel2 (fcc_num_dec[2]),
2323
                         .sel3 (fcc_num_dec[3]));
2324
 
2325
   // set fcc if this was an fcmp instruction
2326
   assign fcc_sel_fpu = cpx_fcmp_d1 & ~ieee_trap & is_fpu_result;
2327
   assign fcc_sel_ld = ~is_fpu_result & ldfsr_vld;
2328
   assign fcc_sel_ldx = ~is_fpu_result & ~ldfsr_vld & ldxfsr_vld;
2329
   assign fcc_sel_old = ~fcc_sel_fpu & ~fcc_sel_ld & ~fcc_sel_ldx;
2330
   mux4ds #8 fcc_set_mux(.dout (ctl_dp_fcc_w2[7:0]),
2331
                                           .in0  (dp_ctl_fsr_fcc[7:0]),
2332
                                           .in1  (fpu_fcc[7:0]),
2333
                                           .in2  (dp_ctl_ld_fcc[7:0]),
2334
                                           .in3  ({dp_ctl_fsr_fcc[7:2], dp_ctl_ld_fcc[1:0]}),
2335
                                           .sel0 (fcc_sel_old),
2336
                                           .sel1 (fcc_sel_fpu),
2337
                                           .sel2 (fcc_sel_ldx),
2338
                                           .sel3 (fcc_sel_ld));
2339
 
2340
   // get fcc's from ldfsr instruction
2341
   assign ldfsr_vld = ldfsr & load_pending;
2342
   assign ldxfsr_vld = ldxfsr & load_pending;
2343
 
2344
   wire   cc_changed_w2;
2345
 
2346
   // fcc set by fcmp, ldfsr or ldxfsr
2347
   assign cc_changed = fcc_sel_fpu |
2348
                             fld_done & (ldfsr_vld | ldxfsr_vld);
2349
 
2350
   dff cc_changed_dff(.din(cc_changed), .clk(clk), .q(cc_changed_w2),
2351
                      .se(se), .si(), .so());
2352
   dff #(8) cc_next(.din(ctl_dp_fcc_w2[7:0]), .clk(clk), .q(ffu_ifu_cc_w2[7:0]),
2353
                    .se(se), .si(), .so());
2354
 
2355
   assign ffu_ifu_cc_vld_w2[3:0] = ctl_dp_fp_thr[3:0] & {4{cc_changed_w2}};
2356
 
2357
//-----------------------------------
2358
// Traps
2359
//-----------------------------------   
2360
 
2361
   // illegal instruction if blk ld/st is not 8 dp regs aligned
2362
   dff illegal_vis_e2m (.din(illegal_vis_e), .clk(clk), .q(illegal_vis_m),
2363
                        .se(se), .si(), .so());
2364
   assign illegal_blk_m = (blk_ld_m | bst_m) & (rd[0] | rd[1] | rd[2] | rd[3]) & ~dest_single;
2365
   assign ffu_tlu_ill_inst_m = illegal_blk_m | illegal_vis_m;
2366
 
2367
   assign ctl_dp_ftt_w2 = take_ieee_trap      ? 3'b001 :
2368
                          unimpl_qual_w2        ? 3'b011 :
2369
                          clear_ftt           ? 3'b000 :
2370
                                                3'bxxx;
2371
 
2372
// SPARC V9 Underflow, Overflow, Inexact behavior: 
2373
//
2374
//      Exception(s)             |            Current
2375
//      Detected    Trap Enable  | fp_        Exception
2376
//      in f.p.     Mask Bits    | exception_ Bits (in
2377
//      operation   (in FSR.TEM) | ieee_754   FSR.cexc)   
2378
//      ----------- ------------ | Trap       ----------- 
2379
//      of  uf  nx  OFM UFM NXM  | Occurs?    ofc ufc nxc  Notes
2380
//      --- --- --- --- --- ---  | ---------- --- --- ---  -----
2381
//       -   -   -   x   x   x   |  no         0   0   0   
2382
//       -   -   *   x   x   0   |  no         0   0   1 
2383
//       -   *   *   x   0   0   |  no         0   1   1
2384
//       *   -   *   0   x   0   |  no         1   0   1    (2)
2385
//                               | 
2386
//       -   -   *   x   x   1   |  yes        0   0   1 
2387
//       -   *   *   x   0   1   |  yes        0   0   1 
2388
//       -   *   -   x   1   x   |  yes        0   1   0
2389
//       -   *   *   x   1   x   |  yes        0   1   0 
2390
//       *   -   *   1   x   x   |  yes        1   0   0    (2)
2391
//       *   -   *   0   x   1   |  yes        0   0   1    (2)
2392
//
2393
//      (2) Overflow is always accompanied by inexact.
2394
//
2395
//
2396
// The FPU does not receive FSR.TEM bits. FSR.TEM bits are used within
2397
// the FFU for the following cases:
2398
// (1) fp_exception_ieee_754 trap detection
2399
//     If a FPop generates an IEEE exception (nv, of, uf, dz, nx) for
2400
//     which the corresponding trap enable (TEM) is set, then a
2401
//     fp_exception_ieee_754 trap is caused. FSR.cexc field has one bit
2402
//     set corresponding to the IEEE exception, and FSR.aexc field is
2403
//     unchanged.
2404
// (2) Clear FSR.nxc if an overflow (underflow) exception does trap
2405
//     because FSR.OFM (FSR.UFM) is set, regardless of whether FSR.NXM
2406
//     is set. Set FSR.ofc (FSR.ufc).
2407
// (3) Clear FSR.ofc (FSR.ufc) if overflow (underflow) exception traps
2408
//     and FSR.OFM (FSR.UFM) is not set and FSR.NXM is set. Set FSR.nxc.
2409
// (4) Clear FSR.ufc if the result is exact (FSR.nxc is not set) and
2410
//     FSR.UFM is not set. This case represents an exact denormalized
2411
//     result.
2412
//
2413
// Note: - FPU will signal underflow to the FFU for all "tiny" results.
2414
//       - FPU always reports inexact along with overflow.
2415
   dff #(5) tem_dff(.din(dp_ctl_fsr_tem[4:0]), .clk(clk), .q(fsr_tem_d1),
2416
                    .se(se), .si(), .so());
2417
   assign fpexc_nxc =
2418
          cpx_fpexc_d1[0] &
2419
          ~(( fsr_tem_d1[3] & cpx_fpexc_d1[3]) |    // enabled  of
2420
            ( fsr_tem_d1[2] & cpx_fpexc_d1[2])  );  // enabled  uf
2421
 
2422
   assign fpexc_ofc =
2423
          cpx_fpexc_d1[3] &
2424
          ~(~fsr_tem_d1[3] & fsr_tem_d1[0] & cpx_fpexc_d1[0]); // disabled of and enabled nx
2425
 
2426
   assign fpexc_ufc =
2427
          cpx_fpexc_d1[2] &
2428
          ~(~fsr_tem_d1[2] & ( fsr_tem_d1[0] & cpx_fpexc_d1[0])) & // disabled uf & enabled nx
2429
          ~(~fsr_tem_d1[2] & ~cpx_fpexc_d1[0]) ; // disabled uf with no inexact
2430
                                                               // (i.e. exact denorm w/ UFM=0)
2431
 
2432
 
2433
   assign ieee_trap_vec[4:0] =
2434
          ({cpx_fpexc_d1[4],
2435
            fpexc_ofc,
2436
            fpexc_ufc,
2437
            cpx_fpexc_d1[1],
2438
            fpexc_nxc       } & fsr_tem_d1[4:0]);
2439
 
2440
 
2441
   // ieee trap has least priority.  Put through a flop for timing reasons
2442
   assign ieee_trap = (|ieee_trap_vec[4:0]);
2443
   assign take_ieee_trap = ieee_trap & is_fpu_result;
2444
   dff trap_ieee_dff(.din(take_ieee_trap), .clk(clk), .q(ffu_tlu_trap_ieee754),
2445
                     .se(se), .si(), .so());
2446
 
2447
   assign take_other_trap = unimpl_qual_w2;
2448
   assign ffu_tlu_trap_other = take_other_trap;
2449
   assign ffu_tlu_trap_ue = ue_trap_w3;
2450
 
2451
   // current exception
2452
   assign fp_exc_w2[4:0] =
2453
          ({cpx_fpexc_d1[4],
2454
            fpexc_ofc,
2455
            fpexc_ufc,
2456
            cpx_fpexc_d1[1],
2457
            fpexc_nxc       });
2458
 
2459
 
2460
 
2461
 
2462
   // accrued exceptions
2463
   // fp_exc_w2 = dp_ctl_fsr_aexc | cpx_fpexc_d1 & {5{~take_ieee_trap}};
2464
   assign fp_exc_w2[9] = dp_ctl_fsr_aexc[4] |
2465
                             is_fpu_result & cpx_fpexc_d1[4] & ~fsr_tem_d1[4];
2466
   assign fp_exc_w2[6] = dp_ctl_fsr_aexc[1] |
2467
                             is_fpu_result & cpx_fpexc_d1[1] & ~fsr_tem_d1[1];
2468
   assign fp_exc_w2[7] = dp_ctl_fsr_aexc[2] |
2469
                             is_fpu_result & fpexc_ufc & ~fsr_tem_d1[2];
2470
   assign fp_exc_w2[8] = dp_ctl_fsr_aexc[3] |
2471
                             is_fpu_result & fpexc_ofc & ~fsr_tem_d1[3];
2472
   assign fp_exc_w2[5] = dp_ctl_fsr_aexc[0] |
2473
                             is_fpu_result & fpexc_nxc & ~fsr_tem_d1[0];
2474
 
2475
   assign ctl_dp_exc_w2[9:5] = fp_exc_w2[9:5];
2476
   // move, abs, etc will clear cexc, fpu_results will update, all else will leave unchanged
2477
   wire   update_cexc;
2478
   assign update_cexc = is_fpu_result | move_w2_vld;
2479
   assign ctl_dp_exc_w2[4:0] = ((update_cexc)? fp_exc_w2[4:0] & {5{is_fpu_result}}:
2480
                                dp_ctl_fsr_cexc[4:0]);
2481
 
2482
 
2483
 
2484
   ////////////////////////////////
2485
   // ECC control
2486
   ////////////////////////////////
2487
   // Generation of the parity bit for writes
2488
   wire [13:0] gen_synd_d1;
2489
   wire        gen_par_hi;
2490
   wire        gen_par_low;
2491
   wire [6:0]  error_inj_data;
2492
   output [13:0] ctl_frf_write_synd;
2493
   dff #(14) gen_synd_dff (.din({dp_ctl_synd_out_high[6:0],dp_ctl_synd_out_low[6:0]}),
2494
                           .q(gen_synd_d1[13:0]), .clk(clk), .se(se), .si(), .so());
2495
   assign  gen_par_hi = ^gen_synd_d1[13:7];
2496
   assign  gen_par_low = ^gen_synd_d1[6:0];
2497
   assign  ctl_frf_write_synd[13:0] = ({gen_par_hi,gen_synd_d1[12:7],gen_par_low,gen_synd_d1[5:0]} ^
2498
                                       {error_inj_data[6:0],error_inj_data[6:0]});
2499
   /////////////////////////////////
2500
   // error injection
2501
   /////////////////////////////////
2502
   // injection doesn't check for flush on wen
2503
   assign  inject_err_next = ifu_ffu_inj_frferr & rf_wen_next;
2504
   assign error_inj_data[6:0] = {7{inject_err}} & err_data[6:0];
2505
   dff #(7) err_data_dff(.din(ifu_exu_ecc_mask[6:0]),
2506
                     .q(err_data[6:0]),
2507
                     .clk(clk), .se(se), .si(), .so());
2508
   dff err_cntl(.din(inject_err_next),
2509
                .q(inject_err),
2510
                .clk(clk), .se(se), .si(), .so());
2511
   // speculate on error injection (don't check flush_pipe etc)
2512
   assign ffu_ifu_inj_ack = inject_err;
2513
 
2514
 
2515
   // check the upper half on a double or a single with an even reg num
2516
   // check the lower half on a double or a single with an odd reg num
2517
   // ecc block will run on frf input for reads
2518
   // otherwise it will run on the rd_data
2519
   assign check_ecc_next = ren_rs2_m | fst_e | ren_rs1_w | bst_issue_c3_next;
2520
   dff check_ecc_dff(.din(check_ecc_next), .clk(clk), .q(ctl_dp_ecc_sel_frf),
2521
                     .se(se), .si(), .so());
2522
   // rs1 will not be checked if a ce was detected on rs2.  If there was a ue on rs2
2523
   // rs1 will be checked and a ce will be corrected, but the error on rs2 will be logged
2524
   assign chk_rs1_w2 = ren_rs1_w2;
2525
   assign chk_ecc_m[1] = fst_m & ~rd[0] & ~output_sel_fsr;
2526
   assign chk_ecc_m[0] = fst_m & (~dest_single | rd[0]) & ~output_sel_fsr;
2527
   assign chk_ecc_w[1] = ren_rs2_w & ~kill_eccchk_w & ~rs2[0];
2528
   assign chk_ecc_w[0] = ren_rs2_w & ~kill_eccchk_w & (~source_single | rs2[0]);
2529
   assign chk_ecc_w2[1] = chk_rs1_w2 & ~rs1[0];
2530
   assign chk_ecc_w2[0] = chk_rs1_w2 & (~source_single | rs1[0]);
2531
 
2532
   assign chk_ecc[1:0] = chk_ecc_m[1:0] | chk_ecc_w[1:0] | chk_ecc_w2[1:0] | {2{bst_issue_c3}};
2533
   dff #(2) chk_ecc_dff(.din(chk_ecc[1:0]), .clk(clk), .q(chk_ecc_prev[1:0]),
2534
                        .se(se), .si(), .so());
2535
 
2536
   assign     error_detected[1] = |dp_ctl_synd_out_high[5:0];
2537
   assign     error_detected[0] = |dp_ctl_synd_out_low[5:0];
2538
 
2539
   assign     possible_ue[1] = ~dp_ctl_synd_out_high[6] & chk_ecc[1];
2540
   assign     possible_ue[0] = ~dp_ctl_synd_out_low[6] & chk_ecc[0];
2541
   assign     ce[1] = dp_ctl_synd_out_high[6] & chk_ecc[1];
2542
   assign     ce[0] = dp_ctl_synd_out_low[6] & chk_ecc[0];
2543
 
2544
   assign rollback_fst_m = ((dp_ctl_synd_out_high[6] & chk_ecc_m[1] & ~disable_ce_m) |
2545
                        (dp_ctl_synd_out_low[6] & chk_ecc_m[0] & ~disable_ce_m));
2546
   dff rollback_m2w(.din(rollback_fst_m), .clk(clk), .q(rollback_fst_w), .se(se), .si(), .so());
2547
   dff #(2) possible_ue_dff(.din(possible_ue[1:0]), .clk(clk), .q(prev_poss_ue[1:0]),
2548
                            .se(se), .si(), .so());
2549
   dff #(2) ce_dff(.din(ce[1:0]), .clk(clk), .q(previous_ce[1:0]),
2550
                            .se(se), .si(), .so());
2551
   dff #(2) err_det_dff(.din(error_detected[1:0]), .clk(clk), .q(prev_err_detected[1:0]),
2552
                            .se(se), .si(), .so());
2553
   assign previous_ue = |(prev_err_detected[1:0] & prev_poss_ue[1:0]);
2554
 
2555
   dff #(2) ecc_wen1_dff(.din(ecc_wen_gen_next[1:0]), .clk(clk), .q(ecc_wen_gen[1:0]),
2556
                        .se(se), .si(), .so());
2557
   dff #(2) ecc_wen2_dff(.din(ecc_wen_next[1:0]), .clk(clk), .q(ecc_wen[1:0]),
2558
                        .se(se), .si(), .so());
2559
   // if the ecc error was in the m stage we need to check for a kill
2560
   // if the ecc error was in the w stage we need to check flush
2561
   // ECC errors on rs1 will not be written back to the frf.  The data that is used will be corrected.
2562
   assign ecc_wen_gen_next[1:0] = previous_ce[1:0] &
2563
          {2{bst_issue_c4 | fst_ce_w | rollback_rs2_w2 | rollback_rs1_w3}};
2564
   assign ecc_wen_next = ecc_wen_gen[1:0] & {2{~(fst_ce_w2 & flush_w2)}};
2565
 
2566
   // pass along ce and ue so trap can be signalled to ffu and tlu
2567
   // if disable_ce_m then don't tell ifu reissue ce.  Instead convert to a ue.
2568
   dff disable_ce_e2m(.din(ifu_exu_disable_ce_e), .clk(clk), .q(disable_ce_m),
2569
                      .se(se), .si(), .so());
2570
   dff disable_ce_m2w(.din(disable_ce_m), .clk(clk), .q(disable_ce_w),
2571
                      .se(se), .si(), .so());
2572
   assign fst_ce_w = rollback_fst_w & ~kill_eccchk_w;
2573
   assign fst_ue_w = fst_w & (previous_ue | (disable_ce_w & |(previous_ce[1:0])))  & ~kill_eccchk_w;
2574
   assign rollback_rs2_w2 = (ren_rs2_w2 & ~flush_w2 & |previous_ce[1:0]
2575
                             & ~rolled_back);
2576
   assign rs2_ce_w2 = ren_rs2_w2 & |previous_ce[1:0] & ~rolled_back & ~previous_ue;
2577
   assign rs2_ue_w2 = ren_rs2_w2 & (previous_ue | (rolled_back & |previous_ce[1:0]));
2578
   // must check for flush because eccchk doesn't do this
2579
   assign rs2_fst_ce_w2_vld = (rs2_ce_w2 | fst_ce_w2) & ~flush_w2;
2580
   assign rs2_fst_ue_w2_vld = (rs2_ue_w2 | fst_ue_w2) & ~flush_w2;
2581
   dff ce_w2w2(.din(fst_ce_w), .clk(clk), .q(fst_ce_w2),
2582
               .se(se), .si(), .so());
2583
   dff ue_w2w2(.din(fst_ue_w), .clk(clk), .q(fst_ue_w2),
2584
               .se(se), .si(), .so());
2585
   dff ce_w22w3(.din(rs2_fst_ce_w2_vld), .clk(clk), .q(rs2_fst_ce_w3),
2586
               .se(se), .si(), .so());
2587
   dff ue_w22w3(.din(rs2_fst_ue_w2_vld), .clk(clk), .q(rs2_fst_ue_w3),
2588
               .se(se), .si(), .so());
2589
 
2590
   assign rs1_ce_w3 = ren_rs1_w3 & |previous_ce[1:0] & ~previous_ue & ~rolled_back;
2591
   assign rollback_rs1_w3 = rs1_ce_w3 & ~ue_trap_w3;
2592
   assign ce_w3 = (rs1_ce_w3 | rs2_fst_ce_w3);
2593
   assign ue_w3 = (ren_rs1_w3 & (previous_ue | (rolled_back & |previous_ce[1:0]))) | rs2_fst_ue_w3;
2594
 
2595
   assign ffu_ifu_ecc_ce_w2 = (ce_w3 | bst_ce_c4);
2596
   assign ffu_ifu_ecc_ue_w2 = (ue_w3 | bst_ue_c4);
2597
 
2598
   // error logging signals.  The error register priority is fst, bst, rs1_ue, rs2_ue, rs1_ce, rs2_ce
2599
   assign log_new_err = (ren_rs2_w2 | bst_issue_c4 | fst_w |
2600
                         (ren_rs1_w3 & previous_ue) | (rs1_ce_w3 & ~rs2_fst_ue_w3));
2601
   assign new_err_reg[5:0] = fst_w ?        rd[5:0]:
2602
                             bst_issue_c4 ? bst_rs[5:0]:
2603
                             ren_rs2_w2 ?    rs2[5:0]:
2604
                                            rs1[5:0];
2605
   assign err_reg_next[5:0] = (log_new_err) ? new_err_reg[5:0] : err_reg_d1[5:0];
2606
   dff #(6) err_reg_dff(.din(err_reg_next[5:0]), .clk(clk), .q(err_reg_d1[5:0]),
2607
                        .se(se), .si(), .so());
2608
   assign ffu_ifu_err_reg_w2[5:0] = err_reg_d1[5:0];
2609
 
2610
   // storage of error syndrome for logging
2611
   // For singles the invalid half of the syndrome is zeroed out.
2612
   // The syndrome reported to the ifu will be latched until a new error is detected
2613
   assign      new_err_synd[13:7] = gen_synd_d1[13:7] & {7{chk_ecc_prev[1]}};
2614
   assign      new_err_synd[6:0] = gen_synd_d1[6:0] & {7{chk_ecc_prev[0]}};
2615
   assign      err_synd_next[13:0] = (log_new_err)? new_err_synd: err_synd_d1;
2616
   dff #(14) err_synd_d1ff(.din(err_synd_next[13:0]), .clk(clk), .q(err_synd_d1[13:0]),
2617
                          .se(se), .si(), .so());
2618
   assign      ffu_ifu_err_synd_w2[13:0] = err_synd_d1[13:0];
2619
 
2620
   // kill moves and fpu ops
2621
   assign ecc_kill_rs2_w2 = rollback_rs2_w2 | (rs2_ue_w2 & nceen);
2622
 
2623
 
2624
   // pipe along enable signal for ue traps
2625
   assign nceen_next = (any_op_e)? ifu_exu_nceen_e: (nceen & ~rollback_fst_w);
2626
   dff nceen_dff(.din(nceen_next), .clk(clk), .q(nceen),
2627
                 .se(se), .si(), .so());
2628
   assign ue_trap_w3 = (ue_w3 | bst_ue_c4) & nceen;
2629
 
2630
   // signals for killing stores on ecc
2631
   // use this to kill any rs2/rd ce   
2632
   assign ffu_ifu_fst_ce_w = rollback_fst_w;
2633
 
2634
   // These signals kill the entry in the store buffer for any ce or trapping ue.  Very critical timing.
2635
   assign possible_kill_st_ce_m = ((fst_m & ~output_sel_fsr & ~(disable_ce_m & ~nceen)) |
2636
                                   (bst_issue_c3 & ~(fixed_bst_ce & ~nceen)));
2637
   assign possible_kill_st_ue_m = (fst_m & ~output_sel_fsr & nceen | bst_issue_c3 & nceen);
2638
   assign kill_st_ce_w = (|previous_ce[1:0]) & possible_kill_st_ce_w;
2639
   assign ffu_lsu_kill_fst_w = (previous_ue)? possible_kill_st_ue_w: kill_st_ce_w;
2640
   dff kill_fst_ce_dff(.din(possible_kill_st_ce_m), .clk(clk), .q(possible_kill_st_ce_w),
2641
                       .se(se), .si(), .so());
2642
   dff kill_fst_ue_dff(.din(possible_kill_st_ue_m), .clk(clk), .q(possible_kill_st_ue_w),
2643
                       .se(se), .si(), .so());
2644
 
2645
   // rollback signals
2646
   assign rollback_c1_next = rollback_rs2_w2 | rollback_rs1_w3;
2647
   dffr #(3) rollback_dff(.din({rollback_c1_next,rollback_c1_vld,rollback_c2}),
2648
                         .q({rollback_c1, rollback_c2, rollback_c3}),
2649
                         .clk(clk), .se(se), .si(), .so(), .rst(reset));
2650
   // if both rs1 and rs2 rollback then the state machine needs to start on rs1
2651
   assign rollback_c1_vld = rollback_c1 & ~ue_trap_w3 & ~rollback_rs1_w3;
2652
 
2653
   assign rolled_back_next = rollback_c1_vld | rolled_back & ~any_op_e;
2654
   dffr rollback_state(.din(rolled_back_next), .q(rolled_back),
2655
                        .rst(reset), .clk(clk),
2656
                        .se(se), .si(), .so());
2657
 
2658
   //////////////////////////////
2659
   // Performance counter signals
2660
   //////////////////////////////
2661
   assign ffu_tlu_fpu_tid[1:0] = tid[1:0] & {2{is_fpu_result}}; // don't toggle wire if not needed
2662
   assign ffu_tlu_fpu_cmplt = is_fpu_result;
2663
 
2664
   sparc_ffu_ctl_visctl visctl(
2665
                               .illegal_vis_e(illegal_vis_e),
2666
                               .vis_nofrf_e(vis_nofrf_e),
2667
                               .visop_e (visop_e),
2668
                               .visop_m (visop_m),
2669
                               .visop_w_vld (visop_w_vld),
2670
                               .vis_wen_next (vis_wen_next),
2671
                               .ifu_ffu_rnd_e(frs2_e[2:0]),
2672
                               .fpu_rnd (fpu_rnd[1:0]),
2673
                               .vis_result(vis_result),
2674
                               /*AUTOINST*/
2675
                               // Outputs
2676
                               .ctl_vis_sel_add(ctl_vis_sel_add),
2677
                               .ctl_vis_sel_log(ctl_vis_sel_log),
2678
                               .ctl_vis_sel_align(ctl_vis_sel_align),
2679
                               .ctl_vis_add32(ctl_vis_add32),
2680
                               .ctl_vis_subtract(ctl_vis_subtract),
2681
                               .ctl_vis_cin(ctl_vis_cin),
2682
                               .ctl_vis_align0(ctl_vis_align0),
2683
                               .ctl_vis_align2(ctl_vis_align2),
2684
                               .ctl_vis_align4(ctl_vis_align4),
2685
                               .ctl_vis_align6(ctl_vis_align6),
2686
                               .ctl_vis_align_odd(ctl_vis_align_odd),
2687
                               .ctl_vis_log_sel_pass(ctl_vis_log_sel_pass),
2688
                               .ctl_vis_log_sel_nand(ctl_vis_log_sel_nand),
2689
                               .ctl_vis_log_sel_nor(ctl_vis_log_sel_nor),
2690
                               .ctl_vis_log_sel_xor(ctl_vis_log_sel_xor),
2691
                               .ctl_vis_log_invert_rs1(ctl_vis_log_invert_rs1),
2692
                               .ctl_vis_log_invert_rs2(ctl_vis_log_invert_rs2),
2693
                               .ctl_vis_log_constant(ctl_vis_log_constant),
2694
                               .ctl_vis_log_pass_const(ctl_vis_log_pass_const),
2695
                               .ctl_vis_log_pass_rs1(ctl_vis_log_pass_rs1),
2696
                               .ctl_vis_log_pass_rs2(ctl_vis_log_pass_rs2),
2697
                               .ffu_exu_rsr_data_hi_m(ffu_exu_rsr_data_hi_m[31:0]),
2698
                               .ffu_exu_rsr_data_mid_m(ffu_exu_rsr_data_mid_m[2:0]),
2699
                               .ffu_exu_rsr_data_lo_m(ffu_exu_rsr_data_lo_m[7:0]),
2700
                               .ctl_dp_wsr_data_w2(ctl_dp_wsr_data_w2[36:0]),
2701
                               .ctl_dp_gsr_wsr_w2(ctl_dp_gsr_wsr_w2[3:0]),
2702
                               .ctl_dp_thr_e(ctl_dp_thr_e[3:0]),
2703
                               // Inputs
2704
                               .clk     (clk),
2705
                               .se      (se),
2706
                               .reset   (reset),
2707
                               .opf     (opf[8:0]),
2708
                               .tid_w2  (tid_w2[1:0]),
2709
                               .tid_e   (tid_e[1:0]),
2710
                               .tid     (tid[1:0]),
2711
                               .kill_w  (kill_w),
2712
                               .ifu_tlu_sraddr_d(ifu_tlu_sraddr_d[6:0]),
2713
                               .exu_ffu_wsr_inst_e(exu_ffu_wsr_inst_e),
2714
                               .exu_ffu_gsr_align_m(exu_ffu_gsr_align_m[2:0]),
2715
                               .exu_ffu_gsr_rnd_m(exu_ffu_gsr_rnd_m[2:0]),
2716
                               .exu_ffu_gsr_mask_m(exu_ffu_gsr_mask_m[31:0]),
2717
                               .exu_ffu_gsr_scale_m(exu_ffu_gsr_scale_m[4:0]),
2718
                               .dp_ctl_fsr_rnd(dp_ctl_fsr_rnd[1:0]),
2719
                               .flush_w2(flush_w2),
2720
                               .thr_match_mw2(thr_match_mw2),
2721
                               .thr_match_ww2(thr_match_ww2),
2722
                               .ifu_tlu_inst_vld_w(ifu_tlu_inst_vld_w),
2723
                               .ue_trap_w3(ue_trap_w3),
2724
                               .frs1_e  (frs1_e[4:0]),
2725
                               .frs2_e  (frs2_e[4:0]),
2726
                               .frd_e   (frd_e[4:0]),
2727
                               .rollback_c3(rollback_c3),
2728
                               .rollback_rs2_w2(rollback_rs2_w2),
2729
                               .visop   (visop),
2730
                               .rollback_rs1_w3(rollback_rs1_w3),
2731
                               .dp_ctl_gsr_mask_e(dp_ctl_gsr_mask_e[31:0]),
2732
                               .dp_ctl_gsr_scale_e(dp_ctl_gsr_scale_e[4:0]));
2733
 
2734
endmodule // sparc_ffu_ctl

powered by: WebSVN 2.1.0

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