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

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [hdl/] [rtl/] [sparc_core/] [lsu_stb_rwdp.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: lsu_stb_rwdp.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
//      Description:    Datapath for STB
24
//                              - Mainly for formatting stb data
25
*/
26
////////////////////////////////////////////////////////////////////////
27
// Global header file includes
28
////////////////////////////////////////////////////////////////////////
29
// system level definition file which contains the /*
30
/* ========== Copyright Header Begin ==========================================
31
*
32
* OpenSPARC T1 Processor File: sys.h
33
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
35
*
36
* The above named program is free software; you can redistribute it and/or
37
* modify it under the terms of the GNU General Public
38
* License version 2 as published by the Free Software Foundation.
39
*
40
* The above named program is distributed in the hope that it will be
41
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
42
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
43
* General Public License for more details.
44
*
45
* You should have received a copy of the GNU General Public
46
* License along with this work; if not, write to the Free Software
47
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
48
*
49
* ========== Copyright Header End ============================================
50
*/
51
// -*- verilog -*-
52
////////////////////////////////////////////////////////////////////////
53
/*
54
//
55
// Description:         Global header file that contain definitions that
56
//                      are common/shared at the systme level
57
*/
58
////////////////////////////////////////////////////////////////////////
59
//
60
// Setting the time scale
61
// If the timescale changes, JP_TIMESCALE may also have to change.
62
`timescale      1ps/1ps
63
 
64
//
65
// JBUS clock
66
// =========
67
//
68
 
69
 
70
 
71
// Afara Link Defines
72
// ==================
73
 
74
// Reliable Link
75
 
76
 
77
 
78
 
79
// Afara Link Objects
80
 
81
 
82
// Afara Link Object Format - Reliable Link
83
 
84
 
85
 
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
// Afara Link Object Format - Congestion
94
 
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
 
104
 
105
// Afara Link Object Format - Acknowledge
106
 
107
 
108
 
109
 
110
 
111
 
112
 
113
 
114
 
115
 
116
 
117
// Afara Link Object Format - Request
118
 
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
 
129
 
130
 
131
 
132
 
133
 
134
 
135
// Afara Link Object Format - Message
136
 
137
 
138
 
139
// Acknowledge Types
140
 
141
 
142
 
143
 
144
// Request Types
145
 
146
 
147
 
148
 
149
 
150
// Afara Link Frame
151
 
152
 
153
 
154
//
155
// UCB Packet Type
156
// ===============
157
//
158
 
159
 
160
 
161
 
162
 
163
 
164
 
165
 
166
 
167
 
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
//
176
// UCB Data Packet Format
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
// Size encoding for the UCB_SIZE_HI/LO field
210
// 000 - byte
211
// 001 - half-word
212
// 010 - word
213
// 011 - double-word
214
// 111 - quad-word
215
 
216
 
217
 
218
 
219
 
220
 
221
 
222
//
223
// UCB Interrupt Packet Format
224
// ===========================
225
//
226
 
227
 
228
 
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
//`define UCB_THR_HI             9      // (6) cpu/thread ID shared with
237
//`define UCB_THR_LO             4             data packet format
238
//`define UCB_PKT_HI             3      // (4) packet type shared with
239
//`define UCB_PKT_LO             0      //     data packet format
240
 
241
 
242
 
243
 
244
 
245
 
246
 
247
//
248
// FCRAM Bus Widths
249
// ================
250
//
251
 
252
 
253
 
254
 
255
 
256
 
257
//
258
// ENET clock periods
259
// ==================
260
//
261
 
262
 
263
 
264
 
265
//
266
// JBus Bridge defines
267
// =================
268
//
269
 
270
 
271
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
//
281
// PCI Device Address Configuration
282
// ================================
283
//
284
 
285
 
286
 
287
 
288
 
289
 
290
 
291
 
292
 
293
 
294
 
295
 
296
 
297
 
298
 
299
 
300
 
301
 
302
 
303
 
304
 
305
 
306
 
307
                                        // time scale definition
308
 
309
/*
310
/* ========== Copyright Header Begin ==========================================
311
*
312
* OpenSPARC T1 Processor File: iop.h
313
* Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
314
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
315
*
316
* The above named program is free software; you can redistribute it and/or
317
* modify it under the terms of the GNU General Public
318
* License version 2 as published by the Free Software Foundation.
319
*
320
* The above named program is distributed in the hope that it will be
321
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
322
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
323
* General Public License for more details.
324
*
325
* You should have received a copy of the GNU General Public
326
* License along with this work; if not, write to the Free Software
327
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
328
*
329
* ========== Copyright Header End ============================================
330
*/
331
//-*- verilog -*-
332
////////////////////////////////////////////////////////////////////////
333
/*
334
//
335
//  Description:        Global header file that contain definitions that
336
//                      are common/shared at the IOP chip level
337
*/
338
////////////////////////////////////////////////////////////////////////
339
 
340
 
341
// Address Map Defines
342
// ===================
343
 
344
 
345
 
346
 
347
// CMP space
348
 
349
 
350
 
351
// IOP space
352
 
353
 
354
 
355
 
356
                               //`define ENET_ING_CSR     8'h84
357
                               //`define ENET_EGR_CMD_CSR 8'h85
358
 
359
 
360
 
361
 
362
 
363
 
364
 
365
 
366
 
367
 
368
 
369
 
370
 
371
 
372
 
373
// L2 space
374
 
375
 
376
 
377
// More IOP space
378
 
379
 
380
 
381
 
382
 
383
//Cache Crossbar Width and Field Defines
384
//======================================
385
 
386
 
387
 
388
 
389
 
390
 
391
 
392
 
393
 
394
 
395
 
396
 
397
 
398
 
399
 
400
 
401
 
402
 
403
 
404
 
405
 
406
 
407
 
408
 
409
 
410
 
411
 
412
 
413
 
414
 
415
 
416
 
417
 
418
 
419
 
420
 
421
 
422
 
423
 
424
 
425
 
426
 
427
 
428
 
429
 
430
//bits 133:128 are shared by different fields
431
//for different packet types.
432
 
433
 
434
 
435
 
436
 
437
 
438
 
439
 
440
 
441
 
442
 
443
 
444
 
445
 
446
 
447
 
448
 
449
 
450
 
451
 
452
 
453
 
454
 
455
 
456
 
457
 
458
 
459
 
460
 
461
 
462
 
463
 
464
 
465
 
466
 
467
 
468
 
469
 
470
 
471
 
472
 
473
 
474
 
475
 
476
 
477
 
478
 
479
 
480
 
481
 
482
 
483
 
484
 
485
 
486
 
487
 
488
 
489
 
490
 
491
 
492
 
493
 
494
//End cache crossbar defines
495
 
496
 
497
// Number of COS supported by EECU 
498
 
499
 
500
 
501
// 
502
// BSC bus sizes
503
// =============
504
//
505
 
506
// General
507
 
508
 
509
 
510
 
511
// CTags
512
 
513
 
514
 
515
 
516
 
517
 
518
 
519
 
520
 
521
 
522
 
523
 
524
 
525
// reinstated temporarily
526
 
527
 
528
 
529
 
530
// CoS
531
 
532
 
533
 
534
 
535
 
536
 
537
// L2$ Bank
538
 
539
 
540
 
541
// L2$ Req
542
 
543
 
544
 
545
 
546
 
547
 
548
 
549
 
550
 
551
 
552
 
553
 
554
 
555
// L2$ Ack
556
 
557
 
558
 
559
 
560
 
561
 
562
 
563
 
564
// Enet Egress Command Unit
565
 
566
 
567
 
568
 
569
 
570
 
571
 
572
 
573
 
574
 
575
 
576
 
577
 
578
 
579
// Enet Egress Packet Unit
580
 
581
 
582
 
583
 
584
 
585
 
586
 
587
 
588
 
589
 
590
 
591
 
592
 
593
// This is cleaved in between Egress Datapath Ack's
594
 
595
 
596
 
597
 
598
 
599
 
600
 
601
 
602
// Enet Egress Datapath
603
 
604
 
605
 
606
 
607
 
608
 
609
 
610
 
611
 
612
 
613
 
614
 
615
 
616
 
617
 
618
 
619
// In-Order / Ordered Queue: EEPU
620
// Tag is: TLEN, SOF, EOF, QID = 15
621
 
622
 
623
 
624
 
625
 
626
 
627
// Nack + Tag Info + CTag
628
 
629
 
630
 
631
 
632
// ENET Ingress Queue Management Req
633
 
634
 
635
 
636
 
637
 
638
 
639
 
640
 
641
 
642
 
643
 
644
 
645
// ENET Ingress Queue Management Ack
646
 
647
 
648
 
649
 
650
 
651
 
652
 
653
 
654
// Enet Ingress Packet Unit
655
 
656
 
657
 
658
 
659
 
660
 
661
 
662
 
663
 
664
 
665
 
666
 
667
// ENET Ingress Packet Unit Ack
668
 
669
 
670
 
671
 
672
 
673
 
674
 
675
// In-Order / Ordered Queue: PCI
676
// Tag is: CTAG
677
 
678
 
679
 
680
 
681
 
682
// PCI-X Request
683
 
684
 
685
 
686
 
687
 
688
 
689
 
690
 
691
 
692
 
693
 
694
// PCI_X Acknowledge
695
 
696
 
697
 
698
 
699
 
700
 
701
 
702
 
703
 
704
 
705
 
706
//
707
// BSC array sizes
708
//================
709
//
710
 
711
 
712
 
713
 
714
 
715
 
716
 
717
 
718
 
719
 
720
 
721
 
722
// ECC syndrome bits per memory element
723
 
724
 
725
 
726
 
727
//
728
// BSC Port Definitions
729
// ====================
730
//
731
// Bits 7 to 4 of curr_port_id
732
 
733
 
734
 
735
 
736
 
737
 
738
 
739
 
740
// Number of ports of each type
741
 
742
 
743
// Bits needed to represent above
744
 
745
 
746
// How wide the linked list pointers are
747
// 60b for no payload (2CoS)
748
// 80b for payload (2CoS)
749
 
750
//`define BSC_OBJ_PTR   80
751
//`define BSC_HD1_HI    69
752
//`define BSC_HD1_LO    60
753
//`define BSC_TL1_HI    59
754
//`define BSC_TL1_LO    50
755
//`define BSC_CT1_HI    49
756
//`define BSC_CT1_LO    40
757
//`define BSC_HD0_HI    29
758
//`define BSC_HD0_LO    20
759
//`define BSC_TL0_HI    19
760
//`define BSC_TL0_LO    10
761
//`define BSC_CT0_HI     9
762
//`define BSC_CT0_LO     0
763
 
764
 
765
 
766
 
767
 
768
 
769
 
770
 
771
 
772
 
773
 
774
 
775
 
776
 
777
 
778
 
779
 
780
 
781
 
782
 
783
 
784
 
785
 
786
 
787
 
788
 
789
 
790
 
791
 
792
 
793
 
794
 
795
 
796
 
797
// I2C STATES in DRAMctl
798
 
799
 
800
 
801
 
802
 
803
 
804
 
805
//
806
// IOB defines
807
// ===========
808
//
809
 
810
 
811
 
812
 
813
 
814
 
815
 
816
 
817
 
818
 
819
 
820
 
821
 
822
 
823
 
824
 
825
 
826
 
827
 
828
//`define IOB_INT_STAT_WIDTH   32
829
//`define IOB_INT_STAT_HI      31
830
//`define IOB_INT_STAT_LO       0
831
 
832
 
833
 
834
 
835
 
836
 
837
 
838
 
839
 
840
 
841
 
842
 
843
 
844
 
845
 
846
 
847
 
848
 
849
 
850
 
851
 
852
 
853
 
854
 
855
 
856
 
857
 
858
 
859
 
860
 
861
 
862
 
863
 
864
 
865
 
866
 
867
 
868
 
869
 
870
 
871
 
872
 
873
 
874
 
875
 
876
 
877
 
878
 
879
 
880
// fixme - double check address mapping
881
// CREG in `IOB_INT_CSR space
882
 
883
 
884
 
885
 
886
 
887
 
888
 
889
 
890
 
891
 
892
// CREG in `IOB_MAN_CSR space
893
 
894
 
895
 
896
 
897
 
898
 
899
 
900
 
901
 
902
 
903
 
904
 
905
 
906
 
907
 
908
 
909
 
910
 
911
 
912
 
913
 
914
 
915
 
916
 
917
 
918
 
919
 
920
 
921
 
922
 
923
 
924
 
925
 
926
 
927
 
928
 
929
 
930
// Address map for TAP access of SPARC ASI
931
 
932
 
933
 
934
 
935
 
936
 
937
 
938
 
939
 
940
 
941
 
942
 
943
 
944
//
945
// CIOP UCB Bus Width
946
// ==================
947
//
948
//`define IOB_EECU_WIDTH       16  // ethernet egress command
949
//`define EECU_IOB_WIDTH       16
950
 
951
//`define IOB_NRAM_WIDTH       16  // NRAM (RLDRAM previously)
952
//`define NRAM_IOB_WIDTH        4
953
 
954
 
955
 
956
 
957
//`define IOB_ENET_ING_WIDTH   32  // ethernet ingress
958
//`define ENET_ING_IOB_WIDTH    8
959
 
960
//`define IOB_ENET_EGR_WIDTH    4  // ethernet egress
961
//`define ENET_EGR_IOB_WIDTH    4
962
 
963
//`define IOB_ENET_MAC_WIDTH    4  // ethernet MAC
964
//`define ENET_MAC_IOB_WIDTH    4
965
 
966
 
967
 
968
 
969
//`define IOB_BSC_WIDTH         4  // BSC
970
//`define BSC_IOB_WIDTH         4
971
 
972
 
973
 
974
 
975
 
976
 
977
 
978
//`define IOB_CLSP_WIDTH        4  // clk spine unit
979
//`define CLSP_IOB_WIDTH        4
980
 
981
 
982
 
983
 
984
 
985
//
986
// CIOP UCB Buf ID Type
987
// ====================
988
//
989
 
990
 
991
 
992
//
993
// Interrupt Device ID
994
// ===================
995
//
996
// Caution: DUMMY_DEV_ID has to be 9 bit wide
997
//          for fields to line up properly in the IOB.
998
 
999
 
1000
 
1001
//
1002
// Soft Error related definitions 
1003
// ==============================
1004
//
1005
 
1006
 
1007
 
1008
//
1009
// CMP clock
1010
// =========
1011
//
1012
 
1013
 
1014
 
1015
 
1016
//
1017
// NRAM/IO Interface
1018
// =================
1019
//
1020
 
1021
 
1022
 
1023
 
1024
 
1025
 
1026
 
1027
 
1028
 
1029
 
1030
//
1031
// NRAM/ENET Interface
1032
// ===================
1033
//
1034
 
1035
 
1036
 
1037
 
1038
 
1039
 
1040
 
1041
//
1042
// IO/FCRAM Interface
1043
// ==================
1044
//
1045
 
1046
 
1047
 
1048
 
1049
 
1050
 
1051
//
1052
// PCI Interface
1053
// ==================
1054
// Load/store size encodings
1055
// -------------------------
1056
// Size encoding
1057
// 000 - byte
1058
// 001 - half-word
1059
// 010 - word
1060
// 011 - double-word
1061
// 100 - quad
1062
 
1063
 
1064
 
1065
 
1066
 
1067
 
1068
//
1069
// JBI<->SCTAG Interface
1070
// =======================
1071
// Outbound Header Format
1072
 
1073
 
1074
 
1075
 
1076
 
1077
 
1078
 
1079
 
1080
 
1081
 
1082
 
1083
 
1084
 
1085
 
1086
 
1087
 
1088
 
1089
 
1090
 
1091
 
1092
 
1093
 
1094
 
1095
 
1096
 
1097
 
1098
 
1099
// Inbound Header Format
1100
 
1101
 
1102
 
1103
 
1104
 
1105
 
1106
 
1107
 
1108
 
1109
 
1110
 
1111
 
1112
 
1113
 
1114
 
1115
 
1116
 
1117
 
1118
 
1119
 
1120
//
1121
// JBI->IOB Mondo Header Format
1122
// ============================
1123
//
1124
 
1125
 
1126
 
1127
 
1128
 
1129
 
1130
 
1131
 
1132
 
1133
 
1134
 
1135
 
1136
 
1137
 
1138
// JBI->IOB Mondo Bus Width/Cycle
1139
// ==============================
1140
// Cycle  1 Header[15:8]
1141
// Cycle  2 Header[ 7:0]
1142
// Cycle  3 J_AD[127:120]
1143
// Cycle  4 J_AD[119:112]
1144
// .....
1145
// Cycle 18 J_AD[  7:  0]
1146
 
1147
 
1148
 
1149
////////////////////////////////////////////////////////////////////////
1150
// Local header file includes / local defines
1151
////////////////////////////////////////////////////////////////////////
1152
 
1153
module lsu_stb_rwdp (/*AUTOARG*/
1154
   // Outputs
1155
   so, stb_rdata_ramd_buf, stb_rdata_ramd_b74_buf, lsu_stb_st_data_g,
1156
   // Inputs
1157
   rclk, si, se, rst_tri_en, exu_lsu_rs3_data_e,
1158
   lsu_stb_data_early_sel_e, lsu_stb_data_final_sel_m,
1159
   exu_lsu_rs2_data_e, lsu_st_sz_bhww_m, lsu_st_sz_dw_m,
1160
   lsu_st_sz_bhw_m, lsu_st_sz_wdw_m, lsu_st_sz_b_m, lsu_st_sz_w_m,
1161
   lsu_st_sz_hw_m, lsu_st_sz_hww_m, ffu_lsu_data, lsu_st_hw_le_g,
1162
   lsu_st_w_or_dbl_le_g, lsu_st_x_le_g, lsu_swap_sel_default_g,
1163
   lsu_swap_sel_default_byte_7_2_g, stb_rdata_ramd,
1164
   stb_rdata_ramd_b74
1165
   ) ;
1166
 
1167
   input  rclk ;
1168
   input  si;
1169
   output so;
1170
   input  se;
1171
   input  rst_tri_en;
1172
 
1173
input   [63:0]          exu_lsu_rs3_data_e ;    // data for store.
1174
input   [3:0]            lsu_stb_data_early_sel_e ;// early source of data for stb
1175
input                   lsu_stb_data_final_sel_m ;// early source of data for stb
1176
input   [63:0]          exu_lsu_rs2_data_e ;    // rs2 data for cas.
1177
input                   lsu_st_sz_bhww_m ;      // byte or hword or word
1178
input                   lsu_st_sz_dw_m ;        // double word
1179
input                   lsu_st_sz_bhw_m ;       // byte or hword
1180
input                   lsu_st_sz_wdw_m ;       // word or dword
1181
input                   lsu_st_sz_b_m ;         // byte
1182
input                   lsu_st_sz_w_m ;         // word
1183
input                   lsu_st_sz_hw_m ;        // hword
1184
input                   lsu_st_sz_hww_m ;       // hword or word
1185
input   [63:0]           ffu_lsu_data ;  // fp store data - m stage
1186
//input                 lsu_bendian_access_g ;  // bendian st
1187
//input                 lsu_stdbl_inst_m ;      // stdbl
1188
 
1189
   input        lsu_st_hw_le_g;
1190
   input        lsu_st_w_or_dbl_le_g;
1191
   input        lsu_st_x_le_g;
1192
   input        lsu_swap_sel_default_g;
1193
   input        lsu_swap_sel_default_byte_7_2_g;
1194
 
1195
   input [69:0] stb_rdata_ramd;
1196
   input        stb_rdata_ramd_b74;
1197
 
1198
   output [69:0] stb_rdata_ramd_buf;
1199
   output        stb_rdata_ramd_b74_buf;
1200
 
1201
output  [63:0]           lsu_stb_st_data_g ;     // data to be written to stb
1202
 
1203
wire    [7:0]    byte0, byte1, byte2, byte3 ;
1204
wire    [7:0]    byte4, byte5, byte6, byte7 ;
1205
wire    [7:0]    swap_byte0, swap_byte1, swap_byte2, swap_byte3 ;
1206
wire    [7:0]    swap_byte4, swap_byte5, swap_byte6, swap_byte7 ;
1207
 
1208
wire    [63:0]   stb_st_data_g ;
1209
wire    [63:0]   stb_st_data_early_e ;
1210
wire    [63:0]   stb_st_data_early_m ;
1211
wire    [63:0]   stb_st_data_final_m ;
1212
wire            st_sz_bhww_g ;
1213
wire            st_sz_dw_g ;
1214
wire            st_sz_bhw_g ;
1215
wire            st_sz_wdw_g ;
1216
wire            st_sz_b_g ;
1217
wire            st_sz_w_g ;
1218
wire            st_sz_hw_g ;
1219
wire            st_sz_hww_g ;
1220
//wire          bendian ;
1221
//wire          stdbl_g ;
1222
 
1223
   wire clk;
1224
   assign clk = rclk;
1225
 
1226
//assign  stb_st_data_early_e[63:0] =       //@@ bw_u1_muxi41d_2x   
1227
//        lsu_stb_data_early_sel_e[0] ? 64'hffff_ffff_ffff_ffff :                       // ldstub writes all ones
1228
//                lsu_stb_data_early_sel_e[1] ? exu_lsu_rs2_data_e[63:0] :              // cas pkt1 uses rs2
1229
//                      lsu_stb_data_early_sel_e[2] ? exu_lsu_rs3_data_e[63:0] :        // use rs3/rd data.
1230
//                              lsu_stb_data_early_sel_e[3] ? {exu_lsu_rs2_data_e[31:0],exu_lsu_rs3_data_e[31:0]} :  
1231
                                                                                        // else std non-alt
1232
//                                              64'hxxxx_xxxx_xxxx_xxxx ;                               
1233
 
1234
mux4ds #(64) stb_st_data_early_e_mx (
1235
 .in0 (64'hffff_ffff_ffff_ffff),
1236
 .in1 (exu_lsu_rs2_data_e[63:0]),
1237
 .in2 (exu_lsu_rs3_data_e[63:0]),
1238
 .in3 ({exu_lsu_rs2_data_e[31:0],exu_lsu_rs3_data_e[31:0]}),
1239
 .sel0(lsu_stb_data_early_sel_e[0]),
1240
 .sel1(lsu_stb_data_early_sel_e[1]),
1241
 .sel2(lsu_stb_data_early_sel_e[2]),
1242
 .sel3(lsu_stb_data_early_sel_e[3]),
1243
 .dout(stb_st_data_early_e[63:0]));
1244
 
1245
 
1246
// Stage early data to m
1247
dff #(64)  stgm_rs2     (             //@@ bw_u1_soffi_2x
1248
        .din            (stb_st_data_early_e[63:0]),
1249
        .q              (stb_st_data_early_m[63:0]),
1250
        .clk            (clk),
1251
        .se             (se), .si     (), .so ()
1252
        );
