OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [script/] [verilator_2D_mesh.sh] - Blame information for rev 45

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 45 alirezamon
#!/bin/bash
2 16 alirezamon
set -e
3
# Any subsequent commands which fail will cause the shell script to exit immediately
4
 
5
script_path=$(pwd)
6
path=$script_path/..
7
comp_path=$path/../adaptive_work/verilator
8
work_path=$comp_path/work
9
bin_path=$work_path/bin
10
multiple_path=$work_path/multiple
11
data_path=$multiple_path/data
12
plot_path=$multiple_path/plot
13
src_c_path=$path/src_c
14
 
15
rm -Rf $multiple_path
16
mkdir -p $data_path
17
mkdir -p $plot_path
18
cp $path/src_c/plot $multiple_path/plot_bin
19
 
20
 
21
CORE_NUM(){
22
  # local variable x and y with passed args
23
  local x=$1
24
  local y=$2
25
 
26
  echo $(( $x + ($y*$NX) ))
27
}
28
 
29
 
30
 
31
# NoC parameters:
32
        V=4   # number of VC per port
33
    P=5   # number of port per router
34
    B=4   # buffer space :flit per VC
35
    NX=8  # number of node in x axis
36
    NY=8  # number of node in y axis
37
    C=1   #  number of flit class
38
    Fpay=32     #flit payload width
39
    MUX_TYPE="ONE_HOT"  #crossbar multiplexer type : "ONE_HOT" or "BINARY"
40
    VC_REALLOCATION_TYPE="NONATOMIC" # "ATOMIC" or "NONATOMIC"
41
    COMBINATION_TYPE="COMB_NONSPEC" # "BASELINE" or "COMB_SPEC1" or "COMB_SPEC2" or "COMB_NONSPEC"
42
    FIRST_ARBITER_EXT_P_EN=1
43
    TOPOLOGY="MESH" #"MESH" or "TORUS"
44
    ROUTE_NAME="DUATO" # Routing algorithm
45
        #    mesh :  "XY"        , "WEST_FIRST"      , "NORTH_LAST"      , "NEGETIVE_FIRST"      , "DUATO"
46
    #   torus:  "TRANC_XY"  , "TRANC_WEST_FIRST", "TRANC_NORTH_LAST", "TRANC_NEGETIVE_FIRST", "TRANC_DUATO"
47
    CONGESTION_INDEX="VC" #"CREDIT","VC"
48
    CLASS_SETTING="4'b1111"
49
        #0: no class. packets can be sent to any available OVC
50
        #1: class field hold the binary number of VC which the packet can be sent to
51
        #2: class field contains one-hot code of candidate OVCs
52
    #3: there are two class, class 0 is permitted to be sent to all OVCs VS. class 1 can candidate only half of VCs
53
 
54
        DEBUG_EN=0 # 1 :do error checking on router, will reduce the simulation speed
55
                        #0 : error checking is disabled
56
 
57
     CLASS_3_TRAFFIC_PATTERN=1
58
    #0: 25 % class 0 , 75 % class 1
59
    #1: 50 % class 0 , 50 % class 1
60
    #2: 75 % class 0 , 25 % class 1
61
 
62
 # Simulation parameters:
63
    TRAFFIC="RANDOM"     # "RANDOM","TRANSPOSE1","TRANSPOSE2","HOTSPOT","BIT_REVERSE","BIT_COMPLEMENT","CUSTOM"
64
    #Hotspot Traffic setting
65
    HOTSPOT_PERCENTAGE=1                        #maximum 20
66
    HOTSOPT_NUM=4                                       #maximum 5
67
    HOTSPOT_CORE_1=$(CORE_NUM 2 2)
68
    HOTSPOT_CORE_2=$(CORE_NUM 5 2)
69
    HOTSPOT_CORE_3=$(CORE_NUM 2 5)
70
    HOTSPOT_CORE_4=$(CORE_NUM 5 5)
71
    HOTSPOT_CORE_5=$(CORE_NUM 2 2)
72
 
73
 
74
 
75
    TOTAL_PKT_PER_ROUTER=5000 #total number of packets which is sent by a router
76
    MAX_DELAY_BTWN_PCKTS=64      # maximum delay between two consecutive packets
77
        ESCAP_VC_MASK="4'b0001"  # mask escape VC
78
 
79
# Simulation C file constant:
80
        PACKET_SIZE=2   # packet size in flit. Minimum is 2
81
 
82
 
83
#       for minimal fully adaptive on 2D mesh paper
84
        ROUTING_SUBFUNCTION= "XY" # "XY" "NORTH_LAST"
85
        AVC_REALLOCATION= ""
86
 
87
generate_parameter_v (){
88
        printf " \`ifdef     INCLUDE_PARAM \n\n" >> parameter.v
89
        printf " parameter V=$V;\n" >> parameter.v
90
        printf " parameter P=$P;\n" >> parameter.v
91
    printf " parameter B=$B;\n" >> parameter.v
92
    printf " parameter NX=$NX;\n" >> parameter.v
93
    printf " parameter NY=$NY;\n" >> parameter.v
94
    printf " parameter C=$C;\n" >> parameter.v
95
    printf " parameter Fpay=$Fpay;\n" >> parameter.v
96
    printf " parameter MUX_TYPE=\"$MUX_TYPE\";\n" >> parameter.v
97
    printf " parameter VC_REALLOCATION_TYPE=\"$VC_REALLOCATION_TYPE\";\n" >> parameter.v
98
    printf " parameter COMBINATION_TYPE=\"$COMBINATION_TYPE\";\n" >> parameter.v
99
    printf " parameter FIRST_ARBITER_EXT_P_EN=$FIRST_ARBITER_EXT_P_EN;\n" >> parameter.v
100
    printf " parameter TOPOLOGY=\"$TOPOLOGY\";\n" >> parameter.v
101
    printf " parameter ROUTE_NAME=\"$ROUTE_NAME\";\n" >> parameter.v
102
        printf " parameter CONGESTION_INDEX=\"$CONGESTION_INDEX\";\n" >> parameter.v
103
        printf " parameter CLASS_3_TRAFFIC_PATTERN=$CLASS_3_TRAFFIC_PATTERN;\n" >> parameter.v
104
    printf " parameter TRAFFIC=\"$TRAFFIC\";\n" >> parameter.v
105
        printf " parameter HOTSPOT_PERCENTAGE=$HOTSPOT_PERCENTAGE;\n" >> parameter.v
106
    printf " parameter HOTSOPT_NUM=$HOTSOPT_NUM;\n" >> parameter.v
107
    printf " parameter HOTSPOT_CORE_1=$HOTSPOT_CORE_1;\n" >> parameter.v
108
    printf " parameter HOTSPOT_CORE_2=$HOTSPOT_CORE_2;\n" >> parameter.v
109
    printf " parameter HOTSPOT_CORE_3=$HOTSPOT_CORE_3;\n" >> parameter.v
110
    printf " parameter HOTSPOT_CORE_4=$HOTSPOT_CORE_4;\n" >> parameter.v
111
        printf " parameter HOTSPOT_CORE_5=$HOTSPOT_CORE_5;\n" >> parameter.v
112
    printf " parameter TOTAL_PKT_PER_ROUTER=$TOTAL_PKT_PER_ROUTER;\n" >> parameter.v
113
    printf " parameter MAX_DELAY_BTWN_PCKTS=$MAX_DELAY_BTWN_PCKTS;\n" >> parameter.v
114
        printf " parameter DEBUG_EN=$DEBUG_EN;\n" >> parameter.v
115
        printf " parameter ROUTE_TYPE = (ROUTE_NAME == \"XY\" || ROUTE_NAME == \"TRANC_XY\" )?    \"DETERMINISTIC\" : \n" >> parameter.v
116
    printf "                                (ROUTE_NAME == \"DUATO\" || ROUTE_NAME == \"TRANC_DUATO\" )?   \"FULL_ADAPTIVE\": \"PAR_ADAPTIVE\"; \n" >> parameter.v
117
        printf " parameter ADD_PIPREG_AFTER_CROSSBAR= $ADD_PIPREG_AFTER_CROSSBAR;\n" >>  parameter.v
118
        printf " parameter CVw=(C==0)? V : C * V;\n" >>  parameter.v
119
        printf " parameter [CVw-1:   0] CLASS_SETTING = $CLASS_SETTING;\n">>  parameter.v
120
        printf " parameter [V-1 :       0] ESCAP_VC_MASK=$ESCAP_VC_MASK;\n" >> parameter.v
121
 
122
 
123
        printf " \n\n \`endif " >> parameter.v
124
 
125
 
126
}
127
 
128
generate_parameter_h (){
129
        printf " #ifndef     INCLUDE_PARAM\n " >> parameter.h
130
        printf " #define   INCLUDE_PARAM\n\n" >> parameter.h
131
        printf "\t #define V    $V\n" >> parameter.h
132
        printf "\t #define B    $B\n" >> parameter.h
133
        printf "\t #define NX   $NX\n" >> parameter.h
134
    printf "\t #define NY       $NY\n" >> parameter.h
135
    printf "\t #define C        $C\n" >> parameter.h
136
    printf "\t #define  Fpay    $Fpay\n" >> parameter.h
137
        printf "\t #define      MUX_TYPE    \"$MUX_TYPE\"\n" >> parameter.h
138
        printf "\t #define      VC_REALLOCATION_TYPE    \"$VC_REALLOCATION_TYPE\"\n" >> parameter.h
139
        printf "\t #define      COMBINATION_TYPE    \"$COMBINATION_TYPE\"\n" >> parameter.h
140
        printf "\t #define      FIRST_ARBITER_EXT_P_EN    $FIRST_ARBITER_EXT_P_EN\n" >> parameter.h
141
        printf "\t #define      TOPOLOGY    \"$TOPOLOGY\"\n" >> parameter.h
142
        printf "\t #define      ROUTE_NAME    \"$ROUTE_NAME\"\n" >> parameter.h
143
        printf "\t #define      CONGESTION_INDEX    \"$CONGESTION_INDEX\"\n" >> parameter.h
144
        printf "\t #define      CLASS_3_TRAFFIC_PATTERN    $CLASS_3_TRAFFIC_PATTERN\n" >> parameter.h
145
        printf "\t #define      TRAFFIC    \"$TRAFFIC\"\n" >> parameter.h
146
        printf "\t #define      HOTSPOT_PERCENTAGE    $HOTSPOT_PERCENTAGE\n" >> parameter.h
147
        printf "\t #define      HOTSOPT_NUM    $HOTSOPT_NUM\n" >> parameter.h
148
        printf "\t #define      HOTSPOT_CORE_1    $HOTSPOT_CORE_1\n" >> parameter.h
149
        printf "\t #define      HOTSPOT_CORE_2    $HOTSPOT_CORE_2\n" >> parameter.h
150
        printf "\t #define      HOTSPOT_CORE_3    $HOTSPOT_CORE_3\n" >> parameter.h
151
        printf "\t #define      HOTSPOT_CORE_4    $HOTSPOT_CORE_4\n" >> parameter.h
152
        printf "\t #define      HOTSPOT_CORE_5    $HOTSPOT_CORE_5\n" >> parameter.h
153
        printf "\t #define      TOTAL_PKT_PER_ROUTER    $TOTAL_PKT_PER_ROUTER\n" >> parameter.h
154
        printf "\t #define      MAX_DELAY_BTWN_PCKTS    $MAX_DELAY_BTWN_PCKTS\n" >> parameter.h
155
    printf "\t #define  PACKET_SIZE     $PACKET_SIZE\n" >> parameter.h
156
    printf "\t #define  DEBUG_EN        $DEBUG_EN       \n" >> parameter.h
157
    printf "\t #define  ADD_PIPREG_AFTER_CROSSBAR  $ADD_PIPREG_AFTER_CROSSBAR\n" >>   parameter.h
158
        printf "\t #define  CVw (C==0)? V : C * V\n" >>  parameter.h
159
        printf "\t #define  CLASS_SETTING   \"$CLASS_SETTING\"\n">>  parameter.h
160
        printf "\t #define  ESCAP_VC_MASK       $ESCAP_VC_MASK\n">>  parameter.h
161
        printf " \n\n #endif " >> parameter.h
162
 
163
}
164
 
165
 
166
for PACKET_SIZE in  3 2 4 6
167
        do
168
        for  TRAFFIC in  "RANDOM"  "TRANSPOSE1" "TRANSPOSE2"  "HOTSPOT"
169
        do
170
 
171
                for  ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST"  "NEGETIVE_FIRST"  "DUATO"
172
                do
173
                        # regenerate NoC
174
                        generate_parameter_v
175
                        mv -f parameter.v ../src_verilator/
176
 
177
                        #verilate the NoC and make the library files
178
                        ./verilator_compile_hw.sh
179
 
180
 
181
                        # compile the testbench file
182
                        generate_parameter_h
183
                        mv -f parameter.h ../src_verilator/
184
                        ./verilator_compile_sw.sh
185
 
186
                        testnench_name=$ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE
187
                        cp $bin_path/testbench $multiple_path/$testnench_name
188
 
189
                done
190
                #run multiple testbench files in the same time
191
                cd $multiple_path
192
 
193
                for  ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST"  "NEGETIVE_FIRST"  "DUATO"
194
                do
195
 
196
                        ./$ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE $ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE &
197
 
198
                done
199
                # wait for all simulation to be done
200
                wait
201
 
202
                # merge the result in one file
203
                for  ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST"  "NEGETIVE_FIRST"  "DUATO"
204
                do
205
                data_file=$data_path/$TRAFFIC"_"$PACKET_SIZE"_all.txt"
206
                plot_file=$plot_path/$TRAFFIC"_"$PACKET_SIZE".eps"
207
                testnench_name=$ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE
208
 
209
                        printf "#name:"$ROUTE_NAME"\n" >> $data_file
210
                        cat     $testnench_name"_all.txt" >> $data_file
211
                        printf "\n\n" >> $data_file
212
                        ./plot_bin $data_file  $plot_file "Injection ratio flits/node/clk" "Average latency clk" left
213
                        rm      $testnench_name*
214
                done
215
 
216
                cd $script_path
217
 
218
 
219
                done # ROUTE_NAME
220
        done #TRAFFIC
221
 

powered by: WebSVN 2.1.0

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