Line 55... |
Line 55... |
flop_rptrs_xc1.v flop_rptrs_xc2.v flop_rptrs_xc3.v flop_rptrs_xc4.v flop_rptrs_xc5.v flop_rptrs_xc6.v \
|
flop_rptrs_xc1.v flop_rptrs_xc2.v flop_rptrs_xc3.v flop_rptrs_xc4.v flop_rptrs_xc5.v flop_rptrs_xc6.v \
|
flop_rptrs_xc7.v bw_rng.v cluster_header_ctu.v cluster_header_dup.v cluster_header_sync.v dbl_buf.v \
|
flop_rptrs_xc7.v bw_rng.v cluster_header_ctu.v cluster_header_dup.v cluster_header_sync.v dbl_buf.v \
|
sync_pulse_synchronizer.v synchronizer_asr_dup.v ucb_bus_in.v ucb_bus_out.v ucb_flow_2buf.v \
|
sync_pulse_synchronizer.v synchronizer_asr_dup.v ucb_bus_in.v ucb_bus_out.v ucb_flow_2buf.v \
|
ucb_flow_jbi.v ucb_flow_spi.v ucb_noflow.v spc_pcx_buf.v
|
ucb_flow_jbi.v ucb_flow_spi.v ucb_noflow.v spc_pcx_buf.v
|
|
|
# Clean the files by substituting the $error System Task and applying defines with Icarus preprocessor
|
## Clean the files by substituting the $error System Task and applying defines with Icarus preprocessor
|
for file in $DST_DIR/*.v ; do
|
#for file in $DST_DIR/*.v ; do
|
sed -e 's/\$error/\$display/g' $file | sed -e 's/negedge rclk or rst_l/negedge rclk/g' > $DST_DIR/temp.v
|
# sed -e 's/\$error/\$display/g' $file | sed -e 's/negedge rclk or rst_l/negedge rclk/g' > $DST_DIR/temp.v
|
if(test $1 == "-me" || test $1 == "-se") then
|
# if(test $1 == "-me" || test $1 == "-se") then
|
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
|
# 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
|
else
|
# else
|
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
|
# 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
|
fi
|
# fi
|
# These steps are required because Icarus does not allow this kind of comments
|
# # These steps are required because Icarus does not allow this kind of comments
|
sed -e 's/\* ========== Copyright Header Begin/\/\* ========== Copyright Header Begin/g' $file > $DST_DIR/temp.v
|
# sed -e 's/\* ========== Copyright Header Begin/\/\* ========== Copyright Header Begin/g' $file > $DST_DIR/temp.v
|
mv -f $DST_DIR/temp.v $file
|
# mv -f $DST_DIR/temp.v $file
|
done
|
#done
|
|
|
# Correct some strange strings
|
## Correct some strange strings
|
sed -e 's/sparc_exu_alulogic logic/sparc_exu_alulogic logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_exu_alu.v > $DST_DIR/temp.v
|
#sed -e 's/sparc_exu_alulogic logic/sparc_exu_alulogic logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_exu_alu.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/sparc_exu_alu.v
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_exu_alu.v
|
sed -e 's/logic/logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_ffu_ctl_visctl.v > $DST_DIR/temp.v
|
#sed -e 's/logic/logic_MAYBEARESERVEDWORD/g' $DST_DIR/sparc_ffu_ctl_visctl.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/sparc_ffu_ctl_visctl.v
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_ffu_ctl_visctl.v
|
sed -e 's/$display(\"ILLEGAL_THR_STATE\"/\/\/$display(\"ILLEGAL_THR_STATE\"/g' sparc_ifu_thrfsm.v > $DST_DIR/temp.v
|
#sed -e 's/$display(\"ILLEGAL_THR_STATE\"/\/\/$display(\"ILLEGAL_THR_STATE\"/g' sparc_ifu_thrfsm.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/sparc_ifu_thrfsm.v
|
#mv $DST_DIR/temp.v $DST_DIR/sparc_ifu_thrfsm.v
|
sed -e 's/(\* keep = "yes" \*)//g' $DST_DIR/bw_r_frf.v > $DST_DIR/temp.v
|
#sed -e 's/(\* keep = "yes" \*)//g' $DST_DIR/bw_r_frf.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/bw_r_frf.v
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_frf.v
|
sed -e 's/synthesis translate_/synopsys translate_/g' $DST_DIR/bw_r_irf.v > $DST_DIR/temp.v
|
#sed -e 's/synthesis translate_/synopsys translate_/g' $DST_DIR/bw_r_irf.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/bw_r_irf.v
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_irf.v
|
sed -e 's/initial onereg/\/\/initial onereg/g' $DST_DIR/bw_r_irf_register.v > $DST_DIR/temp.v
|
#sed -e 's/initial onereg/\/\/initial onereg/g' $DST_DIR/bw_r_irf_register.v > $DST_DIR/temp.v
|
mv $DST_DIR/temp.v $DST_DIR/bw_r_irf_register.v
|
#mv $DST_DIR/temp.v $DST_DIR/bw_r_irf_register.v
|
|
|
# After preprocessing we can safely delete the include directory
|
## After preprocessing we can safely delete the include directory
|
rm -f $DST_DIR/include/*.*
|
#rm -f $DST_DIR/include/*.*
|
|
|
# Disable L1 Instruction and Data Caches if required
|
## Disable L1 Instruction and Data Caches if required
|
if(test $1 == "-me") then
|
#if(test $1 == "-me") then
|
cp -f $S1_ROOT/tools/src/bw_r_dcd.v $DST_DIR
|
# cp -f $S1_ROOT/tools/src/bw_r_dcd.v $DST_DIR
|
cp -f $S1_ROOT/tools/src/bw_r_icd.v $DST_DIR
|
# cp -f $S1_ROOT/tools/src/bw_r_icd.v $DST_DIR
|
cp -f $S1_ROOT/tools/src/bw_r_idct.v $DST_DIR
|
# cp -f $S1_ROOT/tools/src/bw_r_idct.v $DST_DIR
|
fi
|
#fi
|
|
|
# Hack the SPARC Core to add the external stall input from the bridge
|
## Hack the SPARC Core to add the external stall input from the bridge
|
# Cookbook from book "OpenSPARC Internals", paragraph 6.8
|
## Cookbook from book "OpenSPARC Internals", paragraph 6.8
|
|
|
# Top-level of SPARC Core (s1_top.sparc)
|
## Top-level of SPARC Core (s1_top.sparc)
|
sed -e 's/pcx_spc_grant_px,/pcx_spc_grant_px,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc.v |
|
#sed -e 's/pcx_spc_grant_px,/pcx_spc_grant_px,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc.v |
|
sed -e 's/pcx_spc_grant_px;/pcx_spc_grant_px;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
# sed -e 's/pcx_spc_grant_px;/pcx_spc_grant_px;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
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
|
# 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
|
mv -f $DST_DIR/sparc_TMP.v $DST_DIR/sparc.v
|
#mv -f $DST_DIR/sparc_TMP.v $DST_DIR/sparc.v
|
|
|
# Fetch unit (s1_top.sparc.ifu)
|
## Fetch unit (s1_top.sparc.ifu)
|
sed -e 's/ffu_ifu_stallreq,/ffu_ifu_stallreq,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu.v |
|
#sed -e 's/ffu_ifu_stallreq,/ffu_ifu_stallreq,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu.v |
|
sed -e 's/ffu_ifu_stallreq;/ffu_ifu_stallreq;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
# sed -e 's/ffu_ifu_stallreq;/ffu_ifu_stallreq;input wbm_spc_stall;input wbm_spc_resume;/g' |
|
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
|
# 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
|
mv -f $DST_DIR/sparc_ifu_TMP.v $DST_DIR/sparc_ifu.v
|
#mv -f $DST_DIR/sparc_ifu_TMP.v $DST_DIR/sparc_ifu.v
|
|
|
# Switch logic unit (s1_top.sparc.ifu.swl)
|
## Switch logic unit (s1_top.sparc.ifu.swl)
|
sed -e 's/thr_config_in_m,/thr_config_in_m,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu_swl.v |
|
#sed -e 's/thr_config_in_m,/thr_config_in_m,wbm_spc_stall,wbm_spc_resume,/g' $DST_DIR/sparc_ifu_swl.v |
|
sed -e 's/thr_config_in_m;/thr_config_in_m;input wbm_spc_stall;input wbm_spc_resume;wire wait_state;/g' |
|
# sed -e 's/thr_config_in_m;/thr_config_in_m;input wbm_spc_stall;input wbm_spc_resume;wire wait_state;/g' |
|
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' |
|
# 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' |
|
sed -e 's/(~wm_stbwait | stb_retry);/(~wm_stbwait|stb_retry)\&(~wait_state|wbm_spc_resume);/g' |
|
# sed -e 's/(~wm_stbwait | stb_retry);/(~wm_stbwait|stb_retry)\&(~wait_state|wbm_spc_resume);/g' |
|
sed -e 's/wm_stbwait & ~stb_retry);/wm_stbwait \& ~stb_retry|wait_state \& ~wbm_spc_resume);/g' > $DST_DIR/sparc_ifu_swl_TMP.v
|
# sed -e 's/wm_stbwait & ~stb_retry);/wm_stbwait \& ~stb_retry|wait_state \& ~wbm_spc_resume);/g' > $DST_DIR/sparc_ifu_swl_TMP.v
|
mv -f $DST_DIR/sparc_ifu_swl_TMP.v $DST_DIR/sparc_ifu_swl.v
|
#mv -f $DST_DIR/sparc_ifu_swl_TMP.v $DST_DIR/sparc_ifu_swl.v
|
|
|
# Stall completion logic (s1_top.sparc.ifu.swl.compl)
|
## Stall completion logic (s1_top.sparc.ifu.swl.compl)
|
sed -e 's/clear_wmo_e,/clear_wmo_e,wbm_spc_stall,wbm_spc_resume,wait_state,/g' $DST_DIR/sparc_ifu_thrcmpl.v |
|
#sed -e 's/clear_wmo_e,/clear_wmo_e,wbm_spc_stall,wbm_spc_resume,wait_state,/g' $DST_DIR/sparc_ifu_thrcmpl.v |
|
sed -e 's/clear_wmo_e;/clear_wmo_e;input wbm_spc_stall;input wbm_spc_resume;output wait_state;wire wait_next;/g' |
|
# sed -e 's/clear_wmo_e;/clear_wmo_e;input wbm_spc_stall;input wbm_spc_resume;output wait_state;wire wait_next;/g' |
|
sed -e 's/endmodule/assign wait_next=wbm_spc_stall|(wait_state \& ~wbm_spc_resume);\nendmodule/g' |
|
# sed -e 's/endmodule/assign wait_next=wbm_spc_stall|(wait_state \& ~wbm_spc_resume);\nendmodule/g' |
|
sed -e 's/endmodule/dffr wait_ff(.din(wait_next),.q(wait_state),.clk(clk),.rst(reset),.se(se),.si(),.so());\nendmodule/g' |
|
# sed -e 's/endmodule/dffr wait_ff(.din(wait_next),.q(wait_state),.clk(clk),.rst(reset),.se(se),.si(),.so());\nendmodule/g' |
|
sed -e 's/assign completion/assign completion[0]/g' |
|
# sed -e 's/assign completion/assign completion[0]/g' |
|
sed -e 's/endmodule/assign completion[1]=completion[0];\nendmodule/g' |
|
# sed -e 's/endmodule/assign completion[1]=completion[0];\nendmodule/g' |
|
sed -e 's/endmodule/assign completion[2]=completion[0];\nendmodule/g' |
|
# sed -e 's/endmodule/assign completion[2]=completion[0];\nendmodule/g' |
|
sed -e 's/endmodule/assign completion[3]=completion[0];\nendmodule/g' |
|
# sed -e 's/endmodule/assign completion[3]=completion[0];\nendmodule/g' |
|
sed -e 's/wm_stbwait));/wm_stbwait|wait_state));/g' > $DST_DIR/sparc_ifu_thrcmpl_TMP.v
|
# sed -e 's/wm_stbwait));/wm_stbwait|wait_state));/g' > $DST_DIR/sparc_ifu_thrcmpl_TMP.v
|
mv -f $DST_DIR/sparc_ifu_thrcmpl_TMP.v $DST_DIR/sparc_ifu_thrcmpl.v
|
#mv -f $DST_DIR/sparc_ifu_thrcmpl_TMP.v $DST_DIR/sparc_ifu_thrcmpl.v
|
|
|
# This is a temporary hack to take a top-level SPARC Core with the SPU instance removed by-hand (ifdef is wrong)
|
## This is a temporary hack to take a top-level SPARC Core with the SPU instance removed by-hand (ifdef is wrong)
|
cp -f $S1_ROOT/tools/src/sparc.v $DST_DIR
|
#cp -f $S1_ROOT/tools/src/sparc.v $DST_DIR
|
|
|
# Copy also behavioral libraries used for RTL simulations
|
# Copy also behavioral libraries used for RTL simulations
|
DST_DIR=$S1_ROOT/hdl/behav/sparc_libs
|
DST_DIR=$S1_ROOT/hdl/behav/sparc_libs
|
rm -f $DST_DIR/*.*
|
rm -f $DST_DIR/*.*
|
cp $SRC_DIR/../../../lib/m1/m1.behV $DST_DIR/m1_lib.v
|
cp $SRC_DIR/../../../lib/m1/m1.behV $DST_DIR/m1_lib.v
|