1253
 
1254
assign  stb_st_data_final_m[63:0] =    //@@ bw_u1_muxi21_2x
1255
        lsu_stb_data_final_sel_m ? stb_st_data_early_m[63:0] : ffu_lsu_data[63:0] ;       // mux in fpst data
1256
 
1257
// Precursor of data to be stored in stb
1258
// For ldstub, all one's need to be written to stb.
1259
// For cas/swap, data remains unmodified.
1260
// Stage final data to g
1261
dff #(64)  stgg_rs2     (             //@@ bw_u1_soffi_2x
1262
        .din            (stb_st_data_final_m[63:0]),
1263
        .q              (stb_st_data_g[63:0]),
1264
        .clk            (clk),
1265
        .se             (se), .si     (), .so ()
1266
        );
1267
 
1268
dff #(8)  stgm_sel     (             //@@ bw_u1_soff_8x
1269
        .din            ({lsu_st_sz_bhww_m,lsu_st_sz_dw_m,lsu_st_sz_bhw_m,lsu_st_sz_wdw_m,
1270
                        lsu_st_sz_b_m,lsu_st_sz_w_m,lsu_st_sz_hw_m,lsu_st_sz_hww_m}),
1271
        .q              ({st_sz_bhww_g,st_sz_dw_g,st_sz_bhw_g,st_sz_wdw_g,
1272
                        st_sz_b_g,st_sz_w_g,st_sz_hw_g,st_sz_hww_g}),
1273
        .clk            (clk),
1274
        .se             (se), .si     (), .so ()
1275
        );
1276
 
1277
// Now format data for st data.
1278
assign  byte0[7:0] = stb_st_data_g[7:0] ; //@@ PASS
1279
assign  byte1[7:0] = stb_st_data_g[15:8] ; //@@ PASS
1280
assign  byte2[7:0] = stb_st_data_g[23:16] ; //@@ PASS
1281
assign  byte3[7:0] = stb_st_data_g[31:24] ; //@@ PASS
1282
assign  byte4[7:0] = stb_st_data_g[39:32] ; //@@ PASS
1283
assign  byte5[7:0] = stb_st_data_g[47:40] ; //@@ PASS
1284
assign  byte6[7:0] = stb_st_data_g[55:48] ; //@@ PASS
1285
assign  byte7[7:0] = stb_st_data_g[63:56] ; //@@ PASS
1286
 
1287
 
1288
//assign        bendian = lsu_bendian_access_g ;        // bendian store
1289
 
1290
// Control needs to move to lsu_stb_rwctl once this is fully tested.
1291
 
1292
// First do swap for big-endian vs little-endian case.
1293
 
1294
//wire  swap_sel_default ;
1295
 
1296
//assign        swap_sel_default = bendian | (~bendian & st_sz_b_g) ;
1297
 
1298
// swap byte0
1299
//assign        swap_byte0[7:0] =               //@@ bw_u1_muxi41d_4x
1300
//      lsu_swap_sel_default_g ? byte0[7:0] : 
1301
//              lsu_st_hw_le_g ? byte1[7:0] :
1302
//                      lsu_st_w_or_dbl_le_g ? byte3[7:0] :
1303
//                              lsu_st_x_le_g ? byte7[7:0] : 8'bxxxx_xxxx ; 
1304
 
1305
mux4ds #(8) swap_byte0_mx (
1306
  .in0 (byte0[7:0]), .sel0(lsu_swap_sel_default_g),
1307
  .in1 (byte1[7:0]), .sel1(lsu_st_hw_le_g),
1308
  .in2 (byte3[7:0]), .sel2(lsu_st_w_or_dbl_le_g),
1309
  .in3 (byte7[7:0]), .sel3(lsu_st_x_le_g),
1310
  .dout(swap_byte0[7:0]));
1311
 
1312
// swap byte1
1313
//assign        swap_byte1[7:0] =               //@@ bw_u1_muxi41d_4x
1314
//      lsu_swap_sel_default_g ? byte1[7:0] : 
1315
//              lsu_st_hw_le_g ? byte0[7:0] :   
1316
//                       lsu_st_w_or_dbl_le_g ? byte2[7:0] :
1317
//                               lsu_st_x_le_g ? byte6[7:0] : 8'bxxxx_xxxx ; 
1318
 
