Commit cc5bcdf2 authored by GuillemCabo's avatar GuillemCabo
Browse files

fix MCCU RDC generator, add CI

parent 7951f78f
AXI_PMU/
tmp/
pmu_ahb/
\.*\.log
RED='\033[7;31m'
GREEN='\033[7;32m'
BLUE='\033[7;36m'
NC='\033[0m' # No Color
#Name tmp files and VARS
VERILATOR_LOG0=.verilator_pmu_ahb.log
VERILATOR_LOG1=.verilator_AXI_PMU.log
#Clear tmp files if any
rm -f $VERILATOR_LOG0
rm -f $VERILATOR_LOG1
rm -rf ./pmu_ahb
rm -rf ./AXI_PMU
############
## TOP pmu_ahb.sv
############
# Run Verilator
printf "Please wait, running Verilator\n"
verilator --lint-only ../hdl/pmu_ahb.sv \
../hdl/PMU_raw.sv \
../submodules/crossbar/hdl/crossbar.sv \
../submodules/MCCU/hdl/MCCU.sv \
../submodules/RDC/hdl/RDC.sv \
../submodules/quota/PMU_quota.sv \
../submodules/counters/PMU_counters.sv \
../submodules/overflow/PMU_overflow.sv 2> $VERILATOR_LOG0
# Run Questa
printf "Please wait, running Spyglass\n"
./runLintSV.sh ../hdl/pmu_ahb.sv \
../hdl/PMU_raw.sv \
../submodules/crossbar/hdl/crossbar.sv \
../submodules/MCCU/hdl/MCCU.sv \
../submodules/RDC/hdl/RDC.sv \
../submodules/quota/PMU_quota.sv \
../submodules/counters/PMU_counters.sv \
../submodules/overflow/PMU_overflow.sv 1> /dev/null
# Check outcome
printf "UNIT - : ${BLUE} pmu_ahb ${BLUE}${NC}\n"
cat pmu_ahb/consolidated_reports/pmu_ahb_lint_lint_rtl/moresimple.rpt | grep -i 'error\|Syntax' | GREP_COLORS='mt=01;31' egrep -i --color=always error\|syntax
if [ $? -ne 0 ]; then
printf "SPYGLASS - Chech for errors: ${GREEN}PASS${GREEN}${NC}\n"
cat pmu_ahb/consolidated_reports/pmu_ahb_lint_lint_rtl/moresimple.rpt | GREP_COLORS='mt=01;33' egrep -i --color=always 'warning'
if test -f "$VERILATOR_LOG0"; then
cat $VERILATOR_LOG0 | GREP_COLORS='mt=07;33' egrep -i --color=always 'Syntax'
cat $VERILATOR_LOG0 | GREP_COLORS='mt=07;33' egrep -i --color=always '%error'
cat $VERILATOR_LOG0 | GREP_COLORS='mt=01;93' egrep -i --color=always '%warning'
fi
else
printf "SPYGLASS - Chech for errors: ${RED}FAIL${RED}${NC}\n"
exit 1
fi
############
## TOP AXI_PMU.sv
############
# Run Verilator
printf "Please wait, running Verilator\n"
verilator --lint-only ../hdl/AXI_PMU.sv \
../hdl/AXI_PMU_interface_v1_0_S00_AXI.sv \
../submodules/RDC/hdl/RDC.sv \
../submodules/MCCU/hdl/MCCU.sv 2>$VERILATOR_LOG1
# Run Questa
printf "Please wait, running Questa\n"
./runLintSV.sh ../hdl/AXI_PMU.sv \
../hdl/AXI_PMU_interface_v1_0_S00_AXI.sv \
../submodules/RDC/hdl/RDC.sv \
../submodules/MCCU/hdl/MCCU.sv 1> /dev/null
# Check outcome
printf "UNIT - : ${BLUE} AXI_PMU ${BLUE}${NC}\n"
cat AXI_PMU/consolidated_reports/AXI_PMU_lint_lint_rtl/moresimple.rpt | grep -i 'error\|Syntax' | GREP_COLORS='mt=01;31' egrep -i --color=always error\|syntax
if [ $? -ne 0 ]; then
printf "SPYGLASS - Chech for errors: ${GREEN}PASS${GREEN}${NC}\n"
cat AXI_PMU/consolidated_reports/AXI_PMU_lint_lint_rtl/moresimple.rpt | GREP_COLORS='mt=01;33' egrep -i --color=always 'warning'
if test -f "$VERILATOR_LOG1"; then
cat $VERILATOR_LOG1 | GREP_COLORS='mt=07;33' egrep -i --color=always '%error'
cat $VERILATOR_LOG1 | GREP_COLORS='mt=01;93' egrep -i --color=always '%warning'
fi
else
printf "SPYGLASS - Chech for errors: ${RED}FAIL${RED}${NC}\n"
exit 1
fi
exit 0
#!/bin/bash
RED='\033[7;31m'
GREEN='\033[7;32m'
NC='\033[0m' # No Color
#Name tmp files and VARS
LOG=.questa.log
LOCAL_LOG=.lquesta.log
#Clear tmp files if any
rm -f $LOG
# Go to target folder
cd ../tb/questa_sim/
# Declare folders of tests to be executed
declare -a StringArray=("tb_axi_pmu/" "tb_com_tr/" "tb_hamming16td11/" "tb_hamming32td26/"
"tb_pmu_ahb/" "tb_pmu_raw/" "tb_reg_sbf/" "tb_MCCU" "tb_crossbar")
# Iterate the string array using for loop
for val in ${StringArray[@]}; do
cd $val
rm -f $LOCAL_LOG
echo $val >> $LOCAL_LOG
./runtest.sh -batch | grep -i -e info -e warning -e error >> $LOCAL_LOG
## Report INFO
cat $LOCAL_LOG | GREP_COLORS='mt=01;36' egrep -i --color=always '#INFO#'
## Report warnings
cat $LOCAL_LOG | grep -v ^".*Warnings: 0" | GREP_COLORS='mt=01;33' egrep -i --color=always ' Warnings:'
#Check for errors
cat $LOCAL_LOG | grep -i error | grep -v ^".*Errors: 0" | GREP_COLORS='mt=01;31' egrep -i --color=always 'error'
# if errors FAIL tests
if [ $? -ne 0 ]; then
printf "Questa - $val: ${GREEN}PASS${GREEN}${NC}\n"
else
printf "Questa - $val: ${RED}FAIL${RED}${NC}\n"
exit 1
fi
cat $LOCAL_LOG >> ../../../ci/$LOG
cd ../
done
cd ../../ci
##Exit without errors
exit 0
#!/bin/bash
#Format parameters
FN="$(basename -- $1)"
N="${FN%%.*}"
EX="${FN#*.}"
#echo $FN
#echo $N
#echo $EX
#cleanup in local and remote machines
rm -rf /tmp/importspy
rm -rf /tmp/optionsspy
ssh gcabo@epi03.bsc.es << EOF
rm -rf /tmp/$N
#make destination folder
mkdir /tmp/$N
exit
EOF
#copy files and set script
for var in "$@"
do
echo "read_file {./"$(basename -- $var)"}" >> /tmp/importspy
scp $var gcabo@epi03.bsc.es:/tmp/$N
done
#set the top for spyglass. must be the first argument of the script.
echo "set_option top $N" >> /tmp/optionsspy
scp /tmp/importspy gcabo@epi03.bsc.es:/tmp
scp /tmp/optionsspy gcabo@epi03.bsc.es:/tmp
ssh gcabo@epi03.bsc.es << EOF
cp /users/gcabo/spyglass_template/template_spyglass.prj /tmp/$N/$N.prj;
cd /tmp/$N;
sed -i '/Data Import Section/ r /tmp/importspy' ./$N.prj;
sed -i '/Common Options Section/ r /tmp/optionsspy' ./$N.prj;
export SKIP_PLATFORM_CHECK=TRUE
. /eda/env.sh
#echo -e "exports\n";
echo -e "run_goal lint/lint_rtl\nexit -save\n"| spyglass_main -shell -project $N.prj;
#echo -e "remove\n";
exit
EOF
echo -e "exit"
scp -r gcabo@epi03.bsc.es:/tmp/$N/$N ./
echo -e "copy resuts"
#vim ./$N/consolidated_reports/lint_lint_rtl/moresimple.rpt
......@@ -304,18 +304,25 @@
end
endgenerate
//---- Request Duration Counter (RDC) registers
//core_0
assign regs_o[BASE_RDC_WATERMARK][MCCU_WEIGHTS_WIDTH-1:0] = MCCU_watermark_int [0][0] ;
assign regs_o[BASE_RDC_WATERMARK][2*MCCU_WEIGHTS_WIDTH-1:MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [0][1];
//core_1
assign regs_o[BASE_RDC_WATERMARK][3*MCCU_WEIGHTS_WIDTH-1:2*MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [1][0];
assign regs_o[BASE_RDC_WATERMARK][4*MCCU_WEIGHTS_WIDTH-1:3*MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [1][1] ;
//core_2
assign regs_o[BASE_RDC_WATERMARK+1][MCCU_WEIGHTS_WIDTH-1:0] = MCCU_watermark_int [2][0] ;
assign regs_o[BASE_RDC_WATERMARK+1][2*MCCU_WEIGHTS_WIDTH-1:MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [2][1] ;
//core_3
assign regs_o[BASE_RDC_WATERMARK+1][3*MCCU_WEIGHTS_WIDTH-1:2*MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [3][0] ;
assign regs_o[BASE_RDC_WATERMARK+1][4*MCCU_WEIGHTS_WIDTH-1:3*MCCU_WEIGHTS_WIDTH] = MCCU_watermark_int [3][1] ;
genvar q;
genvar j;
generate
for(q=0;q<N_MCCU_WEIGHTS;q++) begin
for(j=0;j<(REG_WIDTH/MCCU_WEIGHTS_WIDTH);j++) begin
// q - Iterate over registers that we have to fill
// j - Iterate over fields of each register
// assign regs_o [c][d:e] = MCCU_watermark_int[a][b];
// a - Index of the core owning the signal
// b - Index of the signal within the asigned core
// c - Index of the signal in the PMU register bank
// d - Upper bit of the field within PMU register bank
// d - Lower bit of the field within PMU register bank
assign regs_o[BASE_RDC_WATERMARK+q][MCCU_WEIGHTS_WIDTH*(j+1)-1:MCCU_WEIGHTS_WIDTH*j]
= MCCU_watermark_int [(q*(REG_WIDTH/MCCU_WEIGHTS_WIDTH)+j)/RDC_N_EVENTS]
[((q*(REG_WIDTH/MCCU_WEIGHTS_WIDTH)+j))%RDC_N_EVENTS];
end
end
endgenerate
//----------------------------------------------
//------------- Crossbar
......@@ -340,7 +347,6 @@ always_comb begin
end
//map configuration fields to each mux
genvar q; // each Crossbar output
generate
for (q=0;q<CROSSBAR_OUTPUTS;q++) begin
assign crossbar_cfg[q] = concat_cfg_crossbar [q*CROSSBAR_CFG_BITS+:CROSSBAR_CFG_BITS];
......@@ -490,32 +496,27 @@ end
end
endgenerate
//NON-PARAMETRIC This can be autogenenerated TODO
wire [MCCU_WEIGHTS_WIDTH-1:0] MCCU_events_weights_int [0:MCCU_N_CORES-1]
[0:MCCU_N_EVENTS-1];
//TODO WIP
/*
generate
for(q=0;q<MCCU_N_CORES;q++) begin //iterate cores
for(j=0;j<MCCU_N_EVENTS;j++) begin // iterate signals per core
assign MCCU_events_weights_int [q][j] = regs_i[BASE_MCCU_WEIGHTS][(q*MCCU_N_EVENTS+j+1)*MCCU_WEIGHTS_WIDTH-1:0];
assign MCCU_events_weights_int [0][1] = regs_i[BASE_MCCU_WEIGHTS][2*MCCU_WEIGHTS_WIDTH-1:MCCU_WEIGHTS_WIDTH];
// Registers
for(q=0;q<N_MCCU_WEIGHTS;q++) begin
//fields
for(j=0;j<(REG_WIDTH/MCCU_WEIGHTS_WIDTH);j++) begin
// q - Iterate over registers that we have to fill
// j - Iterate over fields of each register
// assign MCCU_events_weights_int [a][b] = regs_i[c][d:e];
// a - Index of the core owning the signal
// b - Index of the signal within the asigned core
// c - Index of the signal in the PMU register bank
// d - Upper bit of the field within PMU register bank
// d - Lowe bit of the field within PMU register bank
assign MCCU_events_weights_int [(q*(REG_WIDTH/MCCU_WEIGHTS_WIDTH)+j)/MCCU_N_EVENTS]
[((q*(REG_WIDTH/MCCU_WEIGHTS_WIDTH)+j))%MCCU_N_EVENTS]
= regs_i[BASE_MCCU_WEIGHTS+q][MCCU_WEIGHTS_WIDTH*(j+1)-1:MCCU_WEIGHTS_WIDTH*j];
end
end
endgenerate*/
//core_0
assign MCCU_events_weights_int [0][0] = regs_i[BASE_MCCU_WEIGHTS][MCCU_WEIGHTS_WIDTH-1:0];
assign MCCU_events_weights_int [0][1] = regs_i[BASE_MCCU_WEIGHTS][2*MCCU_WEIGHTS_WIDTH-1:MCCU_WEIGHTS_WIDTH];
//core_1
assign MCCU_events_weights_int [1][0] = regs_i[BASE_MCCU_WEIGHTS][3*MCCU_WEIGHTS_WIDTH-1:2*MCCU_WEIGHTS_WIDTH];
assign MCCU_events_weights_int [1][1] = regs_i[BASE_MCCU_WEIGHTS][4*MCCU_WEIGHTS_WIDTH-1:3*MCCU_WEIGHTS_WIDTH];
//core_2
assign MCCU_events_weights_int [2][0] = regs_i[BASE_MCCU_WEIGHTS+1][MCCU_WEIGHTS_WIDTH-1:0];
assign MCCU_events_weights_int [2][1] = regs_i[BASE_MCCU_WEIGHTS+1][2*MCCU_WEIGHTS_WIDTH-1:MCCU_WEIGHTS_WIDTH];
//core_3
assign MCCU_events_weights_int [3][0] = regs_i[BASE_MCCU_WEIGHTS+1][3*MCCU_WEIGHTS_WIDTH-1:2*MCCU_WEIGHTS_WIDTH];
assign MCCU_events_weights_int [3][1] = regs_i[BASE_MCCU_WEIGHTS+1][4*MCCU_WEIGHTS_WIDTH-1:3*MCCU_WEIGHTS_WIDTH];
endgenerate
//unpack to pack
wire MCCU_intr_up [MCCU_N_CORES-1:0];
generate
......@@ -613,7 +614,8 @@ end
if (!rstn_i) begin
RDC_rstn <= 0;
end else begin
RDC_rstn <= rstn_i && !regs_i[BASE_MCCU_CFG][7];
// Offset RDC enable, MCCU soft rest, enable and individual core updates
RDC_rstn <= rstn_i && !regs_i[BASE_MCCU_CFG][MCCU_N_CORES+2+2];
end
end
......@@ -623,7 +625,8 @@ end
if (!rstn_i) begin
RDC_enable_int <= 0;
end else begin
RDC_enable_int <= regs_i[BASE_MCCU_CFG][6];
// Offset MCCU soft rest, enable and individual core updates
RDC_enable_int <= regs_i[BASE_MCCU_CFG][MCCU_N_CORES+2+1];
end
end
......
......@@ -30,16 +30,16 @@
// Number of counters
parameter integer PMU_COUNTERS = 24,
// Number of SoC events
parameter integer N_SOC_EV = 32,
parameter integer N_SOC_EV = 128,
// Total amount of registers (use ahb_pmu_mem_map.ods)
parameter integer N_REGS = 47,
parameter integer N_REGS = 55,
// -- Local parameters
//haddr width
localparam integer HADDR_WIDTH = 32,
//hdata width
localparam integer HDATA_WIDTH = 32,
// Cores connected to MCCU
parameter MCCU_N_CORES = 4,
parameter MCCU_N_CORES = 6,
// Number of configuration registers
localparam PMU_CFG = 1
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment