1 |
7 |
fafa1971 |
#!/bin/bash
|
2 |
|
|
|
3 |
|
|
# Set source and destination directories
|
4 |
|
|
SRC_DIR=$T1_ROOT/design/sys/iop
|
5 |
|
|
DST_DIR=$S1_ROOT/hdl/rtl/sparc_core
|
6 |
|
|
|
7 |
|
|
# Clean destination directory
|
8 |
15 |
fafa1971 |
rm -f $DST_DIR/*.*
|
9 |
|
|
rm -f $DST_DIR/include/*.*
|
10 |
7 |
fafa1971 |
|
11 |
|
|
# Copy all the Verilog files of the SPARC Core into destination directory
|
12 |
|
|
cp $SRC_DIR/include/*.h $DST_DIR/include
|
13 |
|
|
cp $SRC_DIR/srams/rtl/*.v $DST_DIR
|
14 |
|
|
cp $SRC_DIR/analog/bw_clk/rtl/*.v $DST_DIR
|
15 |
|
|
cp $SRC_DIR/analog/bw_rng/rtl/*.v $DST_DIR
|
16 |
|
|
find $SRC_DIR/common -name "*.v" -exec cp {} $DST_DIR \;
|
17 |
|
|
find $SRC_DIR/pr_macro -name "*.v" -exec cp {} $DST_DIR \;
|
18 |
|
|
find $SRC_DIR/sparc -name "*.v" -exec cp {} $DST_DIR \;
|
19 |
|
|
|
20 |
|
|
# Remove synthetized files -- if any
|
21 |
|
|
find $DST_DIR -name "*_flat.v" -exec rm -f {} \;
|
22 |
|
|
find $DST_DIR -name "*_flat_nc.v" -exec rm -f {} \;
|
23 |
|
|
find $DST_DIR -name "*_hier.v" -exec rm -f {} \;
|
24 |
|
|
|
25 |
47 |
fafa1971 |
# Remove unused files (according to liuyadong)
|
26 |
|
|
cd $DST_DIR
|
27 |
|
|
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 \
|
28 |
|
|
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 \
|
29 |
|
|
bw_clk_cclk_hdr_48x.v bw_clk_cclk_hdr_64x.v bw_clk_cclk_inv_128x.v bw_clk_cclk_inv_48x.v \
|
30 |
|
|
bw_clk_cclk_inv_64x.v bw_clk_cclk_inv_96x.v bw_clk_cclk_scanlasr_2x.v bw_clk_cclk_sync.v \
|
31 |
|
|
bw_clk_gclk_center_3inv.v bw_clk_gclk_inv_192x.v bw_clk_gclk_inv_224x.v bw_clk_gclk_inv_288x.v \
|
32 |
|
|
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 \
|
33 |
|
|
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 \
|
34 |
|
|
flop_rptrs_xa1.v flop_rptrs_xb0.v flop_rptrs_xb1.v flop_rptrs_xb2.v flop_rptrs_xb3.v flop_rptrs_xc0.v \
|
35 |
|
|
flop_rptrs_xc1.v flop_rptrs_xc2.v flop_rptrs_xc3.v flop_rptrs_xc4.v flop_rptrs_xc5.v flop_rptrs_xc6.v \
|
36 |
|
|
flop_rptrs_xc7.v bw_rng.v cluster_header_ctu.v cluster_header_dup.v cluster_header_sync.v dbl_buf.v \
|
37 |
|
|
sync_pulse_synchronizer.v synchronizer_asr_dup.v ucb_bus_in.v ucb_bus_out.v ucb_flow_2buf.v \
|
38 |
|
|
ucb_flow_jbi.v ucb_flow_spi.v ucb_noflow.v spc_pcx_buf.v
|
39 |
|
|
|
40 |
|
|
# Clean the files by substituting the $error System Task and applying defines with Icarus preprocessor
|
41 |
7 |
fafa1971 |
for file in $DST_DIR/*.v ; do
|
42 |
|
|
sed -e 's/\$error/\$display/g' $file | sed -e 's/negedge rclk or rst_l/negedge rclk/g' > $DST_DIR/temp.v
|
43 |
47 |
fafa1971 |
iverilog -E -D FPGA_SYN -D FPGA_SYN_1THREAD -D FPGA_SYN_NO_SPU -I $DST_DIR/include -o$file $DST_DIR/temp.v
|
44 |
|
|
# vpp +include+$DST_DIR/include -D FPGA_SYN -D FPGA_SYN_1THREAD -D FPGA_SYN_NO_SPU $DST_DIR/temp.v > $file
|
45 |
|
|
sed -e 's/\* ========== Copyright Header Begin/\/\* ========== Copyright Header Begin/g' $file | sed -e 's/if (\$time > (4\* ))/if(\$time>2)/g' > $DST_DIR/temp.v
|
46 |
7 |
fafa1971 |
mv -f $DST_DIR/temp.v $file
|
47 |
|
|
done
|
48 |
|
|
|
49 |
47 |
fafa1971 |
# Disable L1 Instruction and Data Caches
|
50 |
41 |
fafa1971 |
cp -f $S1_ROOT/tools/src/bw_r_dcd.v $DST_DIR
|
51 |
|
|
cp -f $S1_ROOT/tools/src/bw_r_icd.v $DST_DIR
|
52 |
|
|
cp -f $S1_ROOT/tools/src/bw_r_idct.v $DST_DIR
|
53 |
|
|
|
54 |
7 |
fafa1971 |
# Hack the SPARC Core to add the external stall input from the bridge
|
55 |
|
|
sed -e 's/pcx_spc_grant_px,/pcx_spc_grant_px, wbm_spc_stallreq,/g' $DST_DIR/sparc.v |
|
56 |
|
|
sed -e 's/pcx_spc_grant_px;/pcx_spc_grant_px; input wbm_spc_stallreq;/g' |
|
57 |
|
|
sed -e 's/sparc_ifu ifu(/sparc_ifu ifu( .wbm_spc_stallreq(wbm_spc_stallreq),/g' > $DST_DIR/sparc_TMP.v
|
58 |
|
|
mv -f $DST_DIR/sparc_TMP.v $DST_DIR/sparc.v
|
59 |
|
|
sed -e 's/ffu_ifu_stallreq,/ffu_ifu_stallreq, wbm_spc_stallreq,/g' $DST_DIR/sparc_ifu.v |
|
60 |
|
|
sed -e 's/ffu_ifu_stallreq;/ffu_ifu_stallreq; input wbm_spc_stallreq;/g' |
|
61 |
|
|
sed -e 's/sparc_ifu_fcl fcl(/sparc_ifu_fcl fcl( .wbm_spc_stallreq(wbm_spc_stallreq),/g' > $DST_DIR/sparc_ifu_TMP.v
|
62 |
|
|
mv -f $DST_DIR/sparc_ifu_TMP.v $DST_DIR/sparc_ifu.v
|
63 |
|
|
sed -e 's/ffu_ifu_stallreq,/ffu_ifu_stallreq, wbm_spc_stallreq,/g' $DST_DIR/sparc_ifu_fcl.v |
|
64 |
|
|
sed -e 's/assign all_stallreq = ifq_fcl_stallreq/assign all_stallreq = ifq_fcl_stallreq | wbm_spc_stallreq/g' > $DST_DIR/sparc_ifu_fcl_TMP.v
|
65 |
|
|
mv -f $DST_DIR/sparc_ifu_fcl_TMP.v $DST_DIR/sparc_ifu_fcl.v
|
66 |
|
|
|
67 |
|
|
# Copy also behavioral libraries used for RTL simulations
|
68 |
|
|
DST_DIR=$S1_ROOT/hdl/behav/sparc_libs
|
69 |
15 |
fafa1971 |
rm -f $DST_DIR/*.*
|
70 |
7 |
fafa1971 |
cp $SRC_DIR/../../../lib/m1/m1.behV $DST_DIR/m1_lib.v
|
71 |
|
|
cp $SRC_DIR/../../../lib/u1/u1.behV $DST_DIR/u1_lib.v
|
72 |
|
|
|