1319
mux4ds #(8) swap_byte1_mx (
1320
 .in0 (byte1[7:0]), .sel0(lsu_swap_sel_default_g),
1321
 .in1 (byte0[7:0]), .sel1(lsu_st_hw_le_g),
1322
 .in2 (byte2[7:0]), .sel2(lsu_st_w_or_dbl_le_g),
1323
 .in3 (byte6[7:0]), .sel3(lsu_st_x_le_g),
1324
 .dout (swap_byte1[7:0]));
1325
 
1326
// swap byte2
1327
//assign        swap_byte2[7:0] =                //@@ bw_u1_muxi31d_4x
1328
//      lsu_swap_sel_default_g ? byte2[7:0] : 
1329
//              lsu_st_w_or_dbl_le_g ? byte1[7:0] :
1330
//                      lsu_st_x_le_g ? byte5[7:0] : 8'bxxxx_xxxx ; 
1331
 
1332
mux3ds #(8) swap_byte2_mx (
1333
  .in0 (byte2[7:0]), .sel0(lsu_swap_sel_default_byte_7_2_g),
1334
  .in1 (byte1[7:0]), .sel1(lsu_st_w_or_dbl_le_g),
1335
  .in2 (byte5[7:0]), .sel2(lsu_st_x_le_g),
