1 |
7 |
fafa1971 |
#!/bin/bash
|
2 |
|
|
|
3 |
49 |
fafa1971 |
# Check command line parameter
|
4 |
|
|
if ( (test $# != 1) || ((test $1 != "-me") && (test $1 != "-se") && (test $1 != "-ee")) ) then
|
5 |
|
|
echo "update_sparccore - Script to update SPARC Core sources from a fresh OpenSPARC installation";
|
6 |
|
|
echo "Usage:";
|
7 |
|
|
echo " update_sparccore {-me|-se|-ee}";
|
8 |
|
|
echo "where parameter refers to the S1 Core version you want to obtain in your environment:";
|
9 |
|
|
echo " -me : S1 Core Memory-less Edition (single-thread, no L1 caches)";
|
10 |
|
|
echo " -se : S1 Core Single-thread Edition (single-thread, normal 16K+8K caches)";
|
11 |
|
|
echo " -ee : S1 Core Elite Edition (four threads support, normal 16K+8K caches)";
|
12 |
|
|
echo "NOTE: To run this script you MUST have the OpenSPARC T1 environment unpacked";
|
13 |
|
|
echo " and the T1_ROOT variable properly set in your S1_ROOT/sourceme file.";
|
14 |
|
|
exit 1;
|
15 |
|
|
fi
|
16 |
|
|
|
17 |
7 |
fafa1971 |
# Set source and destination directories
|
18 |
109 |
albert.wat |
test_var S1_ROOT
|
19 |
|
|
test_var T1_ROOT
|
20 |
7 |
fafa1971 |
SRC_DIR=$T1_ROOT/design/sys/iop
|
21 |
|
|
DST_DIR=$S1_ROOT/hdl/rtl/sparc_core
|
22 |
|
|
|
23 |
|
|
# Clean destination directory
|
24 |
15 |
fafa1971 |
rm -f $DST_DIR/*.*
|
25 |
|
|
rm -f $DST_DIR/include/*.*
|
26 |
7 |
fafa1971 |
|
27 |
|
|
# Copy all the Verilog files of the SPARC Core into destination directory
|
28 |
|
|
cp $SRC_DIR/include/*.h $DST_DIR/include
|
29 |
|
|
cp $SRC_DIR/srams/rtl/*.v $DST_DIR
|
30 |
|
|
cp $SRC_DIR/analog/bw_clk/rtl/*.v $DST_DIR
|
31 |
|
|
cp $SRC_DIR/analog/bw_rng/rtl/*.v $DST_DIR
|
32 |
|
|
find $SRC_DIR/common -name "*.v" -exec cp {} $DST_DIR \;
|
33 |
|
|
find $SRC_DIR/pr_macro -name "*.v" -exec cp {} $DST_DIR \;
|
34 |
|
|
find $SRC_DIR/sparc -name "*.v" -exec cp {} $DST_DIR \;
|
35 |
|
|
|
36 |
|
|
# Remove synthetized files -- if any
|
37 |
|
|
find $DST_DIR -name "*_flat.v" -exec rm -f {} \;
|
38 |
|
|
find $DST_DIR -name "*_flat_nc.v" -exec rm -f {} \;
|
39 |
|
|
find $DST_DIR -name "*_hier.v" -exec rm -f {} \;
|
40 |
|
|
|
41 |
93 |
fafa1971 |
# Also remove SPU files
|
42 |
|
|
rm -f $DST_DIR/*spu*.v
|
43 |
|
|
|
44 |
|
|
# Remove other unused files (according to liuyadong)
|
45 |
47 |
fafa1971 |
cd $DST_DIR
|
46 |
|
|
rm bw_r_l2t.v bw_r_cm16x40.v bw_r_cm16x40b.v bw_r_dcm.v bw_r_efa.v bw_r_l2d.v bw_r_l2d_32k.v \
|
47 |
|
|
bw_r_l2d_rep_bot.v bw_r_l2d_rep_top.v bw_r_rf16x128d.v bw_r_rf32x108.v bw_rf_16x65.v bw_rf_16x81.v \
|
48 |
|
|
bw_clk_cclk_hdr_48x.v bw_clk_cclk_hdr_64x.v bw_clk_cclk_inv_128x.v bw_clk_cclk_inv_48x.v \
|
49 |
|
|
bw_clk_cclk_inv_64x.v bw_clk_cclk_inv_96x.v bw_clk_cclk_scanlasr_2x.v bw_clk_cclk_sync.v \
|
50 |
|
|
bw_clk_gclk_center_3inv.v bw_clk_gclk_inv_192x.v bw_clk_gclk_inv_224x.v bw_clk_gclk_inv_288x.v \
|
51 |
|
|
bw_clk_gclk_inv_r90_192x.v bw_clk_gclk_inv_r90_224x.v bw_clk_gclk_inv_r90_256x.v bw_clk_gclk_sctag_3inv.v \
|
52 |
|
|
bw_clk_gl.v bw_clk_gl_fdbk.v bw_clk_gl_hz.v bw_clk_gl_rstce_rtl.v bw_clk_gl_vrt_all.v flop_rptrs_xa0.v \
|
53 |
|
|
flop_rptrs_xa1.v flop_rptrs_xb0.v flop_rptrs_xb1.v flop_rptrs_xb2.v flop_rptrs_xb3.v flop_rptrs_xc0.v \
|
54 |
|
|
flop_rptrs_xc1.v flop_rptrs_xc2.v flop_rptrs_xc3.v flop_rptrs_xc4.v flop_rptrs_xc5.v flop_rptrs_xc6.v \
|
55 |
|
|
flop_rptrs_xc7.v bw_rng.v cluster_header_ctu.v cluster_header_dup.v cluster_header_sync.v dbl_buf.v \
|
56 |
|
|
sync_pulse_synchronizer.v synchronizer_asr_dup.v ucb_bus_in.v ucb_bus_out.v ucb_flow_2buf.v \
|
57 |
|
|
ucb_flow_jbi.v ucb_flow_spi.v ucb_noflow.v spc_pcx_buf.v
|
58 |
|
|
|
59 |
113 |
albert.wat |
## Clean the files by substituting the $error System Task and applying defines with Icarus preprocessor
|
60 |
|
|
#for file in $DST_DIR/*.v ; do
|
61 |
|
|
# sed -e 's/\$error/\$display/g' $file | sed -e 's/negedge rclk or rst_l/negedge rclk/g' > $DST_DIR/temp.v
|
62 |
|
|
# if(test $1 == "-me" || test $1 == "-se") then
|
63 |
|
|
# iverilog -E -D CMP_CLK_PERIOD=1 -D FPGA_SYN -D FPGA_SYN_1THREAD -D FPGA_SYN_NO_SPU -I $DST_DIR/include -o$file $DST_DIR/temp.v
|
64 |
|
|
# else
|
65 |
|
|
# iverilog -E -D CMP_CLK_PERIOD=1 -D FPGA_SYN -D FPGA_SYN_NO_SPU -I $DST_DIR/include -o$file $DST_DIR/temp.v
|
66 |
|
|
# fi
|
67 |
|
|
# # These steps are required because Icarus does not allow this kind of comments
|
68 |
|
|
# sed -e 's/\* ========== Copyright Header Begin/\/\* ========== Copyright Header Begin/g' $file > $DST_DIR/temp.v
|
69 |
|
|
# mv -f $DST_DIR/temp.v $file
|
70 |
|
|
#done
|
71 |
7 |
fafa1971 |
|
72 |
113 |
albert.wat |
## Correct some strange strings
|
73 |
|
|
#sed -e 's/sparc_exu_alulogic logic/sparc_exu_alulogic logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_exu_alu.v > $DST_DIR/temp.v
|
74 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_exu_alu.v
|
75 |
|
|
#sed -e 's/logic/logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_ffu_ctl_visctl.v > $DST_DIR/temp.v
|
76 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_ffu_ctl_visctl.v
|
77 |
|
|
#sed -e 's/$display(\"ILLEGAL_THR_STATE\"/\/\/$display(\"ILLEGAL_THR_STATE\"/g' sparc_ifu_thrfsm.v > $DST_DIR/temp.v
|
78 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_ifu_thrfsm.v
|
79 |
|
|
#sed -e 's/(\* keep = "yes" \*)//g' $DST_DIR/bw_r_frf.v > $DST_DIR/temp.v
|
80 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_frf.v
|
81 |
|
|
#sed -e 's/synthesis translate_/synopsys translate_/g' $DST_DIR/bw_r_irf.v > $DST_DIR/temp.v
|
82 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_irf.v
|
83 |
|
|
#sed -e 's/initial onereg/\/\/initial onereg/g' $DST_DIR/bw_r_irf_register.v > $DST_DIR/temp.v
|
84 |
|
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_irf_register.v
|
85 |
61 |
fafa1971 |
|
86 |
113 |
albert.wat |
## After preprocessing we can safely delete the include directory
|
87 |
|
|
#rm -f $DST_DIR/include/*.*
|
88 |
61 |
fafa1971 |
|
89 |
113 |
albert.wat |
## Disable L1 Instruction and Data Caches if required
|
90 |
|
|
#if(test $1 == "-me") then
|
91 |
|
|
# cp -f $S1_ROOT/tools/src/bw_r_dcd.v $DST_DIR
|
92 |
|
|
# cp -f $S1_ROOT/tools/src/bw_r_icd.v $DST_DIR
|
93 |
|
|
# cp -f $S1_ROOT/tools/src/bw_r_idct.v $DST_DIR
|
94 |
|
|
#fi
|
95 |
41 |
fafa1971 |
|
96 |
113 |
albert.wat |
## Hack the SPARC Core to add the external stall input from the bridge
|
97 |
|
|
## Cookbook from book "OpenSPARC Internals", paragraph 6.8
|
98 |
97 |
fafa1971 |
|
99 |
113 |
albert.wat |
## Top-level of SPARC Core (s1_top.sparc)
|
100 |
|
|
#sed -e 's/pcx_spc_grant_px,/pcx_spc_grant_px,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc.v |
|
101 |
|
|
# sed -e 's/pcx_spc_grant_px;/pcx_spc_grant_px;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
102 |
|
|
# sed -e 's/sparc_ifu ifu(/sparc_ifu ifu(.wbm_spc_stall(wbm_spc_stall),.wbm_spc_resume(wbm_spc_resume),/g' > $DST_DIR/sparc_TMP.v
|
103 |
|
|
#mv -f $DST_DIR/sparc_TMP.v $DST_DIR/sparc.v
|
104 |
97 |
fafa1971 |
|
105 |
113 |
albert.wat |
## Fetch unit (s1_top.sparc.ifu)
|
106 |
|
|
#sed -e 's/ffu_ifu_stallreq,/ffu_ifu_stallreq,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu.v |
|
107 |
|
|
# sed -e 's/ffu_ifu_stallreq;/ffu_ifu_stallreq;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
108 |
|
|
# sed -e 's/sparc_ifu_swl swl(/sparc_ifu_swl swl(.wbm_spc_stall(wbm_spc_stall),.wbm_spc_resume(wbm_spc_resume),/g' > $DST_DIR/sparc_ifu_TMP.v
|
109 |
|
|
#mv -f $DST_DIR/sparc_ifu_TMP.v $DST_DIR/sparc_ifu.v
|
110 |
7 |
fafa1971 |
|
111 |
113 |
albert.wat |
## Switch logic unit (s1_top.sparc.ifu.swl)
|
112 |
|
|
#sed -e 's/thr_config_in_m,/thr_config_in_m,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu_swl.v |
|
113 |
|
|
# sed -e 's/thr_config_in_m;/thr_config_in_m;input wbm_spc_stall;input wbm_spc_resume;wire wait_state;/g' |
|
114 |
|
|
# sed -e 's/sparc_ifu_thrcmpl compl(/sparc_ifu_thrcmpl compl(.wbm_spc_stall(wbm_spc_stall),.wbm_spc_resume(wbm_spc_resume),.wait_state(wait_state),/g' |
|
115 |
|
|
# sed -e 's/(~wm_stbwait | stb_retry);/(~wm_stbwait|stb_retry)\&(~wait_state|wbm_spc_resume);/g' |
|
116 |
|
|
# sed -e 's/wm_stbwait & ~stb_retry);/wm_stbwait \& ~stb_retry|wait_state \& ~wbm_spc_resume);/g' > $DST_DIR/sparc_ifu_swl_TMP.v
|
117 |
|
|
#mv -f $DST_DIR/sparc_ifu_swl_TMP.v $DST_DIR/sparc_ifu_swl.v
|
118 |
97 |
fafa1971 |
|
119 |
113 |
albert.wat |
## Stall completion logic (s1_top.sparc.ifu.swl.compl)
|
120 |
|
|
#sed -e 's/clear_wmo_e,/clear_wmo_e,wbm_spc_stall,wbm_spc_resume,wait_state,/g' $DST_DIR/sparc_ifu_thrcmpl.v |
|
121 |
|
|
# sed -e 's/clear_wmo_e;/clear_wmo_e;input wbm_spc_stall;input wbm_spc_resume;output wait_state;wire wait_next;/g' |
|
122 |
|
|
# sed -e 's/endmodule/assign wait_next=wbm_spc_stall|(wait_state \& ~wbm_spc_resume);\nendmodule/g' |
|
123 |
|
|
# sed -e 's/endmodule/dffr wait_ff(.din(wait_next),.q(wait_state),.clk(clk),.rst(reset),.se(se),.si(),.so());\nendmodule/g' |
|
124 |
|
|
# sed -e 's/assign completion/assign completion[0]/g' |
|
125 |
|
|
# sed -e 's/endmodule/assign completion[1]=completion[0];\nendmodule/g' |
|
126 |
|
|
# sed -e 's/endmodule/assign completion[2]=completion[0];\nendmodule/g' |
|
127 |
|
|
# sed -e 's/endmodule/assign completion[3]=completion[0];\nendmodule/g' |
|
128 |
|
|
# sed -e 's/wm_stbwait));/wm_stbwait|wait_state));/g' > $DST_DIR/sparc_ifu_thrcmpl_TMP.v
|
129 |
|
|
#mv -f $DST_DIR/sparc_ifu_thrcmpl_TMP.v $DST_DIR/sparc_ifu_thrcmpl.v
|
130 |
97 |
fafa1971 |
|
131 |
113 |
albert.wat |
## This is a temporary hack to take a top-level SPARC Core with the SPU instance removed by-hand (ifdef is wrong)
|
132 |
|
|
#cp -f $S1_ROOT/tools/src/sparc.v $DST_DIR
|
133 |
93 |
fafa1971 |
|
134 |
7 |
fafa1971 |
# Copy also behavioral libraries used for RTL simulations
|
135 |
|
|
DST_DIR=$S1_ROOT/hdl/behav/sparc_libs
|
136 |
15 |
fafa1971 |
rm -f $DST_DIR/*.*
|
137 |
7 |
fafa1971 |
cp $SRC_DIR/../../../lib/m1/m1.behV $DST_DIR/m1_lib.v
|
138 |
|
|
cp $SRC_DIR/../../../lib/u1/u1.behV $DST_DIR/u1_lib.v
|
139 |
|
|
|
140 |
109 |
albert.wat |
|