1336
  .dout (swap_byte2[7:0]));
1337
 
1338
// swap byte3
1339
//assign        swap_byte3[7:0] =                 //@@ bw_u1_muxi31d_4x
1340
//      lsu_swap_sel_default_g ? byte3[7:0] : 
1341
//              lsu_st_w_or_dbl_le_g ? byte0[7:0] :
1342
//                      lsu_st_x_le_g ? byte4[7:0] : 8'bxxxx_xxxx ; 
1343
 
1344
mux3ds #(8) swap_byte3_mx (
1345
 .in0 (byte3[7:0]), .sel0(lsu_swap_sel_default_byte_7_2_g),
1346
 .in1 (byte0[7:0]), .sel1(lsu_st_w_or_dbl_le_g),
1347
 .in2 (byte4[7:0]), .sel2(lsu_st_x_le_g),
1348
 .dout(swap_byte3[7:0]));
1349
 
1350
// swap byte4
1351
//assign        swap_byte4[7:0] =                 //@@ bw_u1_muxi31d_4x
1352
//      lsu_swap_sel_default_g ? byte4[7:0] : 
1353
//               lsu_st_w_or_dbl_le_g ? byte7[7:0] :
1354
//                       lsu_st_x_le_g ? byte3[7:0] : 8'bxxxx_xxxx ; 
1355
 
1356
mux3ds #(8) swap_byte4_mx (
1357
.in0 (byte4[7:0]), .sel0(lsu_swap_sel_default_byte_7_2_g),
1358
.in1 (byte7[7:0]), .sel1(lsu_st_w_or_dbl_le_g),
1359
.in2 (byte3[7:0]), .sel2(lsu_st_x_le_g),
1360
.dout(swap_byte4[7:0]));
1361
 
1362
// swap byte5
1363
//assign        swap_byte5[7:0] =                 //@@ bw_u1_muxi31d_4x
1364
//      lsu_swap_sel_default_g ? byte5[7:0] : 
1365
//               lsu_st_w_or_dbl_le_g ? byte6[7:0] :
1366
//                        lsu_st_x_le_g ? byte2[7:0] : 8'bxxxx_xxxx ; 
1367
 
1368
mux3ds #(8) swap_byte5_mx (
1369
 .in0 (byte5[7:0]), .sel0(lsu_swap_sel_default_byte_7_2_g),
1370
 .in1 (byte6[7:0]), .sel1(lsu_st_w_or_dbl_le_g),
1371
 .in2 (byte2[7:0]), .sel2(lsu_st_x_le_g),
1372
 .dout(swap_byte5[7:0]));
1373
 
1374
// swap byte6
1375
//assign        swap_byte6[7:0] =                 //@@ bw_u1_muxi31d_4x
1376
//      lsu_swap_sel_default_g ? byte6[7:0] : 
1377
//               lsu_st_w_or_dbl_le_g ? byte5[7:0] :
1378
//                        lsu_st_x_le_g ? byte1[7:0] : 8'bxxxx_xxxx ; 
1379
 
1380
mux3ds #(8) swap_byte6_mx (
1381
 .in0 (byte6[7:0]), .sel0 (lsu_swap_sel_default_byte_7_2_g),
1382
 .in1 (byte5[7:0]), .sel1 (lsu_st_w_or_dbl_le_g),
1383
 .in2 (byte1[7:0]), .sel2 (lsu_st_x_le_g),
1384
 .dout(swap_byte6[7:0]));
1385
 
1386
// swap byte7
1387
//assign        swap_byte7[7:0] =                 //@@ bw_u1_muxi31d_4x
1388
//      lsu_swap_sel_default_g ? byte7[7:0] : 
1389
//               lsu_st_w_or_dbl_le_g ? byte4[7:0] :
1390
//                  lsu_st_x_le_g ? byte0[7:0] : 8'bxxxx_xxxx ; 
1391
 
1392
mux3ds #(8) swap_byte7_mx (
1393
 .in0 (byte7[7:0]), .sel0 (lsu_swap_sel_default_byte_7_2_g),
1394
 .in1 (byte4[7:0]), .sel1 (lsu_st_w_or_dbl_le_g),
1395
 .in2 (byte0[7:0]), .sel2 (lsu_st_x_le_g),
1396
 .dout (swap_byte7[7:0]));
1397
 
1398
// Now replicate date across 8 bytes.
1399
 
1400
// replicated byte0
1401
assign  lsu_stb_st_data_g[7:0] = swap_byte0[7:0] ;        // all data sizes //@@ bw_u1_inv_8x
1402
 
1403
// replicated byte1
1404
assign  lsu_stb_st_data_g[15:8] =                 //@@ bw_u1_muxi21_6x
1405
                st_sz_b_g ? swap_byte0[7:0] : swap_byte1[7:0] ;
1406
 
1407
// replicated byte2
1408
assign  lsu_stb_st_data_g[23:16] =                //@@ bw_u1_muxi21_6x
1409
                st_sz_bhw_g ? swap_byte0[7:0] : swap_byte2[7:0] ;
1410
 
1411
// replicated byte3
1412
//assign        lsu_stb_st_data_g[31:24] =                 //@@ bw_u1_muxi31d_6x
1413
//              st_sz_b_g ? swap_byte0 :                        // swap_byte
1414
//                      st_sz_hw_g ? swap_byte1 :       // hword
1415
//                              st_sz_wdw_g ? swap_byte3 : // dword or word
1416
//                                      8'bxxxx_xxxx ;
1417
 
1418
   wire st_sz_b_g_sel, st_sz_hw_g_sel, st_sz_wdw_g_sel;
1419
   assign st_sz_b_g_sel = st_sz_b_g & ~rst_tri_en;
1420
   assign st_sz_hw_g_sel = st_sz_hw_g & ~rst_tri_en;
1421
   assign st_sz_wdw_g_sel = st_sz_wdw_g | rst_tri_en;
1422
 
1423
mux3ds #(8) rpl_byte3_mx (
1424
  .in0 (swap_byte0[7:0]), .sel0 (st_sz_b_g_sel),
1425
  .in1 (swap_byte1[7:0]), .sel1 (st_sz_hw_g_sel),
1426
  .in2 (swap_byte3[7:0]), .sel2 (st_sz_wdw_g_sel),
1427
  .dout (lsu_stb_st_data_g[31:24]));
1428
 
1429
// replicated byte4
1430
assign  lsu_stb_st_data_g[39:32] =                 //@@ bw_u1_muxi21_6x
1431
        st_sz_bhww_g ? swap_byte0[7:0] : swap_byte4[7:0] ;        // dword
1432
 
1433
 
1434
// replicated byte5
1435
//assign        lsu_stb_st_data_g[47:40] =                 //@@ bw_u1_muxi31d_6x
1436
//              st_sz_b_g ? swap_byte0 :                        // swap_byte 
1437
//                      st_sz_hww_g ? swap_byte1 :      // hword or word
1438
//                              st_sz_dw_g ? swap_byte5 : // dword
1439
//                                      8'bxxxx_xxxx ;
1440
 
1441
    wire  st_sz_hww_g_sel, st_sz_dw_g_sel;
1442
   assign st_sz_hww_g_sel = st_sz_hww_g & ~rst_tri_en;
1443
   assign st_sz_dw_g_sel = st_sz_dw_g | rst_tri_en;
1444
 
1445
mux3ds #(8) rpl_byte5_mx (
1446
  .in0 (swap_byte0[7:0]), .sel0(st_sz_b_g_sel),
1447
  .in1 (swap_byte1[7:0]), .sel1(st_sz_hww_g_sel),
1448
  .in2 (swap_byte5[7:0]), .sel2(st_sz_dw_g_sel),
1449
  .dout(lsu_stb_st_data_g[47:40]));
1450
 
1451
// replicated byte6
1452
//assign        lsu_stb_st_data_g[55:48] =                 //@@ bw_u1_muxi31d_6x
1453
//              st_sz_bhw_g ? swap_byte0 :              // swap_byte or hword
1454
//                      st_sz_w_g ? swap_byte2 :                // word
1455
//                              st_sz_wdw_g ? swap_byte6 : // dword
1456
//                                      8'bxxxx_xxxx ;
1457
 
1458
   wire   st_sz_bhw_g_sel, st_sz_w_g_sel;
1459
   assign st_sz_bhw_g_sel = st_sz_bhw_g & ~rst_tri_en;
1460
   assign st_sz_w_g_sel = st_sz_w_g & ~rst_tri_en;
1461
 
1462
 
1463
mux3ds #(8) rpl_byte6_mx (
1464
  .in0 (swap_byte0[7:0]),
1465
  .in1 (swap_byte2[7:0]),
1466
  .in2 (swap_byte6[7:0]),
1467
  .sel0(st_sz_bhw_g_sel),
1468
  .sel1(st_sz_w_g_sel),
1469
  .sel2(st_sz_dw_g_sel),
1470
  .dout(lsu_stb_st_data_g[55:48]));
1471
 
1472
// replicated byte7
1473
//assign        lsu_stb_st_data_g[63:56] =                //@@ bw_u1_muxi41d_6x
1474
//              st_sz_b_g ? swap_byte0 :                        // swap_byte
1475
//                      st_sz_hw_g ? swap_byte1 :       // hword
1476
//                              st_sz_w_g ? swap_byte3 :        // word
1477
//                                      st_sz_dw_g ? swap_byte7 : // dword
1478
//                                              8'bxxxx_xxxx ;
1479
 
1480
mux4ds #(8) rpl_byte7_mx (
1481
  .in0(swap_byte0[7:0]), .sel0(st_sz_b_g_sel),
1482
  .in1(swap_byte1[7:0]), .sel1(st_sz_hw_g_sel),
1483
  .in2(swap_byte3[7:0]), .sel2(st_sz_w_g_sel),
1484
  .in3(swap_byte7[7:0]), .sel3(st_sz_dw_g_sel),
1485
  .dout (lsu_stb_st_data_g[63:56]));
1486
 
1487
//=========================================================
1488
//stb rdata buffer
1489
   assign stb_rdata_ramd_buf[69:0] = stb_rdata_ramd[69:0];
1490
   assign stb_rdata_ramd_b74_buf = stb_rdata_ramd_b74;
1491
 
1492
endmodule

powered by: WebSVN 2.1.0

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