Add repo: Buck008_Transformer-Accelerator-Based-on-FPGA
Browse files- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/sim/Softmax_top_tb.sv +234 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/sim/gelu_tb.sv +107 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/EightGelus.v +118 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Exp_module.v +48 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Gelus_axi.v +440 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Gelus_top.v +107 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Ln_module.v +62 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax.v +234 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_control.v +194 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_top.v +104 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_top_axi.v +432 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/gelu.v +111 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/lin.v +52 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/README.md +10 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/prj.tcl +1515 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/pynq/MM.py +155 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/README.txt +1 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/defines.h +33 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/main.c +155 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/matrix.c +100 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/matrix.h +28 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sim/MM_Ultra_tb.sv +378 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/sim/MM_Ultra_tb_behav.wcfg +1331 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/AdderS.v +40 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM.v +219 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_buffer.v +359 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_in_buffer.v +268 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_out_buffer.v +331 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra.v +221 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra_axi.v +468 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra_top.v +129 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE.v +35 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE_array.v +129 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE_line.v +56 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/src/right_shifter.v +48 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Defines.h +55 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Matrix.cpp +165 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Matrix.h +34 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/README.txt +1 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Xilinx.spec +2 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/lscript.ld +291 -0
- Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/main.cpp +45 -0
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/sim/Softmax_top_tb.sv
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
`define length 197
|
| 3 |
+
`define scale_in 6
|
| 4 |
+
`define scale_out 7
|
| 5 |
+
//scale_in and scale_out must be kept during the valid_in, min =-1, max =10
|
| 6 |
+
//scale_out min = 7,max = 12
|
| 7 |
+
module Softmax_top_tb;
|
| 8 |
+
reg clk;
|
| 9 |
+
reg rst_n;
|
| 10 |
+
|
| 11 |
+
reg [9:0] length;
|
| 12 |
+
reg signed [4:0] scale_in;
|
| 13 |
+
reg [3:0] scale_out;
|
| 14 |
+
|
| 15 |
+
wire signed [7:0] top_data_in;
|
| 16 |
+
reg top_valid_in;
|
| 17 |
+
wire top_ready_in;
|
| 18 |
+
reg top_last_in;
|
| 19 |
+
|
| 20 |
+
wire [7:0] top_data_out;
|
| 21 |
+
wire top_valid_out;
|
| 22 |
+
wire top_last_out;
|
| 23 |
+
|
| 24 |
+
Softmax_control u_Softmax_control(
|
| 25 |
+
.clk(clk),
|
| 26 |
+
.length_input(length),
|
| 27 |
+
.rst_n(rst_n),
|
| 28 |
+
.scale_in_input(scale_in),
|
| 29 |
+
.scale_out_input(scale_out),
|
| 30 |
+
|
| 31 |
+
.top_data_in(top_data_in),
|
| 32 |
+
.top_valid_in(top_valid_in),
|
| 33 |
+
.top_ready_in(top_ready_in),
|
| 34 |
+
.top_last_in(top_last_in),
|
| 35 |
+
|
| 36 |
+
.top_data_out(top_data_out),
|
| 37 |
+
.top_valid_out(top_valid_out),
|
| 38 |
+
.top_last_out(top_last_out)
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
task Softmax_task(input real x[`length-1:0], output real y[`length-1:0] );
|
| 42 |
+
begin
|
| 43 |
+
automatic int Scnt = 0;
|
| 44 |
+
automatic real in_max = 0;
|
| 45 |
+
automatic real exp[`length];
|
| 46 |
+
automatic real exp_sum = 0;
|
| 47 |
+
|
| 48 |
+
for(Scnt = 0;Scnt<`length;Scnt++)begin
|
| 49 |
+
if(in_max<x[Scnt])
|
| 50 |
+
in_max = x[Scnt];
|
| 51 |
+
end
|
| 52 |
+
|
| 53 |
+
for(Scnt = 0;Scnt<`length;Scnt++)begin
|
| 54 |
+
x[Scnt] = x[Scnt] - in_max;
|
| 55 |
+
exp[Scnt] = $exp(x[Scnt]);
|
| 56 |
+
exp_sum = exp_sum + exp[Scnt];
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
for(Scnt = 0;Scnt<`length;Scnt++)begin
|
| 60 |
+
y[Scnt] = exp[Scnt]/exp_sum;
|
| 61 |
+
end
|
| 62 |
+
end
|
| 63 |
+
endtask
|
| 64 |
+
|
| 65 |
+
reg [9:0] cnt;
|
| 66 |
+
reg [9:0] cnt_valid;
|
| 67 |
+
reg [9:0] y_cnt;
|
| 68 |
+
|
| 69 |
+
real x_real [`length - 1:0];
|
| 70 |
+
real y_real [`length - 1:0];
|
| 71 |
+
reg [31:0] time_cnt;
|
| 72 |
+
reg signed [7:0] x_hard [`length-1:0];
|
| 73 |
+
reg signed [7:0] y_hard [`length-1:0];
|
| 74 |
+
reg control_valid;
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
real differ;
|
| 78 |
+
real temp1;
|
| 79 |
+
real temp2;
|
| 80 |
+
real hard_max;
|
| 81 |
+
real real_max;
|
| 82 |
+
real error_cnt;
|
| 83 |
+
|
| 84 |
+
always @(posedge clk) begin
|
| 85 |
+
if(u_Softmax_control.u_Softmax.out_last | (!top_ready_in))
|
| 86 |
+
control_valid = 0;
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
always @(posedge clk or negedge rst_n) begin
|
| 90 |
+
if(~rst_n)
|
| 91 |
+
time_cnt<=0;
|
| 92 |
+
else
|
| 93 |
+
time_cnt<=time_cnt+1;
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
always @(posedge clk or negedge rst_n) begin
|
| 97 |
+
if(~rst_n)
|
| 98 |
+
cnt_valid<=0;
|
| 99 |
+
else
|
| 100 |
+
cnt_valid <= cnt_valid +1;
|
| 101 |
+
end
|
| 102 |
+
always @(posedge clk or negedge rst_n) begin
|
| 103 |
+
if(~rst_n)
|
| 104 |
+
cnt<=0;
|
| 105 |
+
else if(cnt == length)
|
| 106 |
+
cnt<=0;
|
| 107 |
+
else if(top_valid_in & top_ready_in)
|
| 108 |
+
cnt <= cnt+1;
|
| 109 |
+
end
|
| 110 |
+
|
| 111 |
+
always @(posedge clk or negedge rst_n) begin
|
| 112 |
+
if(~rst_n)
|
| 113 |
+
y_cnt<=0;
|
| 114 |
+
else if(y_cnt == length-1)
|
| 115 |
+
y_cnt<=0;
|
| 116 |
+
else if(top_valid_out)
|
| 117 |
+
y_cnt <= y_cnt+1;
|
| 118 |
+
else
|
| 119 |
+
y_cnt <= y_cnt;
|
| 120 |
+
end
|
| 121 |
+
|
| 122 |
+
always @(posedge clk ) begin
|
| 123 |
+
if(top_valid_out)
|
| 124 |
+
y_hard[y_cnt] <= top_data_out;
|
| 125 |
+
end
|
| 126 |
+
|
| 127 |
+
assign top_data_in = x_hard[cnt];
|
| 128 |
+
assign top_valid_in =(cnt <= `length-1)&(~cnt_valid[1])&control_valid;
|
| 129 |
+
assign top_last_in = (cnt == `length - 1) ;
|
| 130 |
+
|
| 131 |
+
initial begin
|
| 132 |
+
clk = 1;
|
| 133 |
+
end
|
| 134 |
+
|
| 135 |
+
always begin
|
| 136 |
+
#50 clk = ~clk;
|
| 137 |
+
end
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
integer i;
|
| 141 |
+
initial begin
|
| 142 |
+
control_valid = 0;
|
| 143 |
+
rst_n = 0;
|
| 144 |
+
|
| 145 |
+
length = `length;
|
| 146 |
+
scale_in = `scale_in;
|
| 147 |
+
scale_out = `scale_out;
|
| 148 |
+
for(i=0;i<`length;i++)begin
|
| 149 |
+
x_hard[i] = 100;
|
| 150 |
+
// x_hard[i] = $random % 176;
|
| 151 |
+
// if(i==`length/2)
|
| 152 |
+
// x_hard[i] = 110;
|
| 153 |
+
// if(i==`length/3)
|
| 154 |
+
// x_hard[i] = 10;
|
| 155 |
+
// if(i==`length/4)
|
| 156 |
+
// x_hard[i] = 60;
|
| 157 |
+
// if(i==`length/5)
|
| 158 |
+
// x_hard[i] = 40;
|
| 159 |
+
x_real[i] = $itor($signed(x_hard[i])) * $pow(2, -$itor(scale_in));
|
| 160 |
+
end
|
| 161 |
+
Softmax_task(x_real,y_real);
|
| 162 |
+
control_valid = 1;
|
| 163 |
+
#350 rst_n = 1;
|
| 164 |
+
for (i=0;i<5*`length;i++)begin
|
| 165 |
+
#100;
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
error_cnt = 0;
|
| 171 |
+
real_max = 0;
|
| 172 |
+
hard_max = 0;
|
| 173 |
+
for (i=0;i<`length;i++)begin
|
| 174 |
+
temp1 = $itor($signed(y_hard[i])) * $pow(2,-$itor(scale_out));
|
| 175 |
+
temp2 = y_real[i];
|
| 176 |
+
if (temp1 >hard_max)
|
| 177 |
+
hard_max = temp1;
|
| 178 |
+
if(temp2>real_max)
|
| 179 |
+
real_max = temp2;
|
| 180 |
+
differ = temp1- temp2;
|
| 181 |
+
if( differ > $pow(2,-$itor(scale_out)) |differ < -$pow(2,-$itor(scale_out))) begin
|
| 182 |
+
error_cnt++;
|
| 183 |
+
$display("%d: differ percentile = %6.4f%%, differ = %6.4f, real = %6.4f, hard = %6.4f",i,differ/y_real[i]*100,differ,temp2,temp1);
|
| 184 |
+
end
|
| 185 |
+
end
|
| 186 |
+
$display("The ratio of error greater than the minimum precision: %6.4f%%",100 *error_cnt / `length);
|
| 187 |
+
$display("real_max = %6.4f, hard_max = %6.4f",real_max, hard_max);
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
for(i=0;i<`length;i++)begin
|
| 193 |
+
// x_hard[i] = i;
|
| 194 |
+
x_hard[i] = $random % 256;
|
| 195 |
+
// if(i==`length/2)
|
| 196 |
+
// x_hard[i] = 110;
|
| 197 |
+
// if(i==`length/3)
|
| 198 |
+
// x_hard[i] = 10;
|
| 199 |
+
// if(i==`length/4)
|
| 200 |
+
// x_hard[i] = 60;
|
| 201 |
+
// if(i==`length/5)
|
| 202 |
+
// x_hard[i] = 40;
|
| 203 |
+
x_real[i] = $itor($signed(x_hard[i])) * $pow(2, -$itor(scale_in));
|
| 204 |
+
end
|
| 205 |
+
Softmax_task(x_real,y_real);
|
| 206 |
+
control_valid = 1;
|
| 207 |
+
for (i=0;i<5*`length;i++)begin
|
| 208 |
+
#100;
|
| 209 |
+
end
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
error_cnt = 0;
|
| 213 |
+
real_max = 0;
|
| 214 |
+
hard_max = 0;
|
| 215 |
+
for (i=0;i<`length;i++)begin
|
| 216 |
+
temp1 = $itor($signed(y_hard[i])) * $pow(2,-$itor(scale_out));
|
| 217 |
+
temp2 = y_real[i];
|
| 218 |
+
if (temp1 >hard_max)
|
| 219 |
+
hard_max = temp1;
|
| 220 |
+
if(temp2>real_max)
|
| 221 |
+
real_max = temp2;
|
| 222 |
+
differ = temp1- temp2;
|
| 223 |
+
if( differ > $pow(2,-$itor(scale_out)) |differ < -$pow(2,-$itor(scale_out))) begin
|
| 224 |
+
error_cnt++;
|
| 225 |
+
$display("%d: differ percentile = %6.5f%%, differ = %6.5f, real = %6.5f, hard = %6.5f, y_hard = %0d",i,differ/y_real[i]*100,differ,temp2,temp1,y_hard[i]);
|
| 226 |
+
end
|
| 227 |
+
end
|
| 228 |
+
$display("The ratio of error greater than the minimum precision: %6.5f%%",100 *error_cnt / `length);
|
| 229 |
+
$display("real_max = %6.5f, hard_max = %6.5f",real_max, hard_max);
|
| 230 |
+
#100 $finish();
|
| 231 |
+
end
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/sim/gelu_tb.sv
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
module gelu_tb();
|
| 5 |
+
reg [2:0] in_scale;
|
| 6 |
+
reg [7:0] x;
|
| 7 |
+
reg clk;
|
| 8 |
+
reg [127:0] cnt;
|
| 9 |
+
wire [7:0] y;
|
| 10 |
+
|
| 11 |
+
gelu u_gelu(
|
| 12 |
+
.clk(clk),
|
| 13 |
+
.in_scale(in_scale),
|
| 14 |
+
.x(x),
|
| 15 |
+
.y_reg1(y)
|
| 16 |
+
);
|
| 17 |
+
|
| 18 |
+
task gelu_task(input real x, output real y );
|
| 19 |
+
begin
|
| 20 |
+
automatic real tanh_o;
|
| 21 |
+
automatic real tanh_i;
|
| 22 |
+
automatic real pi = 3.1415926535897932;
|
| 23 |
+
automatic real cst_1;
|
| 24 |
+
automatic real cst_2 = 0.044715;
|
| 25 |
+
cst_1 = $sqrt(2/pi);
|
| 26 |
+
tanh_i = cst_1 * (x + cst_2 * $pow(x,3));
|
| 27 |
+
tanh_o= $tanh(tanh_i);
|
| 28 |
+
y= 0.5 * x * (1 + tanh_o);
|
| 29 |
+
end
|
| 30 |
+
endtask
|
| 31 |
+
|
| 32 |
+
always begin
|
| 33 |
+
#50 clk=~clk;
|
| 34 |
+
end
|
| 35 |
+
initial begin
|
| 36 |
+
clk=1;
|
| 37 |
+
#20000$display("cnt = %1d",cnt); $display("END");$finish;
|
| 38 |
+
end
|
| 39 |
+
|
| 40 |
+
initial cnt = 0;
|
| 41 |
+
real y_soft_reg8;
|
| 42 |
+
real y_hard;
|
| 43 |
+
real x_soft;
|
| 44 |
+
real x_soft_reg8;
|
| 45 |
+
real x_hard;
|
| 46 |
+
real temp;
|
| 47 |
+
genvar i;
|
| 48 |
+
//real y_soft_reg_array [7:0];
|
| 49 |
+
//always @(posedge clk ) begin
|
| 50 |
+
// y_soft_reg_array[0] <= y_soft;
|
| 51 |
+
//end
|
| 52 |
+
|
| 53 |
+
//generate
|
| 54 |
+
// for(i=1;i<8;i++)begin
|
| 55 |
+
// always @(posedge clk ) begin
|
| 56 |
+
// y_soft_reg_array[i] <= y_soft_reg_array[i-1];
|
| 57 |
+
// end
|
| 58 |
+
// end
|
| 59 |
+
//endgenerate
|
| 60 |
+
|
| 61 |
+
real x_soft_reg_array [7:0];
|
| 62 |
+
always @(posedge clk ) begin
|
| 63 |
+
x_soft_reg_array[0] <= x_soft;
|
| 64 |
+
end
|
| 65 |
+
|
| 66 |
+
generate
|
| 67 |
+
for(i=1;i<8;i++)begin
|
| 68 |
+
always @(posedge clk ) begin
|
| 69 |
+
x_soft_reg_array[i] <= x_soft_reg_array[i-1];
|
| 70 |
+
end
|
| 71 |
+
end
|
| 72 |
+
endgenerate
|
| 73 |
+
|
| 74 |
+
reg[2:0] in_scale_reg_array [7:0];
|
| 75 |
+
always @(posedge clk ) begin
|
| 76 |
+
in_scale_reg_array[0] <= in_scale;
|
| 77 |
+
end
|
| 78 |
+
|
| 79 |
+
generate
|
| 80 |
+
for(i=1;i<8;i++)begin
|
| 81 |
+
always @(posedge clk ) begin
|
| 82 |
+
in_scale_reg_array[i] <= in_scale_reg_array[i-1];
|
| 83 |
+
end
|
| 84 |
+
end
|
| 85 |
+
endgenerate
|
| 86 |
+
assign x_soft_reg8 = x_soft_reg_array[7];
|
| 87 |
+
real differ;
|
| 88 |
+
always begin
|
| 89 |
+
#50;
|
| 90 |
+
// x=1;in_scale=2;
|
| 91 |
+
x = $random % 128;in_scale = {$random}%7;
|
| 92 |
+
cnt = cnt +1;
|
| 93 |
+
x_soft = $itor($signed(x)) / $pow(2, $itor(in_scale)) ;
|
| 94 |
+
gelu_task(x_soft_reg8,y_soft_reg8);
|
| 95 |
+
y_hard = $itor($signed(y))/$pow(2, $itor(in_scale_reg_array[7]));
|
| 96 |
+
differ = $pow(2, -$itor(in_scale_reg_array[7]));
|
| 97 |
+
temp=y_hard-y_soft_reg8;
|
| 98 |
+
if(temp>differ || temp < -differ)begin
|
| 99 |
+
$display("diff = %6.3f, y_hard=%6.3f, y_soft=%6.3f, x_soft=%6.3f, cnt = %1d",temp,y_hard,y_soft_reg8,x_soft_reg8,cnt);
|
| 100 |
+
end
|
| 101 |
+
|
| 102 |
+
#50;
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/EightGelus.v
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module EightGelus
|
| 4 |
+
#(
|
| 5 |
+
parameter num_gelu = 4
|
| 6 |
+
)
|
| 7 |
+
(
|
| 8 |
+
input clk,
|
| 9 |
+
input rst_n,
|
| 10 |
+
|
| 11 |
+
// input [63:0] in_data,
|
| 12 |
+
input [num_gelu*8 -1: 0] in_data,
|
| 13 |
+
input in_valid,
|
| 14 |
+
output in_ready,
|
| 15 |
+
input in_last,
|
| 16 |
+
// input [7:0] in_keep,
|
| 17 |
+
input [num_gelu-1:0] in_keep,
|
| 18 |
+
|
| 19 |
+
// output [63:0] out_data,
|
| 20 |
+
output [num_gelu*8 -1: 0] out_data,
|
| 21 |
+
output out_valid,
|
| 22 |
+
input out_ready,
|
| 23 |
+
output out_last,
|
| 24 |
+
// output [7:0] out_keep,
|
| 25 |
+
output [num_gelu-1:0] out_keep,
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
input [2:0] scale
|
| 29 |
+
);
|
| 30 |
+
|
| 31 |
+
assign in_ready = out_ready;
|
| 32 |
+
reg [8:0] valid_reg;
|
| 33 |
+
|
| 34 |
+
always@(posedge clk or negedge rst_n)begin
|
| 35 |
+
if(~rst_n)
|
| 36 |
+
valid_reg[0]<=0;
|
| 37 |
+
else
|
| 38 |
+
valid_reg[0] <= in_valid;
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
genvar i;
|
| 42 |
+
generate
|
| 43 |
+
for(i=1;i<9;i=i+1)begin
|
| 44 |
+
always@(posedge clk or negedge rst_n)begin
|
| 45 |
+
if(~rst_n)
|
| 46 |
+
valid_reg[i]<=0;
|
| 47 |
+
else
|
| 48 |
+
valid_reg[i]<=valid_reg[i-1];
|
| 49 |
+
|
| 50 |
+
end
|
| 51 |
+
end
|
| 52 |
+
endgenerate
|
| 53 |
+
assign out_valid = valid_reg[8];
|
| 54 |
+
|
| 55 |
+
reg [8:0] last_reg;
|
| 56 |
+
|
| 57 |
+
always@(posedge clk or negedge rst_n)begin
|
| 58 |
+
if(~rst_n)
|
| 59 |
+
last_reg[0]<=0;
|
| 60 |
+
else
|
| 61 |
+
last_reg[0] <= in_last;
|
| 62 |
+
end
|
| 63 |
+
|
| 64 |
+
generate
|
| 65 |
+
for(i=1;i<9;i=i+1)begin
|
| 66 |
+
always@(posedge clk or negedge rst_n)begin
|
| 67 |
+
if(~rst_n)
|
| 68 |
+
last_reg[i]<=0;
|
| 69 |
+
else
|
| 70 |
+
last_reg[i]<=last_reg[i-1];
|
| 71 |
+
|
| 72 |
+
end
|
| 73 |
+
end
|
| 74 |
+
endgenerate
|
| 75 |
+
assign out_last = last_reg[8];
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
reg [num_gelu*8-1:0] in_data_delay1;
|
| 79 |
+
|
| 80 |
+
always@(posedge clk or negedge rst_n)begin
|
| 81 |
+
if(~rst_n)
|
| 82 |
+
in_data_delay1<=0;
|
| 83 |
+
else
|
| 84 |
+
in_data_delay1<=in_data;
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
reg [num_gelu-1:0] keep_reg [8:0];
|
| 88 |
+
assign out_keep = keep_reg[8];
|
| 89 |
+
always@(posedge clk or negedge rst_n)begin
|
| 90 |
+
if(~rst_n)
|
| 91 |
+
keep_reg[0] <=0;
|
| 92 |
+
else
|
| 93 |
+
keep_reg[0] <= in_keep;
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
generate
|
| 97 |
+
for(i=1;i<9;i=i+1)begin
|
| 98 |
+
always@(posedge clk or negedge rst_n)begin
|
| 99 |
+
if(~rst_n)
|
| 100 |
+
keep_reg[i] <=0;
|
| 101 |
+
else
|
| 102 |
+
keep_reg[i] <= keep_reg[i-1];
|
| 103 |
+
end
|
| 104 |
+
end
|
| 105 |
+
endgenerate
|
| 106 |
+
|
| 107 |
+
generate
|
| 108 |
+
for(i=0;i<num_gelu;i=i+1)begin
|
| 109 |
+
gelu u_gelu(
|
| 110 |
+
.clk(clk),
|
| 111 |
+
.in_scale(scale),
|
| 112 |
+
.x(in_data_delay1[i*8+7 : i*8]),
|
| 113 |
+
.y_reg1(out_data[i*8+7 : i*8])
|
| 114 |
+
);
|
| 115 |
+
end
|
| 116 |
+
endgenerate
|
| 117 |
+
|
| 118 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Exp_module.v
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
module Exp_module(//latency = 3
|
| 3 |
+
input clk,
|
| 4 |
+
input signed [19:0] x_S9Q10, //signed
|
| 5 |
+
output reg signed [24:0] y_U0Q25_reg1 //unsigned
|
| 6 |
+
);
|
| 7 |
+
|
| 8 |
+
wire signed [24:0] x_log2e_S10Q14; //signed��less or equal 0
|
| 9 |
+
reg signed [24:0] x_log2e_S10Q14_reg1; //signed��less or equal 0
|
| 10 |
+
assign x_log2e_S10Q14 = x_S9Q10 * 6'sd23;
|
| 11 |
+
|
| 12 |
+
always@(posedge clk)begin
|
| 13 |
+
x_log2e_S10Q14_reg1 <= x_log2e_S10Q14;
|
| 14 |
+
end
|
| 15 |
+
|
| 16 |
+
wire [23:0] x_log2e_U10Q14_abs;
|
| 17 |
+
assign x_log2e_U10Q14_abs = ~x_log2e_S10Q14_reg1+1;
|
| 18 |
+
|
| 19 |
+
wire [9:0] x_int_10Q0 = x_log2e_U10Q14_abs[23:14];
|
| 20 |
+
|
| 21 |
+
wire [13:0] x_decimal_0Q14 = x_log2e_U10Q14_abs[13:0];
|
| 22 |
+
|
| 23 |
+
wire [14:0] temp_1Q14 = 15'b100_0000_0000_0000 - {2'b0,x_decimal_0Q14[13:1]};//1+0.5*x_decimal,unsigned
|
| 24 |
+
reg [14:0] temp_1Q14_reg1;
|
| 25 |
+
wire [3:0] x_int_4Q0;//unsigned
|
| 26 |
+
assign x_int_4Q0 = (x_int_10Q0 > 12)? 4'd12 : x_int_10Q0;//to 12bits
|
| 27 |
+
|
| 28 |
+
wire [11:0] temp_2_int_1Q11;
|
| 29 |
+
reg [11:0] temp_2_int_1Q11_reg1;
|
| 30 |
+
assign temp_2_int_1Q11 = 12'b1000_0000_0000 >> x_int_4Q0;
|
| 31 |
+
always@(posedge clk)begin
|
| 32 |
+
temp_2_int_1Q11_reg1<=temp_2_int_1Q11;
|
| 33 |
+
temp_1Q14_reg1<=temp_1Q14;
|
| 34 |
+
end
|
| 35 |
+
|
| 36 |
+
wire [26:0] temp_y_2Q25 = temp_2_int_1Q11_reg1 * temp_1Q14_reg1;//unsigned
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
// wire signed [11:0] y_U0Q12;
|
| 40 |
+
// assign y_U0Q12 = temp_y_2Q25[25] == 1'b1 ? 12'b1111_1111_1111:temp_y_2Q25[24:13];
|
| 41 |
+
wire signed [24:0] y_U0Q25;
|
| 42 |
+
assign y_U0Q25 = temp_y_2Q25[25] == 1'b1 ? 25'h1FF_FFFF:temp_y_2Q25[24:0];
|
| 43 |
+
|
| 44 |
+
always@(posedge clk)begin
|
| 45 |
+
y_U0Q25_reg1<=y_U0Q25;
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Gelus_axi.v
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`timescale 1 ns / 1 ps
|
| 3 |
+
|
| 4 |
+
module Gelus_axi #
|
| 5 |
+
(
|
| 6 |
+
// Users to add parameters here
|
| 7 |
+
|
| 8 |
+
// User parameters ends
|
| 9 |
+
parameter integer num_gelu = 4,
|
| 10 |
+
// Do not modify the parameters beyond this line
|
| 11 |
+
|
| 12 |
+
// Width of S_AXI data bus
|
| 13 |
+
parameter integer C_S_AXI_DATA_WIDTH = 32,
|
| 14 |
+
// Width of S_AXI address bus
|
| 15 |
+
parameter integer C_S_AXI_ADDR_WIDTH = 4
|
| 16 |
+
)
|
| 17 |
+
(
|
| 18 |
+
// Users to add ports here
|
| 19 |
+
input axis_aclk,
|
| 20 |
+
input aresetn,
|
| 21 |
+
|
| 22 |
+
input [num_gelu*8-1:0] s_axis_tdata,
|
| 23 |
+
input s_axis_tvalid,
|
| 24 |
+
output s_axis_tready,
|
| 25 |
+
input s_axis_tlast,
|
| 26 |
+
input [num_gelu-1:0] s_axis_tkeep,
|
| 27 |
+
|
| 28 |
+
output [num_gelu*8-1:0] m_axis_tdata,
|
| 29 |
+
output m_axis_tvalid,
|
| 30 |
+
input m_axis_tready,
|
| 31 |
+
output m_axis_tlast,
|
| 32 |
+
output [num_gelu-1:0] m_axis_tkeep,
|
| 33 |
+
|
| 34 |
+
// User ports ends
|
| 35 |
+
// Do not modify the ports beyond this line
|
| 36 |
+
|
| 37 |
+
// Global Clock Signal
|
| 38 |
+
input wire S_AXI_ACLK,
|
| 39 |
+
// Global Reset Signal. This Signal is Active LOW
|
| 40 |
+
input wire S_AXI_ARESETN,
|
| 41 |
+
// Write address (issued by master, acceped by Slave)
|
| 42 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_AWADDR,
|
| 43 |
+
// Write channel Protection type. This signal indicates the
|
| 44 |
+
// privilege and security level of the transaction, and whether
|
| 45 |
+
// the transaction is a data access or an instruction access.
|
| 46 |
+
input wire [2 : 0] S_AXI_AWPROT,
|
| 47 |
+
// Write address valid. This signal indicates that the master signaling
|
| 48 |
+
// valid write address and control information.
|
| 49 |
+
input wire S_AXI_AWVALID,
|
| 50 |
+
// Write address ready. This signal indicates that the slave is ready
|
| 51 |
+
// to accept an address and associated control signals.
|
| 52 |
+
output wire S_AXI_AWREADY,
|
| 53 |
+
// Write data (issued by master, acceped by Slave)
|
| 54 |
+
input wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_WDATA,
|
| 55 |
+
// Write strobes. This signal indicates which byte lanes hold
|
| 56 |
+
// valid data. There is one write strobe bit for each eight
|
| 57 |
+
// bits of the write data bus.
|
| 58 |
+
input wire [(C_S_AXI_DATA_WIDTH/8)-1 : 0] S_AXI_WSTRB,
|
| 59 |
+
// Write valid. This signal indicates that valid write
|
| 60 |
+
// data and strobes are available.
|
| 61 |
+
input wire S_AXI_WVALID,
|
| 62 |
+
// Write ready. This signal indicates that the slave
|
| 63 |
+
// can accept the write data.
|
| 64 |
+
output wire S_AXI_WREADY,
|
| 65 |
+
// Write response. This signal indicates the status
|
| 66 |
+
// of the write transaction.
|
| 67 |
+
output wire [1 : 0] S_AXI_BRESP,
|
| 68 |
+
// Write response valid. This signal indicates that the channel
|
| 69 |
+
// is signaling a valid write response.
|
| 70 |
+
output wire S_AXI_BVALID,
|
| 71 |
+
// Response ready. This signal indicates that the master
|
| 72 |
+
// can accept a write response.
|
| 73 |
+
input wire S_AXI_BREADY,
|
| 74 |
+
// Read address (issued by master, acceped by Slave)
|
| 75 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_ARADDR,
|
| 76 |
+
// Protection type. This signal indicates the privilege
|
| 77 |
+
// and security level of the transaction, and whether the
|
| 78 |
+
// transaction is a data access or an instruction access.
|
| 79 |
+
input wire [2 : 0] S_AXI_ARPROT,
|
| 80 |
+
// Read address valid. This signal indicates that the channel
|
| 81 |
+
// is signaling valid read address and control information.
|
| 82 |
+
input wire S_AXI_ARVALID,
|
| 83 |
+
// Read address ready. This signal indicates that the slave is
|
| 84 |
+
// ready to accept an address and associated control signals.
|
| 85 |
+
output wire S_AXI_ARREADY,
|
| 86 |
+
// Read data (issued by slave)
|
| 87 |
+
output wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_RDATA,
|
| 88 |
+
// Read response. This signal indicates the status of the
|
| 89 |
+
// read transfer.
|
| 90 |
+
output wire [1 : 0] S_AXI_RRESP,
|
| 91 |
+
// Read valid. This signal indicates that the channel is
|
| 92 |
+
// signaling the required read data.
|
| 93 |
+
output wire S_AXI_RVALID,
|
| 94 |
+
// Read ready. This signal indicates that the master can
|
| 95 |
+
// accept the read data and response information.
|
| 96 |
+
input wire S_AXI_RREADY
|
| 97 |
+
);
|
| 98 |
+
|
| 99 |
+
// AXI4LITE signals
|
| 100 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_awaddr;
|
| 101 |
+
reg axi_awready;
|
| 102 |
+
reg axi_wready;
|
| 103 |
+
reg [1 : 0] axi_bresp;
|
| 104 |
+
reg axi_bvalid;
|
| 105 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_araddr;
|
| 106 |
+
reg axi_arready;
|
| 107 |
+
reg [C_S_AXI_DATA_WIDTH-1 : 0] axi_rdata;
|
| 108 |
+
reg [1 : 0] axi_rresp;
|
| 109 |
+
reg axi_rvalid;
|
| 110 |
+
|
| 111 |
+
// Example-specific design signals
|
| 112 |
+
// local parameter for addressing 32 bit / 64 bit C_S_AXI_DATA_WIDTH
|
| 113 |
+
// ADDR_LSB is used for addressing 32/64 bit registers/memories
|
| 114 |
+
// ADDR_LSB = 2 for 32 bits (n downto 2)
|
| 115 |
+
// ADDR_LSB = 3 for 64 bits (n downto 3)
|
| 116 |
+
localparam integer ADDR_LSB = (C_S_AXI_DATA_WIDTH/32) + 1;
|
| 117 |
+
localparam integer OPT_MEM_ADDR_BITS = 1;
|
| 118 |
+
//----------------------------------------------
|
| 119 |
+
//-- Signals for user logic register space example
|
| 120 |
+
//------------------------------------------------
|
| 121 |
+
//-- Number of Slave Registers 4
|
| 122 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg0;
|
| 123 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg1;
|
| 124 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg2;
|
| 125 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg3;
|
| 126 |
+
wire slv_reg_rden;
|
| 127 |
+
wire slv_reg_wren;
|
| 128 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] reg_data_out;
|
| 129 |
+
integer byte_index;
|
| 130 |
+
reg aw_en;
|
| 131 |
+
|
| 132 |
+
// I/O Connections assignments
|
| 133 |
+
|
| 134 |
+
assign S_AXI_AWREADY = axi_awready;
|
| 135 |
+
assign S_AXI_WREADY = axi_wready;
|
| 136 |
+
assign S_AXI_BRESP = axi_bresp;
|
| 137 |
+
assign S_AXI_BVALID = axi_bvalid;
|
| 138 |
+
assign S_AXI_ARREADY = axi_arready;
|
| 139 |
+
assign S_AXI_RDATA = axi_rdata;
|
| 140 |
+
assign S_AXI_RRESP = axi_rresp;
|
| 141 |
+
assign S_AXI_RVALID = axi_rvalid;
|
| 142 |
+
// Implement axi_awready generation
|
| 143 |
+
// axi_awready is asserted for one S_AXI_ACLK clock cycle when both
|
| 144 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_awready is
|
| 145 |
+
// de-asserted when reset is low.
|
| 146 |
+
|
| 147 |
+
always @( posedge S_AXI_ACLK )
|
| 148 |
+
begin
|
| 149 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 150 |
+
begin
|
| 151 |
+
axi_awready <= 1'b0;
|
| 152 |
+
aw_en <= 1'b1;
|
| 153 |
+
end
|
| 154 |
+
else
|
| 155 |
+
begin
|
| 156 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 157 |
+
begin
|
| 158 |
+
// slave is ready to accept write address when
|
| 159 |
+
// there is a valid write address and write data
|
| 160 |
+
// on the write address and data bus. This design
|
| 161 |
+
// expects no outstanding transactions.
|
| 162 |
+
axi_awready <= 1'b1;
|
| 163 |
+
aw_en <= 1'b0;
|
| 164 |
+
end
|
| 165 |
+
else if (S_AXI_BREADY && axi_bvalid)
|
| 166 |
+
begin
|
| 167 |
+
aw_en <= 1'b1;
|
| 168 |
+
axi_awready <= 1'b0;
|
| 169 |
+
end
|
| 170 |
+
else
|
| 171 |
+
begin
|
| 172 |
+
axi_awready <= 1'b0;
|
| 173 |
+
end
|
| 174 |
+
end
|
| 175 |
+
end
|
| 176 |
+
|
| 177 |
+
// Implement axi_awaddr latching
|
| 178 |
+
// This process is used to latch the address when both
|
| 179 |
+
// S_AXI_AWVALID and S_AXI_WVALID are valid.
|
| 180 |
+
|
| 181 |
+
always @( posedge S_AXI_ACLK )
|
| 182 |
+
begin
|
| 183 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 184 |
+
begin
|
| 185 |
+
axi_awaddr <= 0;
|
| 186 |
+
end
|
| 187 |
+
else
|
| 188 |
+
begin
|
| 189 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 190 |
+
begin
|
| 191 |
+
// Write Address latching
|
| 192 |
+
axi_awaddr <= S_AXI_AWADDR;
|
| 193 |
+
end
|
| 194 |
+
end
|
| 195 |
+
end
|
| 196 |
+
|
| 197 |
+
// Implement axi_wready generation
|
| 198 |
+
// axi_wready is asserted for one S_AXI_ACLK clock cycle when both
|
| 199 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_wready is
|
| 200 |
+
// de-asserted when reset is low.
|
| 201 |
+
|
| 202 |
+
always @( posedge S_AXI_ACLK )
|
| 203 |
+
begin
|
| 204 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 205 |
+
begin
|
| 206 |
+
axi_wready <= 1'b0;
|
| 207 |
+
end
|
| 208 |
+
else
|
| 209 |
+
begin
|
| 210 |
+
if (~axi_wready && S_AXI_WVALID && S_AXI_AWVALID && aw_en )
|
| 211 |
+
begin
|
| 212 |
+
// slave is ready to accept write data when
|
| 213 |
+
// there is a valid write address and write data
|
| 214 |
+
// on the write address and data bus. This design
|
| 215 |
+
// expects no outstanding transactions.
|
| 216 |
+
axi_wready <= 1'b1;
|
| 217 |
+
end
|
| 218 |
+
else
|
| 219 |
+
begin
|
| 220 |
+
axi_wready <= 1'b0;
|
| 221 |
+
end
|
| 222 |
+
end
|
| 223 |
+
end
|
| 224 |
+
|
| 225 |
+
// Implement memory mapped register select and write logic generation
|
| 226 |
+
// The write data is accepted and written to memory mapped registers when
|
| 227 |
+
// axi_awready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted. Write strobes are used to
|
| 228 |
+
// select byte enables of slave registers while writing.
|
| 229 |
+
// These registers are cleared when reset (active low) is applied.
|
| 230 |
+
// Slave register write enable is asserted when valid address and data are available
|
| 231 |
+
// and the slave is ready to accept the write address and write data.
|
| 232 |
+
assign slv_reg_wren = axi_wready && S_AXI_WVALID && axi_awready && S_AXI_AWVALID;
|
| 233 |
+
|
| 234 |
+
always @( posedge S_AXI_ACLK )
|
| 235 |
+
begin
|
| 236 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 237 |
+
begin
|
| 238 |
+
slv_reg0 <= 0;
|
| 239 |
+
slv_reg1 <= 0;
|
| 240 |
+
slv_reg2 <= 0;
|
| 241 |
+
slv_reg3 <= 0;
|
| 242 |
+
end
|
| 243 |
+
else begin
|
| 244 |
+
if (slv_reg_wren)
|
| 245 |
+
begin
|
| 246 |
+
case ( axi_awaddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 247 |
+
2'h0:
|
| 248 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 249 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 250 |
+
// Respective byte enables are asserted as per write strobes
|
| 251 |
+
// Slave register 0
|
| 252 |
+
slv_reg0[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 253 |
+
end
|
| 254 |
+
2'h1:
|
| 255 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 256 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 257 |
+
// Respective byte enables are asserted as per write strobes
|
| 258 |
+
// Slave register 1
|
| 259 |
+
slv_reg1[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 260 |
+
end
|
| 261 |
+
2'h2:
|
| 262 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 263 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 264 |
+
// Respective byte enables are asserted as per write strobes
|
| 265 |
+
// Slave register 2
|
| 266 |
+
slv_reg2[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 267 |
+
end
|
| 268 |
+
2'h3:
|
| 269 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 270 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 271 |
+
// Respective byte enables are asserted as per write strobes
|
| 272 |
+
// Slave register 3
|
| 273 |
+
slv_reg3[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 274 |
+
end
|
| 275 |
+
default : begin
|
| 276 |
+
slv_reg0 <= slv_reg0;
|
| 277 |
+
slv_reg1 <= slv_reg1;
|
| 278 |
+
slv_reg2 <= slv_reg2;
|
| 279 |
+
slv_reg3 <= slv_reg3;
|
| 280 |
+
end
|
| 281 |
+
endcase
|
| 282 |
+
end
|
| 283 |
+
end
|
| 284 |
+
end
|
| 285 |
+
|
| 286 |
+
// Implement write response logic generation
|
| 287 |
+
// The write response and response valid signals are asserted by the slave
|
| 288 |
+
// when axi_wready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted.
|
| 289 |
+
// This marks the acceptance of address and indicates the status of
|
| 290 |
+
// write transaction.
|
| 291 |
+
|
| 292 |
+
always @( posedge S_AXI_ACLK )
|
| 293 |
+
begin
|
| 294 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 295 |
+
begin
|
| 296 |
+
axi_bvalid <= 0;
|
| 297 |
+
axi_bresp <= 2'b0;
|
| 298 |
+
end
|
| 299 |
+
else
|
| 300 |
+
begin
|
| 301 |
+
if (axi_awready && S_AXI_AWVALID && ~axi_bvalid && axi_wready && S_AXI_WVALID)
|
| 302 |
+
begin
|
| 303 |
+
// indicates a valid write response is available
|
| 304 |
+
axi_bvalid <= 1'b1;
|
| 305 |
+
axi_bresp <= 2'b0; // 'OKAY' response
|
| 306 |
+
end // work error responses in future
|
| 307 |
+
else
|
| 308 |
+
begin
|
| 309 |
+
if (S_AXI_BREADY && axi_bvalid)
|
| 310 |
+
//check if bready is asserted while bvalid is high)
|
| 311 |
+
//(there is a possibility that bready is always asserted high)
|
| 312 |
+
begin
|
| 313 |
+
axi_bvalid <= 1'b0;
|
| 314 |
+
end
|
| 315 |
+
end
|
| 316 |
+
end
|
| 317 |
+
end
|
| 318 |
+
|
| 319 |
+
// Implement axi_arready generation
|
| 320 |
+
// axi_arready is asserted for one S_AXI_ACLK clock cycle when
|
| 321 |
+
// S_AXI_ARVALID is asserted. axi_awready is
|
| 322 |
+
// de-asserted when reset (active low) is asserted.
|
| 323 |
+
// The read address is also latched when S_AXI_ARVALID is
|
| 324 |
+
// asserted. axi_araddr is reset to zero on reset assertion.
|
| 325 |
+
|
| 326 |
+
always @( posedge S_AXI_ACLK )
|
| 327 |
+
begin
|
| 328 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 329 |
+
begin
|
| 330 |
+
axi_arready <= 1'b0;
|
| 331 |
+
axi_araddr <= 32'b0;
|
| 332 |
+
end
|
| 333 |
+
else
|
| 334 |
+
begin
|
| 335 |
+
if (~axi_arready && S_AXI_ARVALID)
|
| 336 |
+
begin
|
| 337 |
+
// indicates that the slave has acceped the valid read address
|
| 338 |
+
axi_arready <= 1'b1;
|
| 339 |
+
// Read address latching
|
| 340 |
+
axi_araddr <= S_AXI_ARADDR;
|
| 341 |
+
end
|
| 342 |
+
else
|
| 343 |
+
begin
|
| 344 |
+
axi_arready <= 1'b0;
|
| 345 |
+
end
|
| 346 |
+
end
|
| 347 |
+
end
|
| 348 |
+
|
| 349 |
+
// Implement axi_arvalid generation
|
| 350 |
+
// axi_rvalid is asserted for one S_AXI_ACLK clock cycle when both
|
| 351 |
+
// S_AXI_ARVALID and axi_arready are asserted. The slave registers
|
| 352 |
+
// data are available on the axi_rdata bus at this instance. The
|
| 353 |
+
// assertion of axi_rvalid marks the validity of read data on the
|
| 354 |
+
// bus and axi_rresp indicates the status of read transaction.axi_rvalid
|
| 355 |
+
// is deasserted on reset (active low). axi_rresp and axi_rdata are
|
| 356 |
+
// cleared to zero on reset (active low).
|
| 357 |
+
always @( posedge S_AXI_ACLK )
|
| 358 |
+
begin
|
| 359 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 360 |
+
begin
|
| 361 |
+
axi_rvalid <= 0;
|
| 362 |
+
axi_rresp <= 0;
|
| 363 |
+
end
|
| 364 |
+
else
|
| 365 |
+
begin
|
| 366 |
+
if (axi_arready && S_AXI_ARVALID && ~axi_rvalid)
|
| 367 |
+
begin
|
| 368 |
+
// Valid read data is available at the read data bus
|
| 369 |
+
axi_rvalid <= 1'b1;
|
| 370 |
+
axi_rresp <= 2'b0; // 'OKAY' response
|
| 371 |
+
end
|
| 372 |
+
else if (axi_rvalid && S_AXI_RREADY)
|
| 373 |
+
begin
|
| 374 |
+
// Read data is accepted by the master
|
| 375 |
+
axi_rvalid <= 1'b0;
|
| 376 |
+
end
|
| 377 |
+
end
|
| 378 |
+
end
|
| 379 |
+
|
| 380 |
+
// Implement memory mapped register select and read logic generation
|
| 381 |
+
// Slave register read enable is asserted when valid address is available
|
| 382 |
+
// and the slave is ready to accept the read address.
|
| 383 |
+
assign slv_reg_rden = axi_arready & S_AXI_ARVALID & ~axi_rvalid;
|
| 384 |
+
always @(*)
|
| 385 |
+
begin
|
| 386 |
+
// Address decoding for reading registers
|
| 387 |
+
case ( axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 388 |
+
2'h0 : reg_data_out <= slv_reg0;
|
| 389 |
+
2'h1 : reg_data_out <= slv_reg1;
|
| 390 |
+
2'h2 : reg_data_out <= slv_reg2;
|
| 391 |
+
2'h3 : reg_data_out <= slv_reg3;
|
| 392 |
+
default : reg_data_out <= 0;
|
| 393 |
+
endcase
|
| 394 |
+
end
|
| 395 |
+
|
| 396 |
+
// Output register or memory read data
|
| 397 |
+
always @( posedge S_AXI_ACLK )
|
| 398 |
+
begin
|
| 399 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 400 |
+
begin
|
| 401 |
+
axi_rdata <= 0;
|
| 402 |
+
end
|
| 403 |
+
else
|
| 404 |
+
begin
|
| 405 |
+
// When there is a valid read address (S_AXI_ARVALID) with
|
| 406 |
+
// acceptance of read address by the slave (axi_arready),
|
| 407 |
+
// output the read dada
|
| 408 |
+
if (slv_reg_rden)
|
| 409 |
+
begin
|
| 410 |
+
axi_rdata <= reg_data_out; // register read data
|
| 411 |
+
end
|
| 412 |
+
end
|
| 413 |
+
end
|
| 414 |
+
|
| 415 |
+
// Add user logic here
|
| 416 |
+
EightGelus
|
| 417 |
+
#(
|
| 418 |
+
.num_gelu(num_gelu)
|
| 419 |
+
)u_EightGelus
|
| 420 |
+
(
|
| 421 |
+
.clk(axis_aclk),
|
| 422 |
+
.rst_n(aresetn),
|
| 423 |
+
|
| 424 |
+
.in_data(s_axis_tdata),
|
| 425 |
+
.in_valid(s_axis_tvalid),
|
| 426 |
+
.in_ready(s_axis_tready),
|
| 427 |
+
.in_last(s_axis_tlast),
|
| 428 |
+
.in_keep(s_axis_tkeep),
|
| 429 |
+
|
| 430 |
+
.out_data(m_axis_tdata),
|
| 431 |
+
.out_valid(m_axis_tvalid),
|
| 432 |
+
.out_ready(m_axis_tready),
|
| 433 |
+
.out_last(m_axis_tlast),
|
| 434 |
+
.out_keep(m_axis_tkeep),
|
| 435 |
+
|
| 436 |
+
.scale(slv_reg0)
|
| 437 |
+
);
|
| 438 |
+
// User logic ends
|
| 439 |
+
|
| 440 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Gelus_top.v
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`timescale 1 ns / 1 ps
|
| 3 |
+
|
| 4 |
+
module Gelus_top #
|
| 5 |
+
(
|
| 6 |
+
// Users to add parameters here
|
| 7 |
+
parameter integer num_gelu = 4,
|
| 8 |
+
// User parameters ends
|
| 9 |
+
// Do not modify the parameters beyond this line
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
// Parameters of Axi Slave Bus Interface S00_AXI
|
| 13 |
+
localparam integer C_S00_AXI_DATA_WIDTH = 32,
|
| 14 |
+
localparam integer C_S00_AXI_ADDR_WIDTH = 4
|
| 15 |
+
)
|
| 16 |
+
(
|
| 17 |
+
// Users to add ports here
|
| 18 |
+
input axis_aclk,
|
| 19 |
+
input aresetn,
|
| 20 |
+
|
| 21 |
+
input [num_gelu*8-1:0] s_axis_tdata,
|
| 22 |
+
input s_axis_tvalid,
|
| 23 |
+
output s_axis_tready,
|
| 24 |
+
input s_axis_tlast,
|
| 25 |
+
input [num_gelu-1:0] s_axis_tkeep,
|
| 26 |
+
|
| 27 |
+
output [num_gelu*8-1:0] m_axis_tdata,
|
| 28 |
+
output m_axis_tvalid,
|
| 29 |
+
input m_axis_tready,
|
| 30 |
+
output m_axis_tlast,
|
| 31 |
+
output [num_gelu-1:0] m_axis_tkeep,
|
| 32 |
+
// User ports ends
|
| 33 |
+
// Do not modify the ports beyond this line
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
// Ports of Axi Slave Bus Interface S00_AXI
|
| 37 |
+
input wire s00_axi_aclk,
|
| 38 |
+
input wire s00_axi_aresetn,
|
| 39 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_awaddr,
|
| 40 |
+
input wire [2 : 0] s00_axi_awprot,
|
| 41 |
+
input wire s00_axi_awvalid,
|
| 42 |
+
output wire s00_axi_awready,
|
| 43 |
+
input wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_wdata,
|
| 44 |
+
input wire [(C_S00_AXI_DATA_WIDTH/8)-1 : 0] s00_axi_wstrb,
|
| 45 |
+
input wire s00_axi_wvalid,
|
| 46 |
+
output wire s00_axi_wready,
|
| 47 |
+
output wire [1 : 0] s00_axi_bresp,
|
| 48 |
+
output wire s00_axi_bvalid,
|
| 49 |
+
input wire s00_axi_bready,
|
| 50 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_araddr,
|
| 51 |
+
input wire [2 : 0] s00_axi_arprot,
|
| 52 |
+
input wire s00_axi_arvalid,
|
| 53 |
+
output wire s00_axi_arready,
|
| 54 |
+
output wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_rdata,
|
| 55 |
+
output wire [1 : 0] s00_axi_rresp,
|
| 56 |
+
output wire s00_axi_rvalid,
|
| 57 |
+
input wire s00_axi_rready
|
| 58 |
+
);
|
| 59 |
+
// Instantiation of Axi Bus Interface S00_AXI
|
| 60 |
+
Gelus_axi # (
|
| 61 |
+
.num_gelu(num_gelu),
|
| 62 |
+
.C_S_AXI_DATA_WIDTH(C_S00_AXI_DATA_WIDTH),
|
| 63 |
+
.C_S_AXI_ADDR_WIDTH(C_S00_AXI_ADDR_WIDTH)
|
| 64 |
+
) Gelus_axi (
|
| 65 |
+
.axis_aclk(axis_aclk),
|
| 66 |
+
.aresetn(aresetn),
|
| 67 |
+
|
| 68 |
+
.s_axis_tdata(s_axis_tdata),
|
| 69 |
+
.s_axis_tvalid(s_axis_tvalid),
|
| 70 |
+
.s_axis_tready(s_axis_tready),
|
| 71 |
+
.s_axis_tlast(s_axis_tlast),
|
| 72 |
+
.s_axis_tkeep(s_axis_tkeep),
|
| 73 |
+
|
| 74 |
+
.m_axis_tdata(m_axis_tdata),
|
| 75 |
+
.m_axis_tvalid(m_axis_tvalid),
|
| 76 |
+
.m_axis_tready(m_axis_tready),
|
| 77 |
+
.m_axis_tlast(m_axis_tlast),
|
| 78 |
+
.m_axis_tkeep(m_axis_tkeep),
|
| 79 |
+
|
| 80 |
+
.S_AXI_ACLK(s00_axi_aclk),
|
| 81 |
+
.S_AXI_ARESETN(s00_axi_aresetn),
|
| 82 |
+
.S_AXI_AWADDR(s00_axi_awaddr),
|
| 83 |
+
.S_AXI_AWPROT(s00_axi_awprot),
|
| 84 |
+
.S_AXI_AWVALID(s00_axi_awvalid),
|
| 85 |
+
.S_AXI_AWREADY(s00_axi_awready),
|
| 86 |
+
.S_AXI_WDATA(s00_axi_wdata),
|
| 87 |
+
.S_AXI_WSTRB(s00_axi_wstrb),
|
| 88 |
+
.S_AXI_WVALID(s00_axi_wvalid),
|
| 89 |
+
.S_AXI_WREADY(s00_axi_wready),
|
| 90 |
+
.S_AXI_BRESP(s00_axi_bresp),
|
| 91 |
+
.S_AXI_BVALID(s00_axi_bvalid),
|
| 92 |
+
.S_AXI_BREADY(s00_axi_bready),
|
| 93 |
+
.S_AXI_ARADDR(s00_axi_araddr),
|
| 94 |
+
.S_AXI_ARPROT(s00_axi_arprot),
|
| 95 |
+
.S_AXI_ARVALID(s00_axi_arvalid),
|
| 96 |
+
.S_AXI_ARREADY(s00_axi_arready),
|
| 97 |
+
.S_AXI_RDATA(s00_axi_rdata),
|
| 98 |
+
.S_AXI_RRESP(s00_axi_rresp),
|
| 99 |
+
.S_AXI_RVALID(s00_axi_rvalid),
|
| 100 |
+
.S_AXI_RREADY(s00_axi_rready)
|
| 101 |
+
);
|
| 102 |
+
|
| 103 |
+
// Add user logic here
|
| 104 |
+
|
| 105 |
+
// User logic ends
|
| 106 |
+
|
| 107 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Ln_module.v
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
module Ln_module(//latency=2
|
| 3 |
+
input clk,
|
| 4 |
+
input [15:0] x_U8Q8,
|
| 5 |
+
output [12:0] y_U3Q10
|
| 6 |
+
);
|
| 7 |
+
|
| 8 |
+
reg [2:0] w;
|
| 9 |
+
|
| 10 |
+
reg [14:0] k_1_0Q15;
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
always @(*) begin
|
| 15 |
+
if (x_U8Q8[15]==1'b1)begin
|
| 16 |
+
w = 7;
|
| 17 |
+
k_1_0Q15 = x_U8Q8[14:0];
|
| 18 |
+
end
|
| 19 |
+
else if (x_U8Q8[14]==1'b1)begin
|
| 20 |
+
w = 6;
|
| 21 |
+
k_1_0Q15 = {x_U8Q8[13:0],1'b0};
|
| 22 |
+
end
|
| 23 |
+
else if (x_U8Q8[13]==1'b1)begin
|
| 24 |
+
w = 5;
|
| 25 |
+
k_1_0Q15 = {x_U8Q8[12:0],2'b00};
|
| 26 |
+
end
|
| 27 |
+
else if (x_U8Q8[12]==1'b1)begin
|
| 28 |
+
w = 4;
|
| 29 |
+
k_1_0Q15 = {x_U8Q8[11:0],3'b000};
|
| 30 |
+
end
|
| 31 |
+
else if (x_U8Q8[11]==1'b1)begin
|
| 32 |
+
w = 3;
|
| 33 |
+
k_1_0Q15 = {x_U8Q8[10:0],4'b0000};
|
| 34 |
+
end
|
| 35 |
+
else if (x_U8Q8[10]==1'b1)begin
|
| 36 |
+
w = 2;
|
| 37 |
+
k_1_0Q15 = {x_U8Q8[9:0],5'b00000};
|
| 38 |
+
end
|
| 39 |
+
else if (x_U8Q8[9]==1'b1)begin
|
| 40 |
+
w = 1;
|
| 41 |
+
k_1_0Q15 = {x_U8Q8[8:0],6'b000000};
|
| 42 |
+
end
|
| 43 |
+
else begin
|
| 44 |
+
w = 0;
|
| 45 |
+
k_1_0Q15 = {x_U8Q8[7:0],7'b0000000};
|
| 46 |
+
end
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
wire [17:0] k_1_w_3Q15 = {w,k_1_0Q15};
|
| 51 |
+
reg [17:0] k_1_w_3Q15_reg1;
|
| 52 |
+
always@(posedge clk)begin
|
| 53 |
+
k_1_w_3Q15_reg1<=k_1_w_3Q15;
|
| 54 |
+
end
|
| 55 |
+
wire [21:0] P_3Q19;
|
| 56 |
+
reg [21:0] P_3Q19_reg1;
|
| 57 |
+
assign P_3Q19 = k_1_w_3Q15_reg1 * 4'b1011;
|
| 58 |
+
always@(posedge clk)begin
|
| 59 |
+
P_3Q19_reg1<=P_3Q19;
|
| 60 |
+
end
|
| 61 |
+
assign y_U3Q10 = P_3Q19_reg1[21:9];
|
| 62 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax.v
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module Softmax(
|
| 4 |
+
input clk,
|
| 5 |
+
input rst_n,
|
| 6 |
+
|
| 7 |
+
input [9:0] length_input,
|
| 8 |
+
input [10:0] lengthX2,
|
| 9 |
+
input [11:0] lengthX3,
|
| 10 |
+
input signed [4:0] scale_in,//scale_in and scale_out must be kept during the valid_in, min =-1, max =10
|
| 11 |
+
input [3:0] scale_out,//min = 7,max = 14
|
| 12 |
+
input signed [7:0] data_in,
|
| 13 |
+
input valid_in,
|
| 14 |
+
|
| 15 |
+
output reg [7:0] data_out,
|
| 16 |
+
// output reg [15:0] data_out,
|
| 17 |
+
output valid_out,
|
| 18 |
+
output out_last
|
| 19 |
+
);
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
(*MAX_FANOUT = 25 *) reg [9:0] length;
|
| 23 |
+
reg valid_in_delay1;
|
| 24 |
+
reg valid_in_delay2;
|
| 25 |
+
reg valid_in_delay3;
|
| 26 |
+
reg valid_in_delay4;
|
| 27 |
+
reg valid_in_delay5;
|
| 28 |
+
reg valid_in_delay6;
|
| 29 |
+
reg valid_in_delay7;
|
| 30 |
+
reg valid_in_delay8;
|
| 31 |
+
reg valid_in_delay9;
|
| 32 |
+
reg valid_in_delay10;
|
| 33 |
+
reg [15:0] cnt;
|
| 34 |
+
reg signed [7:0] data_in_max;
|
| 35 |
+
reg signed [19:0] x_max_S9Q10;
|
| 36 |
+
reg signed [19:0] x_max_S9Q10_delay1;
|
| 37 |
+
reg signed [19:0] x_max_S9Q10_delay2;
|
| 38 |
+
reg signed [19:0] x_max_S9Q10_delay3;
|
| 39 |
+
reg signed [19:0] x_max_S9Q10_delay4;
|
| 40 |
+
reg signed [19:0] x_max_S9Q10_delay5;
|
| 41 |
+
reg signed [19:0] x_max_S9Q10_delay6;
|
| 42 |
+
reg [19:0] e_sum_U8Q12;
|
| 43 |
+
reg [1:0] stage_delay1;
|
| 44 |
+
reg [1:0] stage_delay2;
|
| 45 |
+
reg [1:0] stage_delay3;
|
| 46 |
+
reg [1:0] stage_delay4;
|
| 47 |
+
reg [1:0] stage_delay5;
|
| 48 |
+
reg [1:0] stage_delay6;
|
| 49 |
+
reg [1:0] stage_delay7;
|
| 50 |
+
reg [1:0] stage_delay8;
|
| 51 |
+
reg [1:0] stage_delay9;
|
| 52 |
+
reg [1:0] stage_delay10;
|
| 53 |
+
reg [3:0] scale_out_delay1;
|
| 54 |
+
reg [3:0] scale_out_delay2;
|
| 55 |
+
reg [3:0] scale_out_delay3;
|
| 56 |
+
reg [3:0] scale_out_delay4;
|
| 57 |
+
reg [3:0] scale_out_delay5;
|
| 58 |
+
reg [3:0] scale_out_delay6;
|
| 59 |
+
reg [3:0] scale_out_delay7;
|
| 60 |
+
reg [3:0] scale_out_delay8;
|
| 61 |
+
reg [3:0] scale_out_delay9;
|
| 62 |
+
reg [7:0] exp_out;
|
| 63 |
+
// reg [15:0] exp_out;
|
| 64 |
+
|
| 65 |
+
wire [1:0] stage;// 1:first input, 2:second input, 3:third input
|
| 66 |
+
wire signed [8:0] x_max_9b;
|
| 67 |
+
wire [11:0] exp_U0Q12;
|
| 68 |
+
wire [13:0] exp_U0Q14_out;
|
| 69 |
+
wire [15:0] e_sum_U8Q8;
|
| 70 |
+
wire [15:0] e_sum_U8Q8_temp;
|
| 71 |
+
wire [12:0] ln_U3Q10;
|
| 72 |
+
wire signed [20:0] x_max_ln_S10Q10;
|
| 73 |
+
wire signed [19:0] x_max_ln_S9Q10;
|
| 74 |
+
|
| 75 |
+
assign x_max_ln_S10Q10 = x_max_S9Q10_delay6-$signed({7'b000_0000,ln_U3Q10});
|
| 76 |
+
assign x_max_ln_S9Q10 = x_max_ln_S10Q10[20] == 0 ? 0:(x_max_ln_S10Q10 < -524288) ? 20'b1000_0000_0000_0000_0000:x_max_ln_S10Q10;
|
| 77 |
+
//assign stage = cnt<=(length -1) ? 1 : (length- 1<cnt && cnt <=length*2-1 ? 2 : 3);
|
| 78 |
+
assign stage = cnt<=(length -1) ? 1 : (length- 1<cnt && cnt <=lengthX2-1 ? 2 : 3);
|
| 79 |
+
assign x_max_9b = data_in-data_in_max;
|
| 80 |
+
assign e_sum_U8Q8_temp = e_sum_U8Q12[19:4] + (e_sum_U8Q12[3]?1:0);
|
| 81 |
+
assign e_sum_U8Q8 = e_sum_U8Q8_temp> 256 ? e_sum_U8Q8_temp: 256;
|
| 82 |
+
assign valid_out = (stage_delay10==3 & valid_in_delay10)?1:0;
|
| 83 |
+
assign out_last = (stage_delay10 == 3) & (stage_delay9==1);
|
| 84 |
+
|
| 85 |
+
always @(*) begin
|
| 86 |
+
case(scale_out_delay9)
|
| 87 |
+
14:begin exp_out = (|exp_U0Q14_out[13:7]) ? 8'b0111_1111 : {1'b0,exp_U0Q14_out[6:0]}; end
|
| 88 |
+
|
| 89 |
+
13:begin exp_out = (|exp_U0Q14_out[13:8]) ? 8'b0111_1111 : {1'b0,exp_U0Q14_out[7:1]}; end
|
| 90 |
+
|
| 91 |
+
12:begin exp_out = (|exp_U0Q14_out[13:9]) ? 8'b0111_1111 : {1'b0,exp_U0Q14_out[8:2]}; end
|
| 92 |
+
|
| 93 |
+
11:begin exp_out = (|exp_U0Q14_out[13:10]) ? 8'b0111_1111 : {1'b0,exp_U0Q14_out[9:3]};end
|
| 94 |
+
|
| 95 |
+
10:begin exp_out = (|exp_U0Q14_out[13:11]) ? 8'b0111_1111 : {1'b0,exp_U0Q14_out[10:4]};end
|
| 96 |
+
|
| 97 |
+
9:begin exp_out = (|exp_U0Q14_out[13:12]) ? 8'b0111_1111 : {1'b0, exp_U0Q14_out[11:5]};end
|
| 98 |
+
|
| 99 |
+
8:begin exp_out = (exp_U0Q14_out[13]) ? 8'b0111_1111 : {1'b0, exp_U0Q14_out[12:6]};end
|
| 100 |
+
|
| 101 |
+
7:begin exp_out = {1'b0, exp_U0Q14_out[13:7]}; end
|
| 102 |
+
|
| 103 |
+
default: begin exp_out = {1'b0, exp_U0Q14_out[13:7]}; end
|
| 104 |
+
endcase
|
| 105 |
+
end
|
| 106 |
+
|
| 107 |
+
always@(posedge clk)begin
|
| 108 |
+
data_out<=exp_out;
|
| 109 |
+
end
|
| 110 |
+
|
| 111 |
+
always @(posedge clk ) begin
|
| 112 |
+
length <= length_input;
|
| 113 |
+
end
|
| 114 |
+
|
| 115 |
+
always@(posedge clk)begin
|
| 116 |
+
stage_delay1<=stage;
|
| 117 |
+
stage_delay2<=stage_delay1;
|
| 118 |
+
stage_delay3<=stage_delay2;
|
| 119 |
+
stage_delay4<=stage_delay3;
|
| 120 |
+
stage_delay5<=stage_delay4;
|
| 121 |
+
stage_delay6<=stage_delay5;
|
| 122 |
+
stage_delay7<=stage_delay6;
|
| 123 |
+
stage_delay8<=stage_delay7;
|
| 124 |
+
stage_delay9<=stage_delay8;
|
| 125 |
+
stage_delay10<=stage_delay9;
|
| 126 |
+
end
|
| 127 |
+
|
| 128 |
+
always@(posedge clk)begin
|
| 129 |
+
scale_out_delay1<=scale_out;
|
| 130 |
+
scale_out_delay2<=scale_out_delay1;
|
| 131 |
+
scale_out_delay3<=scale_out_delay2;
|
| 132 |
+
scale_out_delay4<=scale_out_delay3;
|
| 133 |
+
scale_out_delay5<=scale_out_delay4;
|
| 134 |
+
scale_out_delay6<=scale_out_delay5;
|
| 135 |
+
scale_out_delay7<=scale_out_delay6;
|
| 136 |
+
scale_out_delay8<=scale_out_delay7;
|
| 137 |
+
scale_out_delay9<=scale_out_delay8;
|
| 138 |
+
end
|
| 139 |
+
|
| 140 |
+
always@(posedge clk)begin
|
| 141 |
+
valid_in_delay1<=valid_in;
|
| 142 |
+
valid_in_delay2<=valid_in_delay1;
|
| 143 |
+
valid_in_delay3<=valid_in_delay2;
|
| 144 |
+
valid_in_delay4<=valid_in_delay3;
|
| 145 |
+
valid_in_delay5<=valid_in_delay4;
|
| 146 |
+
valid_in_delay6<=valid_in_delay5;
|
| 147 |
+
valid_in_delay7<=valid_in_delay6;
|
| 148 |
+
valid_in_delay8<=valid_in_delay7;
|
| 149 |
+
valid_in_delay9<=valid_in_delay8;
|
| 150 |
+
valid_in_delay10<=valid_in_delay9;
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
initial begin cnt=0; end
|
| 154 |
+
always@(posedge clk or negedge rst_n)begin
|
| 155 |
+
if (~rst_n)
|
| 156 |
+
cnt<=0;
|
| 157 |
+
else begin
|
| 158 |
+
if(cnt==0&valid_in)
|
| 159 |
+
cnt<=1;
|
| 160 |
+
else if(cnt==0)
|
| 161 |
+
cnt<=cnt;
|
| 162 |
+
else if(cnt==lengthX3-1)
|
| 163 |
+
cnt<=0;
|
| 164 |
+
else if(valid_in)
|
| 165 |
+
cnt<=cnt+1;
|
| 166 |
+
else
|
| 167 |
+
cnt<=cnt;
|
| 168 |
+
end
|
| 169 |
+
end
|
| 170 |
+
|
| 171 |
+
// initial begin data_in_max=8'b11111111;end
|
| 172 |
+
always@(posedge clk or negedge rst_n)begin
|
| 173 |
+
if(~rst_n)
|
| 174 |
+
data_in_max<=8'b11111111;
|
| 175 |
+
else if(cnt==lengthX3-1)
|
| 176 |
+
data_in_max<=8'b11111111;
|
| 177 |
+
else if(valid_in&stage==1)
|
| 178 |
+
data_in_max<=(data_in_max>data_in)?data_in_max:data_in;
|
| 179 |
+
end
|
| 180 |
+
|
| 181 |
+
always @(*) begin
|
| 182 |
+
if (scale_in == -1)
|
| 183 |
+
x_max_S9Q10 = $signed(x_max_9b) <<< 11;
|
| 184 |
+
else if (scale_in < 10) begin
|
| 185 |
+
x_max_S9Q10 = $signed(x_max_9b) <<< (5'd10- scale_in[3:0]);
|
| 186 |
+
end
|
| 187 |
+
else begin // in_scale == 10
|
| 188 |
+
x_max_S9Q10 = x_max_9b;
|
| 189 |
+
end
|
| 190 |
+
end
|
| 191 |
+
|
| 192 |
+
always@(posedge clk)begin
|
| 193 |
+
x_max_S9Q10_delay1<=x_max_S9Q10;
|
| 194 |
+
x_max_S9Q10_delay2<=x_max_S9Q10_delay1;
|
| 195 |
+
x_max_S9Q10_delay3<=x_max_S9Q10_delay2;
|
| 196 |
+
x_max_S9Q10_delay4<=x_max_S9Q10_delay3;
|
| 197 |
+
x_max_S9Q10_delay5<=x_max_S9Q10_delay4;
|
| 198 |
+
x_max_S9Q10_delay6<=x_max_S9Q10_delay5;
|
| 199 |
+
end
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
always@(posedge clk or negedge rst_n)begin
|
| 203 |
+
if(~rst_n)
|
| 204 |
+
e_sum_U8Q12<=0;
|
| 205 |
+
else if(stage_delay4==2 & valid_in_delay4)
|
| 206 |
+
e_sum_U8Q12<=exp_U0Q12+e_sum_U8Q12;
|
| 207 |
+
else if(stage_delay4==1)
|
| 208 |
+
e_sum_U8Q12<=0;
|
| 209 |
+
end
|
| 210 |
+
|
| 211 |
+
wire [24:0] exp_U0Q25;
|
| 212 |
+
assign exp_U0Q12 = exp_U0Q25[24:13];
|
| 213 |
+
|
| 214 |
+
Exp_module u_Exp_module_1(
|
| 215 |
+
.clk(clk),
|
| 216 |
+
.x_S9Q10(x_max_S9Q10_delay1),
|
| 217 |
+
.y_U0Q25_reg1(exp_U0Q25)
|
| 218 |
+
);
|
| 219 |
+
|
| 220 |
+
Ln_module u_Ln_module(//latency=2
|
| 221 |
+
.clk(clk),
|
| 222 |
+
.x_U8Q8(e_sum_U8Q8),
|
| 223 |
+
.y_U3Q10(ln_U3Q10)
|
| 224 |
+
);
|
| 225 |
+
|
| 226 |
+
wire [24:0] exp_U0Q25_out;
|
| 227 |
+
assign exp_U0Q14_out = exp_U0Q25_out[24:11];
|
| 228 |
+
|
| 229 |
+
Exp_module u_Exp_module_2(
|
| 230 |
+
.clk(clk),
|
| 231 |
+
.x_S9Q10(x_max_ln_S9Q10),
|
| 232 |
+
.y_U0Q25_reg1(exp_U0Q25_out)
|
| 233 |
+
);
|
| 234 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_control.v
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
module Softmax_control(
|
| 5 |
+
input clk,
|
| 6 |
+
input rst_n,
|
| 7 |
+
|
| 8 |
+
input [9:0] length_input,
|
| 9 |
+
input signed [4:0] scale_in_input,
|
| 10 |
+
input [3:0] scale_out_input,
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
input signed [7:0] top_data_in,
|
| 14 |
+
input top_valid_in,
|
| 15 |
+
output top_ready_in,
|
| 16 |
+
input top_last_in,
|
| 17 |
+
|
| 18 |
+
output [7:0] top_data_out,
|
| 19 |
+
output top_valid_out,
|
| 20 |
+
output top_last_out
|
| 21 |
+
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
reg [9:0] length;
|
| 25 |
+
reg [11:0] lengthX3;
|
| 26 |
+
reg [10:0] lengthX2;
|
| 27 |
+
reg signed [4:0] scale_in;
|
| 28 |
+
reg [3:0] scale_out;
|
| 29 |
+
reg [15:0] cnt_in;
|
| 30 |
+
reg [15:0] cnt_stage;
|
| 31 |
+
reg Softmax_valid_in;
|
| 32 |
+
reg Softmax_valid_in_delay1;
|
| 33 |
+
reg top_valid_in_delay1;
|
| 34 |
+
reg [9:0] out_addr;
|
| 35 |
+
reg top_last_in_reg;
|
| 36 |
+
reg top_ready_in_delay1;
|
| 37 |
+
reg [7:0] Softmax_data_in_delay1;
|
| 38 |
+
reg signed [7:0] in_data_buffer [1023:0];
|
| 39 |
+
|
| 40 |
+
wire valid_input_flag;
|
| 41 |
+
//wire [7:0] Softmax_data_in;
|
| 42 |
+
wire [7:0] Softmax_data_out;
|
| 43 |
+
wire buffer_wen;
|
| 44 |
+
wire Softmax_valid_out;
|
| 45 |
+
wire [9:0] in_addr;
|
| 46 |
+
wire Softmax_out_last;
|
| 47 |
+
wire length1_flag;
|
| 48 |
+
wire length2_flag;
|
| 49 |
+
wire length3_flag;
|
| 50 |
+
|
| 51 |
+
assign length1_flag = cnt_stage<=length;
|
| 52 |
+
assign length2_flag = cnt_stage<=lengthX2;
|
| 53 |
+
assign length3_flag = cnt_stage<=lengthX3;
|
| 54 |
+
assign in_addr = (cnt_in < length)? cnt_in:0;
|
| 55 |
+
assign valid_input_flag = top_valid_in&top_ready_in;
|
| 56 |
+
assign buffer_wen = top_valid_in&top_ready_in;
|
| 57 |
+
assign top_data_out = Softmax_data_out;
|
| 58 |
+
assign top_valid_out = Softmax_valid_out;
|
| 59 |
+
assign top_last_out = Softmax_out_last & top_last_in_reg;
|
| 60 |
+
assign top_ready_in = cnt_in < length;
|
| 61 |
+
//assign Softmax_data_in = in_data_buffer[out_addr];
|
| 62 |
+
|
| 63 |
+
always @(posedge clk ) begin
|
| 64 |
+
// Softmax_data_in_delay1<=Softmax_data_in;
|
| 65 |
+
Softmax_data_in_delay1<=in_data_buffer[out_addr]; //block mem
|
| 66 |
+
end
|
| 67 |
+
|
| 68 |
+
always @(posedge clk ) begin
|
| 69 |
+
Softmax_valid_in_delay1<=Softmax_valid_in;
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
always@(posedge clk or negedge rst_n)begin
|
| 73 |
+
if(~rst_n)
|
| 74 |
+
top_last_in_reg<=0;
|
| 75 |
+
else if (top_last_in)
|
| 76 |
+
top_last_in_reg<=1;
|
| 77 |
+
else if (top_last_out)
|
| 78 |
+
top_last_in_reg<=0;
|
| 79 |
+
else
|
| 80 |
+
top_last_in_reg<=top_last_in_reg;
|
| 81 |
+
end
|
| 82 |
+
|
| 83 |
+
always@(posedge clk)begin
|
| 84 |
+
top_ready_in_delay1<=top_ready_in;
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
always@(posedge clk or negedge rst_n)begin
|
| 88 |
+
if(~rst_n)
|
| 89 |
+
cnt_in <= 0;
|
| 90 |
+
else if(cnt_stage == lengthX3)//(cnt_stage == length * 3)
|
| 91 |
+
cnt_in <= 0;
|
| 92 |
+
else if(valid_input_flag)
|
| 93 |
+
cnt_in <= cnt_in + 1;
|
| 94 |
+
else
|
| 95 |
+
cnt_in <= cnt_in;
|
| 96 |
+
end
|
| 97 |
+
|
| 98 |
+
always@(posedge clk or negedge rst_n)begin
|
| 99 |
+
if(~rst_n)
|
| 100 |
+
cnt_stage<=0;
|
| 101 |
+
else if (cnt_stage == lengthX3)//(cnt_stage == length * 3)
|
| 102 |
+
cnt_stage <= 0;
|
| 103 |
+
else if (cnt_stage < length & valid_input_flag)
|
| 104 |
+
cnt_stage<=cnt_stage+1;
|
| 105 |
+
else if (cnt_stage >= length)
|
| 106 |
+
cnt_stage<=cnt_stage+1;
|
| 107 |
+
else
|
| 108 |
+
cnt_stage <= cnt_stage;
|
| 109 |
+
end
|
| 110 |
+
|
| 111 |
+
always @(posedge clk ) begin
|
| 112 |
+
length <= length_input;
|
| 113 |
+
scale_in <= scale_in_input;
|
| 114 |
+
scale_out <= scale_out_input;
|
| 115 |
+
end
|
| 116 |
+
|
| 117 |
+
always @(posedge clk ) begin
|
| 118 |
+
lengthX3<=length * 3;
|
| 119 |
+
end
|
| 120 |
+
|
| 121 |
+
always @(posedge clk ) begin
|
| 122 |
+
lengthX2<=length * 2;
|
| 123 |
+
end
|
| 124 |
+
|
| 125 |
+
always @(posedge clk or negedge rst_n) begin
|
| 126 |
+
if(~rst_n)
|
| 127 |
+
top_valid_in_delay1<=0;
|
| 128 |
+
else
|
| 129 |
+
top_valid_in_delay1<=top_valid_in;
|
| 130 |
+
end
|
| 131 |
+
|
| 132 |
+
always @(posedge clk) begin
|
| 133 |
+
if(buffer_wen)
|
| 134 |
+
in_data_buffer[in_addr] <= top_data_in;
|
| 135 |
+
end
|
| 136 |
+
|
| 137 |
+
// always @(*)begin
|
| 138 |
+
// if(cnt_stage<=length)
|
| 139 |
+
// Softmax_valid_in = top_valid_in_delay1;
|
| 140 |
+
// else if(cnt_stage >length | cnt_stage<=lengthX3)//cnt_stage <= length*3)
|
| 141 |
+
// Softmax_valid_in = 1;
|
| 142 |
+
// else
|
| 143 |
+
// Softmax_valid_in = 0;
|
| 144 |
+
// end
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
always @(*)begin
|
| 150 |
+
case({ length1_flag, length3_flag})
|
| 151 |
+
2'b11: Softmax_valid_in = top_valid_in_delay1 & top_ready_in_delay1;
|
| 152 |
+
2'b01: Softmax_valid_in = 1;
|
| 153 |
+
default: Softmax_valid_in=0;
|
| 154 |
+
endcase
|
| 155 |
+
end
|
| 156 |
+
|
| 157 |
+
// always @(*)begin
|
| 158 |
+
// if(cnt_stage>0&cnt_stage<=length)
|
| 159 |
+
// out_addr = cnt_stage -1;
|
| 160 |
+
// else if (cnt_stage>length & cnt_stage<=lengthX2)//2*length)
|
| 161 |
+
// out_addr = cnt_stage - 1 - length;
|
| 162 |
+
// else if (cnt_stage>2*length & cnt_stage <=lengthX3)//<= 3*length)
|
| 163 |
+
// out_addr = cnt_stage - 1 - lengthX2;//2*length;
|
| 164 |
+
// else
|
| 165 |
+
// out_addr = 0;
|
| 166 |
+
// end
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
always @(*) begin
|
| 170 |
+
case({(cnt_stage>0),length1_flag,length2_flag,length3_flag})
|
| 171 |
+
4'b1111: out_addr = cnt_stage -1;
|
| 172 |
+
4'b1011: out_addr = cnt_stage - 1 - length;
|
| 173 |
+
4'b1001: out_addr = cnt_stage - 1 - lengthX2;
|
| 174 |
+
default:out_addr = 0;
|
| 175 |
+
endcase
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
Softmax u_Softmax(
|
| 180 |
+
.clk(clk),
|
| 181 |
+
.rst_n(rst_n),
|
| 182 |
+
.length_input(length_input),
|
| 183 |
+
.lengthX2(lengthX2),
|
| 184 |
+
.lengthX3(lengthX3),
|
| 185 |
+
.scale_in(scale_in),//scale_in and scale_out must be kept during the valid_in, min =-1, max =10
|
| 186 |
+
.scale_out(scale_out),//min = 7,max = 14
|
| 187 |
+
.data_in(Softmax_data_in_delay1),
|
| 188 |
+
.valid_in(Softmax_valid_in_delay1),
|
| 189 |
+
|
| 190 |
+
.data_out(Softmax_data_out),
|
| 191 |
+
.valid_out(Softmax_valid_out),
|
| 192 |
+
.out_last(Softmax_out_last)
|
| 193 |
+
);
|
| 194 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_top.v
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`timescale 1 ns / 1 ps
|
| 3 |
+
|
| 4 |
+
module Softmax_top #
|
| 5 |
+
(
|
| 6 |
+
// Users to add parameters here
|
| 7 |
+
|
| 8 |
+
// User parameters ends
|
| 9 |
+
// Do not modify the parameters beyond this line
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
// Parameters of Axi Slave Bus Interface S00_AXI
|
| 13 |
+
localparam integer C_S00_AXI_DATA_WIDTH = 32,
|
| 14 |
+
localparam integer C_S00_AXI_ADDR_WIDTH = 4
|
| 15 |
+
)
|
| 16 |
+
(
|
| 17 |
+
// Users to add ports here
|
| 18 |
+
input axis_aclk,
|
| 19 |
+
input aresetn,
|
| 20 |
+
|
| 21 |
+
input [7:0] s_axis_tdata,
|
| 22 |
+
input s_axis_tvalid,
|
| 23 |
+
output s_axis_tready,
|
| 24 |
+
input s_axis_tlast,
|
| 25 |
+
|
| 26 |
+
output [7:0] m_axis_tdata,
|
| 27 |
+
output m_axis_tvalid,
|
| 28 |
+
input m_axis_tready,
|
| 29 |
+
output m_axis_tlast,
|
| 30 |
+
// User ports ends
|
| 31 |
+
// Do not modify the ports beyond this line
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
// Ports of Axi Slave Bus Interface S00_AXI
|
| 35 |
+
input wire s00_axi_aclk,
|
| 36 |
+
input wire s00_axi_aresetn,
|
| 37 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_awaddr,
|
| 38 |
+
input wire [2 : 0] s00_axi_awprot,
|
| 39 |
+
input wire s00_axi_awvalid,
|
| 40 |
+
output wire s00_axi_awready,
|
| 41 |
+
input wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_wdata,
|
| 42 |
+
input wire [(C_S00_AXI_DATA_WIDTH/8)-1 : 0] s00_axi_wstrb,
|
| 43 |
+
input wire s00_axi_wvalid,
|
| 44 |
+
output wire s00_axi_wready,
|
| 45 |
+
output wire [1 : 0] s00_axi_bresp,
|
| 46 |
+
output wire s00_axi_bvalid,
|
| 47 |
+
input wire s00_axi_bready,
|
| 48 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_araddr,
|
| 49 |
+
input wire [2 : 0] s00_axi_arprot,
|
| 50 |
+
input wire s00_axi_arvalid,
|
| 51 |
+
output wire s00_axi_arready,
|
| 52 |
+
output wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_rdata,
|
| 53 |
+
output wire [1 : 0] s00_axi_rresp,
|
| 54 |
+
output wire s00_axi_rvalid,
|
| 55 |
+
input wire s00_axi_rready
|
| 56 |
+
);
|
| 57 |
+
// Instantiation of Axi Bus Interface S00_AXI
|
| 58 |
+
Softmax_top_axi # (
|
| 59 |
+
.C_S_AXI_DATA_WIDTH(C_S00_AXI_DATA_WIDTH),
|
| 60 |
+
.C_S_AXI_ADDR_WIDTH(C_S00_AXI_ADDR_WIDTH)
|
| 61 |
+
) u_Softmax_top_axi (
|
| 62 |
+
.axis_aclk(axis_aclk),
|
| 63 |
+
.aresetn(aresetn),
|
| 64 |
+
|
| 65 |
+
.s_axis_tdata(s_axis_tdata),
|
| 66 |
+
.s_axis_tvalid(s_axis_tvalid),
|
| 67 |
+
.s_axis_tready(s_axis_tready),
|
| 68 |
+
.s_axis_tlast(s_axis_tlast),
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
.m_axis_tdata(m_axis_tdata),
|
| 72 |
+
.m_axis_tvalid(m_axis_tvalid),
|
| 73 |
+
.m_axis_tready(m_axis_tready),
|
| 74 |
+
.m_axis_tlast(m_axis_tlast),
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
.S_AXI_ACLK(s00_axi_aclk),
|
| 78 |
+
.S_AXI_ARESETN(s00_axi_aresetn),
|
| 79 |
+
.S_AXI_AWADDR(s00_axi_awaddr),
|
| 80 |
+
.S_AXI_AWPROT(s00_axi_awprot),
|
| 81 |
+
.S_AXI_AWVALID(s00_axi_awvalid),
|
| 82 |
+
.S_AXI_AWREADY(s00_axi_awready),
|
| 83 |
+
.S_AXI_WDATA(s00_axi_wdata),
|
| 84 |
+
.S_AXI_WSTRB(s00_axi_wstrb),
|
| 85 |
+
.S_AXI_WVALID(s00_axi_wvalid),
|
| 86 |
+
.S_AXI_WREADY(s00_axi_wready),
|
| 87 |
+
.S_AXI_BRESP(s00_axi_bresp),
|
| 88 |
+
.S_AXI_BVALID(s00_axi_bvalid),
|
| 89 |
+
.S_AXI_BREADY(s00_axi_bready),
|
| 90 |
+
.S_AXI_ARADDR(s00_axi_araddr),
|
| 91 |
+
.S_AXI_ARPROT(s00_axi_arprot),
|
| 92 |
+
.S_AXI_ARVALID(s00_axi_arvalid),
|
| 93 |
+
.S_AXI_ARREADY(s00_axi_arready),
|
| 94 |
+
.S_AXI_RDATA(s00_axi_rdata),
|
| 95 |
+
.S_AXI_RRESP(s00_axi_rresp),
|
| 96 |
+
.S_AXI_RVALID(s00_axi_rvalid),
|
| 97 |
+
.S_AXI_RREADY(s00_axi_rready)
|
| 98 |
+
);
|
| 99 |
+
|
| 100 |
+
// Add user logic here
|
| 101 |
+
|
| 102 |
+
// User logic ends
|
| 103 |
+
|
| 104 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/Softmax_top_axi.v
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`timescale 1 ns / 1 ps
|
| 3 |
+
|
| 4 |
+
module Softmax_top_axi #
|
| 5 |
+
(
|
| 6 |
+
// Users to add parameters here
|
| 7 |
+
|
| 8 |
+
// User parameters ends
|
| 9 |
+
// Do not modify the parameters beyond this line
|
| 10 |
+
|
| 11 |
+
// Width of S_AXI data bus
|
| 12 |
+
parameter integer C_S_AXI_DATA_WIDTH = 32,
|
| 13 |
+
// Width of S_AXI address bus
|
| 14 |
+
parameter integer C_S_AXI_ADDR_WIDTH = 4
|
| 15 |
+
)
|
| 16 |
+
(
|
| 17 |
+
// Users to add ports here
|
| 18 |
+
input axis_aclk,
|
| 19 |
+
input aresetn,
|
| 20 |
+
|
| 21 |
+
input [7:0] s_axis_tdata,
|
| 22 |
+
input s_axis_tvalid,
|
| 23 |
+
output s_axis_tready,
|
| 24 |
+
input s_axis_tlast,
|
| 25 |
+
|
| 26 |
+
output [7:0] m_axis_tdata,
|
| 27 |
+
output m_axis_tvalid,
|
| 28 |
+
input m_axis_tready,
|
| 29 |
+
output m_axis_tlast,
|
| 30 |
+
|
| 31 |
+
// User ports ends
|
| 32 |
+
// Do not modify the ports beyond this line
|
| 33 |
+
|
| 34 |
+
// Global Clock Signal
|
| 35 |
+
input wire S_AXI_ACLK,
|
| 36 |
+
// Global Reset Signal. This Signal is Active LOW
|
| 37 |
+
input wire S_AXI_ARESETN,
|
| 38 |
+
// Write address (issued by master, acceped by Slave)
|
| 39 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_AWADDR,
|
| 40 |
+
// Write channel Protection type. This signal indicates the
|
| 41 |
+
// privilege and security level of the transaction, and whether
|
| 42 |
+
// the transaction is a data access or an instruction access.
|
| 43 |
+
input wire [2 : 0] S_AXI_AWPROT,
|
| 44 |
+
// Write address valid. This signal indicates that the master signaling
|
| 45 |
+
// valid write address and control information.
|
| 46 |
+
input wire S_AXI_AWVALID,
|
| 47 |
+
// Write address ready. This signal indicates that the slave is ready
|
| 48 |
+
// to accept an address and associated control signals.
|
| 49 |
+
output wire S_AXI_AWREADY,
|
| 50 |
+
// Write data (issued by master, acceped by Slave)
|
| 51 |
+
input wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_WDATA,
|
| 52 |
+
// Write strobes. This signal indicates which byte lanes hold
|
| 53 |
+
// valid data. There is one write strobe bit for each eight
|
| 54 |
+
// bits of the write data bus.
|
| 55 |
+
input wire [(C_S_AXI_DATA_WIDTH/8)-1 : 0] S_AXI_WSTRB,
|
| 56 |
+
// Write valid. This signal indicates that valid write
|
| 57 |
+
// data and strobes are available.
|
| 58 |
+
input wire S_AXI_WVALID,
|
| 59 |
+
// Write ready. This signal indicates that the slave
|
| 60 |
+
// can accept the write data.
|
| 61 |
+
output wire S_AXI_WREADY,
|
| 62 |
+
// Write response. This signal indicates the status
|
| 63 |
+
// of the write transaction.
|
| 64 |
+
output wire [1 : 0] S_AXI_BRESP,
|
| 65 |
+
// Write response valid. This signal indicates that the channel
|
| 66 |
+
// is signaling a valid write response.
|
| 67 |
+
output wire S_AXI_BVALID,
|
| 68 |
+
// Response ready. This signal indicates that the master
|
| 69 |
+
// can accept a write response.
|
| 70 |
+
input wire S_AXI_BREADY,
|
| 71 |
+
// Read address (issued by master, acceped by Slave)
|
| 72 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_ARADDR,
|
| 73 |
+
// Protection type. This signal indicates the privilege
|
| 74 |
+
// and security level of the transaction, and whether the
|
| 75 |
+
// transaction is a data access or an instruction access.
|
| 76 |
+
input wire [2 : 0] S_AXI_ARPROT,
|
| 77 |
+
// Read address valid. This signal indicates that the channel
|
| 78 |
+
// is signaling valid read address and control information.
|
| 79 |
+
input wire S_AXI_ARVALID,
|
| 80 |
+
// Read address ready. This signal indicates that the slave is
|
| 81 |
+
// ready to accept an address and associated control signals.
|
| 82 |
+
output wire S_AXI_ARREADY,
|
| 83 |
+
// Read data (issued by slave)
|
| 84 |
+
output wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_RDATA,
|
| 85 |
+
// Read response. This signal indicates the status of the
|
| 86 |
+
// read transfer.
|
| 87 |
+
output wire [1 : 0] S_AXI_RRESP,
|
| 88 |
+
// Read valid. This signal indicates that the channel is
|
| 89 |
+
// signaling the required read data.
|
| 90 |
+
output wire S_AXI_RVALID,
|
| 91 |
+
// Read ready. This signal indicates that the master can
|
| 92 |
+
// accept the read data and response information.
|
| 93 |
+
input wire S_AXI_RREADY
|
| 94 |
+
);
|
| 95 |
+
|
| 96 |
+
// AXI4LITE signals
|
| 97 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_awaddr;
|
| 98 |
+
reg axi_awready;
|
| 99 |
+
reg axi_wready;
|
| 100 |
+
reg [1 : 0] axi_bresp;
|
| 101 |
+
reg axi_bvalid;
|
| 102 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_araddr;
|
| 103 |
+
reg axi_arready;
|
| 104 |
+
reg [C_S_AXI_DATA_WIDTH-1 : 0] axi_rdata;
|
| 105 |
+
reg [1 : 0] axi_rresp;
|
| 106 |
+
reg axi_rvalid;
|
| 107 |
+
|
| 108 |
+
// Example-specific design signals
|
| 109 |
+
// local parameter for addressing 32 bit / 64 bit C_S_AXI_DATA_WIDTH
|
| 110 |
+
// ADDR_LSB is used for addressing 32/64 bit registers/memories
|
| 111 |
+
// ADDR_LSB = 2 for 32 bits (n downto 2)
|
| 112 |
+
// ADDR_LSB = 3 for 64 bits (n downto 3)
|
| 113 |
+
localparam integer ADDR_LSB = (C_S_AXI_DATA_WIDTH/32) + 1;
|
| 114 |
+
localparam integer OPT_MEM_ADDR_BITS = 1;
|
| 115 |
+
//----------------------------------------------
|
| 116 |
+
//-- Signals for user logic register space example
|
| 117 |
+
//------------------------------------------------
|
| 118 |
+
//-- Number of Slave Registers 4
|
| 119 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg0;
|
| 120 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg1;
|
| 121 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg2;
|
| 122 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg3;
|
| 123 |
+
wire slv_reg_rden;
|
| 124 |
+
wire slv_reg_wren;
|
| 125 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] reg_data_out;
|
| 126 |
+
integer byte_index;
|
| 127 |
+
reg aw_en;
|
| 128 |
+
|
| 129 |
+
// I/O Connections assignments
|
| 130 |
+
|
| 131 |
+
assign S_AXI_AWREADY = axi_awready;
|
| 132 |
+
assign S_AXI_WREADY = axi_wready;
|
| 133 |
+
assign S_AXI_BRESP = axi_bresp;
|
| 134 |
+
assign S_AXI_BVALID = axi_bvalid;
|
| 135 |
+
assign S_AXI_ARREADY = axi_arready;
|
| 136 |
+
assign S_AXI_RDATA = axi_rdata;
|
| 137 |
+
assign S_AXI_RRESP = axi_rresp;
|
| 138 |
+
assign S_AXI_RVALID = axi_rvalid;
|
| 139 |
+
// Implement axi_awready generation
|
| 140 |
+
// axi_awready is asserted for one S_AXI_ACLK clock cycle when both
|
| 141 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_awready is
|
| 142 |
+
// de-asserted when reset is low.
|
| 143 |
+
|
| 144 |
+
always @( posedge S_AXI_ACLK )
|
| 145 |
+
begin
|
| 146 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 147 |
+
begin
|
| 148 |
+
axi_awready <= 1'b0;
|
| 149 |
+
aw_en <= 1'b1;
|
| 150 |
+
end
|
| 151 |
+
else
|
| 152 |
+
begin
|
| 153 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 154 |
+
begin
|
| 155 |
+
// slave is ready to accept write address when
|
| 156 |
+
// there is a valid write address and write data
|
| 157 |
+
// on the write address and data bus. This design
|
| 158 |
+
// expects no outstanding transactions.
|
| 159 |
+
axi_awready <= 1'b1;
|
| 160 |
+
aw_en <= 1'b0;
|
| 161 |
+
end
|
| 162 |
+
else if (S_AXI_BREADY && axi_bvalid)
|
| 163 |
+
begin
|
| 164 |
+
aw_en <= 1'b1;
|
| 165 |
+
axi_awready <= 1'b0;
|
| 166 |
+
end
|
| 167 |
+
else
|
| 168 |
+
begin
|
| 169 |
+
axi_awready <= 1'b0;
|
| 170 |
+
end
|
| 171 |
+
end
|
| 172 |
+
end
|
| 173 |
+
|
| 174 |
+
// Implement axi_awaddr latching
|
| 175 |
+
// This process is used to latch the address when both
|
| 176 |
+
// S_AXI_AWVALID and S_AXI_WVALID are valid.
|
| 177 |
+
|
| 178 |
+
always @( posedge S_AXI_ACLK )
|
| 179 |
+
begin
|
| 180 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 181 |
+
begin
|
| 182 |
+
axi_awaddr <= 0;
|
| 183 |
+
end
|
| 184 |
+
else
|
| 185 |
+
begin
|
| 186 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 187 |
+
begin
|
| 188 |
+
// Write Address latching
|
| 189 |
+
axi_awaddr <= S_AXI_AWADDR;
|
| 190 |
+
end
|
| 191 |
+
end
|
| 192 |
+
end
|
| 193 |
+
|
| 194 |
+
// Implement axi_wready generation
|
| 195 |
+
// axi_wready is asserted for one S_AXI_ACLK clock cycle when both
|
| 196 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_wready is
|
| 197 |
+
// de-asserted when reset is low.
|
| 198 |
+
|
| 199 |
+
always @( posedge S_AXI_ACLK )
|
| 200 |
+
begin
|
| 201 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 202 |
+
begin
|
| 203 |
+
axi_wready <= 1'b0;
|
| 204 |
+
end
|
| 205 |
+
else
|
| 206 |
+
begin
|
| 207 |
+
if (~axi_wready && S_AXI_WVALID && S_AXI_AWVALID && aw_en )
|
| 208 |
+
begin
|
| 209 |
+
// slave is ready to accept write data when
|
| 210 |
+
// there is a valid write address and write data
|
| 211 |
+
// on the write address and data bus. This design
|
| 212 |
+
// expects no outstanding transactions.
|
| 213 |
+
axi_wready <= 1'b1;
|
| 214 |
+
end
|
| 215 |
+
else
|
| 216 |
+
begin
|
| 217 |
+
axi_wready <= 1'b0;
|
| 218 |
+
end
|
| 219 |
+
end
|
| 220 |
+
end
|
| 221 |
+
|
| 222 |
+
// Implement memory mapped register select and write logic generation
|
| 223 |
+
// The write data is accepted and written to memory mapped registers when
|
| 224 |
+
// axi_awready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted. Write strobes are used to
|
| 225 |
+
// select byte enables of slave registers while writing.
|
| 226 |
+
// These registers are cleared when reset (active low) is applied.
|
| 227 |
+
// Slave register write enable is asserted when valid address and data are available
|
| 228 |
+
// and the slave is ready to accept the write address and write data.
|
| 229 |
+
assign slv_reg_wren = axi_wready && S_AXI_WVALID && axi_awready && S_AXI_AWVALID;
|
| 230 |
+
|
| 231 |
+
always @( posedge S_AXI_ACLK )
|
| 232 |
+
begin
|
| 233 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 234 |
+
begin
|
| 235 |
+
slv_reg0 <= 0;
|
| 236 |
+
slv_reg1 <= 0;
|
| 237 |
+
slv_reg2 <= 0;
|
| 238 |
+
slv_reg3 <= 0;
|
| 239 |
+
end
|
| 240 |
+
else begin
|
| 241 |
+
if (slv_reg_wren)
|
| 242 |
+
begin
|
| 243 |
+
case ( axi_awaddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 244 |
+
2'h0:
|
| 245 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 246 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 247 |
+
// Respective byte enables are asserted as per write strobes
|
| 248 |
+
// Slave register 0
|
| 249 |
+
slv_reg0[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 250 |
+
end
|
| 251 |
+
2'h1:
|
| 252 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 253 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 254 |
+
// Respective byte enables are asserted as per write strobes
|
| 255 |
+
// Slave register 1
|
| 256 |
+
slv_reg1[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 257 |
+
end
|
| 258 |
+
2'h2:
|
| 259 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 260 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 261 |
+
// Respective byte enables are asserted as per write strobes
|
| 262 |
+
// Slave register 2
|
| 263 |
+
slv_reg2[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 264 |
+
end
|
| 265 |
+
2'h3:
|
| 266 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 267 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 268 |
+
// Respective byte enables are asserted as per write strobes
|
| 269 |
+
// Slave register 3
|
| 270 |
+
slv_reg3[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 271 |
+
end
|
| 272 |
+
default : begin
|
| 273 |
+
slv_reg0 <= slv_reg0;
|
| 274 |
+
slv_reg1 <= slv_reg1;
|
| 275 |
+
slv_reg2 <= slv_reg2;
|
| 276 |
+
slv_reg3 <= slv_reg3;
|
| 277 |
+
end
|
| 278 |
+
endcase
|
| 279 |
+
end
|
| 280 |
+
end
|
| 281 |
+
end
|
| 282 |
+
|
| 283 |
+
// Implement write response logic generation
|
| 284 |
+
// The write response and response valid signals are asserted by the slave
|
| 285 |
+
// when axi_wready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted.
|
| 286 |
+
// This marks the acceptance of address and indicates the status of
|
| 287 |
+
// write transaction.
|
| 288 |
+
|
| 289 |
+
always @( posedge S_AXI_ACLK )
|
| 290 |
+
begin
|
| 291 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 292 |
+
begin
|
| 293 |
+
axi_bvalid <= 0;
|
| 294 |
+
axi_bresp <= 2'b0;
|
| 295 |
+
end
|
| 296 |
+
else
|
| 297 |
+
begin
|
| 298 |
+
if (axi_awready && S_AXI_AWVALID && ~axi_bvalid && axi_wready && S_AXI_WVALID)
|
| 299 |
+
begin
|
| 300 |
+
// indicates a valid write response is available
|
| 301 |
+
axi_bvalid <= 1'b1;
|
| 302 |
+
axi_bresp <= 2'b0; // 'OKAY' response
|
| 303 |
+
end // work error responses in future
|
| 304 |
+
else
|
| 305 |
+
begin
|
| 306 |
+
if (S_AXI_BREADY && axi_bvalid)
|
| 307 |
+
//check if bready is asserted while bvalid is high)
|
| 308 |
+
//(there is a possibility that bready is always asserted high)
|
| 309 |
+
begin
|
| 310 |
+
axi_bvalid <= 1'b0;
|
| 311 |
+
end
|
| 312 |
+
end
|
| 313 |
+
end
|
| 314 |
+
end
|
| 315 |
+
|
| 316 |
+
// Implement axi_arready generation
|
| 317 |
+
// axi_arready is asserted for one S_AXI_ACLK clock cycle when
|
| 318 |
+
// S_AXI_ARVALID is asserted. axi_awready is
|
| 319 |
+
// de-asserted when reset (active low) is asserted.
|
| 320 |
+
// The read address is also latched when S_AXI_ARVALID is
|
| 321 |
+
// asserted. axi_araddr is reset to zero on reset assertion.
|
| 322 |
+
|
| 323 |
+
always @( posedge S_AXI_ACLK )
|
| 324 |
+
begin
|
| 325 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 326 |
+
begin
|
| 327 |
+
axi_arready <= 1'b0;
|
| 328 |
+
axi_araddr <= 32'b0;
|
| 329 |
+
end
|
| 330 |
+
else
|
| 331 |
+
begin
|
| 332 |
+
if (~axi_arready && S_AXI_ARVALID)
|
| 333 |
+
begin
|
| 334 |
+
// indicates that the slave has acceped the valid read address
|
| 335 |
+
axi_arready <= 1'b1;
|
| 336 |
+
// Read address latching
|
| 337 |
+
axi_araddr <= S_AXI_ARADDR;
|
| 338 |
+
end
|
| 339 |
+
else
|
| 340 |
+
begin
|
| 341 |
+
axi_arready <= 1'b0;
|
| 342 |
+
end
|
| 343 |
+
end
|
| 344 |
+
end
|
| 345 |
+
|
| 346 |
+
// Implement axi_arvalid generation
|
| 347 |
+
// axi_rvalid is asserted for one S_AXI_ACLK clock cycle when both
|
| 348 |
+
// S_AXI_ARVALID and axi_arready are asserted. The slave registers
|
| 349 |
+
// data are available on the axi_rdata bus at this instance. The
|
| 350 |
+
// assertion of axi_rvalid marks the validity of read data on the
|
| 351 |
+
// bus and axi_rresp indicates the status of read transaction.axi_rvalid
|
| 352 |
+
// is deasserted on reset (active low). axi_rresp and axi_rdata are
|
| 353 |
+
// cleared to zero on reset (active low).
|
| 354 |
+
always @( posedge S_AXI_ACLK )
|
| 355 |
+
begin
|
| 356 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 357 |
+
begin
|
| 358 |
+
axi_rvalid <= 0;
|
| 359 |
+
axi_rresp <= 0;
|
| 360 |
+
end
|
| 361 |
+
else
|
| 362 |
+
begin
|
| 363 |
+
if (axi_arready && S_AXI_ARVALID && ~axi_rvalid)
|
| 364 |
+
begin
|
| 365 |
+
// Valid read data is available at the read data bus
|
| 366 |
+
axi_rvalid <= 1'b1;
|
| 367 |
+
axi_rresp <= 2'b0; // 'OKAY' response
|
| 368 |
+
end
|
| 369 |
+
else if (axi_rvalid && S_AXI_RREADY)
|
| 370 |
+
begin
|
| 371 |
+
// Read data is accepted by the master
|
| 372 |
+
axi_rvalid <= 1'b0;
|
| 373 |
+
end
|
| 374 |
+
end
|
| 375 |
+
end
|
| 376 |
+
|
| 377 |
+
// Implement memory mapped register select and read logic generation
|
| 378 |
+
// Slave register read enable is asserted when valid address is available
|
| 379 |
+
// and the slave is ready to accept the read address.
|
| 380 |
+
assign slv_reg_rden = axi_arready & S_AXI_ARVALID & ~axi_rvalid;
|
| 381 |
+
always @(*)
|
| 382 |
+
begin
|
| 383 |
+
// Address decoding for reading registers
|
| 384 |
+
case ( axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 385 |
+
2'h0 : reg_data_out <= slv_reg0;
|
| 386 |
+
2'h1 : reg_data_out <= slv_reg1;
|
| 387 |
+
2'h2 : reg_data_out <= slv_reg2;
|
| 388 |
+
2'h3 : reg_data_out <= slv_reg3;
|
| 389 |
+
default : reg_data_out <= 0;
|
| 390 |
+
endcase
|
| 391 |
+
end
|
| 392 |
+
|
| 393 |
+
// Output register or memory read data
|
| 394 |
+
always @( posedge S_AXI_ACLK )
|
| 395 |
+
begin
|
| 396 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 397 |
+
begin
|
| 398 |
+
axi_rdata <= 0;
|
| 399 |
+
end
|
| 400 |
+
else
|
| 401 |
+
begin
|
| 402 |
+
// When there is a valid read address (S_AXI_ARVALID) with
|
| 403 |
+
// acceptance of read address by the slave (axi_arready),
|
| 404 |
+
// output the read dada
|
| 405 |
+
if (slv_reg_rden)
|
| 406 |
+
begin
|
| 407 |
+
axi_rdata <= reg_data_out; // register read data
|
| 408 |
+
end
|
| 409 |
+
end
|
| 410 |
+
end
|
| 411 |
+
|
| 412 |
+
// Add user logic here
|
| 413 |
+
Softmax_control u_Softmax_control(
|
| 414 |
+
.clk(axis_aclk),
|
| 415 |
+
.rst_n(aresetn),
|
| 416 |
+
|
| 417 |
+
.top_data_in(s_axis_tdata),
|
| 418 |
+
.top_valid_in(s_axis_tvalid),
|
| 419 |
+
.top_ready_in(s_axis_tready),
|
| 420 |
+
.top_last_in(s_axis_tlast),
|
| 421 |
+
|
| 422 |
+
.top_data_out(m_axis_tdata),
|
| 423 |
+
.top_valid_out(m_axis_tvalid),
|
| 424 |
+
.top_last_out(m_axis_tlast),
|
| 425 |
+
|
| 426 |
+
.length_input(slv_reg0[9:0]), //must be smaller or eruqal to 1023
|
| 427 |
+
.scale_in_input(slv_reg1[4:0]), // -1-10
|
| 428 |
+
.scale_out_input(slv_reg2[3:0]) // 7-12
|
| 429 |
+
);
|
| 430 |
+
// User logic ends
|
| 431 |
+
|
| 432 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/gelu.v
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//latency=4+4
|
| 3 |
+
module gelu(
|
| 4 |
+
input clk,
|
| 5 |
+
input [2:0] in_scale,
|
| 6 |
+
input signed [7:0] x,
|
| 7 |
+
output reg signed [7:0] y_reg1
|
| 8 |
+
);
|
| 9 |
+
reg signed [7:0] x_reg1;
|
| 10 |
+
reg signed [7:0] x_reg2;
|
| 11 |
+
reg signed [7:0] x_reg3;
|
| 12 |
+
reg signed [7:0] x_reg4;
|
| 13 |
+
reg signed [7:0] x_reg5;
|
| 14 |
+
reg signed [7:0] x_reg6;
|
| 15 |
+
reg signed [7:0] x_reg7;
|
| 16 |
+
|
| 17 |
+
reg [2:0] in_scale_reg1;
|
| 18 |
+
reg [2:0] in_scale_reg2;
|
| 19 |
+
reg [2:0] in_scale_reg3;
|
| 20 |
+
reg [2:0] in_scale_reg4;
|
| 21 |
+
reg [2:0] in_scale_reg5;
|
| 22 |
+
reg [2:0] in_scale_reg6;
|
| 23 |
+
reg [2:0] in_scale_reg7;
|
| 24 |
+
always@(posedge clk)begin
|
| 25 |
+
in_scale_reg1<=in_scale;
|
| 26 |
+
in_scale_reg2<=in_scale_reg1;
|
| 27 |
+
in_scale_reg3<=in_scale_reg2;
|
| 28 |
+
in_scale_reg4<=in_scale_reg3;
|
| 29 |
+
in_scale_reg5<=in_scale_reg4;
|
| 30 |
+
in_scale_reg6<=in_scale_reg5;
|
| 31 |
+
in_scale_reg7<=in_scale_reg6;
|
| 32 |
+
end
|
| 33 |
+
always@(posedge clk)begin
|
| 34 |
+
x_reg1<=x;
|
| 35 |
+
x_reg2<=x_reg1;
|
| 36 |
+
x_reg3<=x_reg2;
|
| 37 |
+
x_reg4<=x_reg3;
|
| 38 |
+
x_reg5<=x_reg4;
|
| 39 |
+
x_reg6<=x_reg5;
|
| 40 |
+
x_reg7<=x_reg6;
|
| 41 |
+
end
|
| 42 |
+
reg signed [7:0] y;
|
| 43 |
+
reg signed [15:0] x_in_8Q7;
|
| 44 |
+
reg signed [15:0] x_in_8Q7_reg1;
|
| 45 |
+
reg signed [15:0] x_in_8Q7_reg2;
|
| 46 |
+
reg signed [15:0] x_in_8Q7_reg3;
|
| 47 |
+
reg signed [15:0] x_in_8Q7_reg4;
|
| 48 |
+
reg signed [15:0] x_in_8Q7_reg5;
|
| 49 |
+
reg signed [15:0] x_in_8Q7_reg6;
|
| 50 |
+
reg signed [15:0] x_in_8Q7_reg7;
|
| 51 |
+
always @(*) begin
|
| 52 |
+
if (in_scale < 7 ) begin
|
| 53 |
+
x_in_8Q7 = $signed(x) <<< (3'd7- in_scale);//����
|
| 54 |
+
end
|
| 55 |
+
else begin // in_scale == 7
|
| 56 |
+
x_in_8Q7 = x;
|
| 57 |
+
end
|
| 58 |
+
end
|
| 59 |
+
always@(posedge clk)begin
|
| 60 |
+
x_in_8Q7_reg1<=x_in_8Q7;
|
| 61 |
+
x_in_8Q7_reg2<=x_in_8Q7_reg1;
|
| 62 |
+
x_in_8Q7_reg3<=x_in_8Q7_reg2;
|
| 63 |
+
x_in_8Q7_reg4<=x_in_8Q7_reg3;
|
| 64 |
+
x_in_8Q7_reg5<=x_in_8Q7_reg4;
|
| 65 |
+
x_in_8Q7_reg6<=x_in_8Q7_reg5;
|
| 66 |
+
x_in_8Q7_reg7<=x_in_8Q7_reg6;
|
| 67 |
+
end
|
| 68 |
+
wire signed [9:0] c_2_5_2Q7 = 10'b0_10_1000_000;
|
| 69 |
+
wire signed [9:0] _c_2_5_2Q7 = 10'b1_01_1000_000;
|
| 70 |
+
wire signed [18:0] out_3Q15;
|
| 71 |
+
reg signed [18:0] out_3Q15_reg1;
|
| 72 |
+
wire signed [10:0] y_3Q7;
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
wire signed [11:0] x_in_L_2Q9;
|
| 76 |
+
reg signed [11:0] x_in_L_2Q9_reg1;
|
| 77 |
+
assign x_in_L_2Q9 = $signed(x_in_8Q7_reg1[9:0]) * 3'sb011;
|
| 78 |
+
// <2.5 3/4
|
| 79 |
+
always@(posedge clk)begin
|
| 80 |
+
x_in_L_2Q9_reg1<=x_in_L_2Q9;
|
| 81 |
+
end
|
| 82 |
+
wire signed [8:0] L_1Q7;
|
| 83 |
+
lin u_lin(//latency = 4
|
| 84 |
+
.clk(clk),
|
| 85 |
+
.x_in_L_2Q9(x_in_L_2Q9_reg1),
|
| 86 |
+
.L_1Q7(L_1Q7)
|
| 87 |
+
);
|
| 88 |
+
wire signed [9:0] L_2Q7_1 = L_1Q7 + 10'sb001_000_0000;
|
| 89 |
+
wire signed [9:0] half_L_1Q8 = L_2Q7_1;
|
| 90 |
+
assign out_3Q15 = half_L_1Q8 * $signed(x_in_8Q7_reg6[9:0]);
|
| 91 |
+
always@(posedge clk)begin
|
| 92 |
+
out_3Q15_reg1<=out_3Q15;
|
| 93 |
+
end
|
| 94 |
+
assign y_3Q7= out_3Q15_reg1[18:8];
|
| 95 |
+
|
| 96 |
+
always @(*) begin
|
| 97 |
+
if(x_reg7[7]==1'b1 && x_in_8Q7_reg7<=_c_2_5_2Q7)begin
|
| 98 |
+
y = 0;
|
| 99 |
+
end
|
| 100 |
+
else if(x_reg7[7]==1'b0 && x_in_8Q7_reg7 >= c_2_5_2Q7)begin
|
| 101 |
+
y = x_reg7;
|
| 102 |
+
end
|
| 103 |
+
else begin
|
| 104 |
+
// y=y_3Q7;
|
| 105 |
+
y = (y_3Q7>>>(3'd7-in_scale_reg7));
|
| 106 |
+
end
|
| 107 |
+
end
|
| 108 |
+
always@(posedge clk)begin
|
| 109 |
+
y_reg1 <= y;
|
| 110 |
+
end
|
| 111 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/In Progress/src/lin.v
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps //latency = 4
|
| 2 |
+
module lin(
|
| 3 |
+
input wire clk,
|
| 4 |
+
input wire signed [11:0] x_in_L_2Q9,
|
| 5 |
+
output reg signed [8:0] L_1Q7
|
| 6 |
+
);
|
| 7 |
+
|
| 8 |
+
wire signed [9:0] x_in_L_2Q7 = x_in_L_2Q9[11:2];
|
| 9 |
+
wire sign = x_in_L_2Q9[11];
|
| 10 |
+
reg sign_reg1;
|
| 11 |
+
reg sign_reg2;
|
| 12 |
+
reg sign_reg3;
|
| 13 |
+
always@(posedge clk)begin
|
| 14 |
+
sign_reg1<=sign;
|
| 15 |
+
sign_reg2<=sign_reg1;
|
| 16 |
+
sign_reg3<=sign_reg2;
|
| 17 |
+
end
|
| 18 |
+
wire signed [9:0] x_in_L_2Q7_abs = (sign==1'b1) ? (~x_in_L_2Q7+1) : x_in_L_2Q7;
|
| 19 |
+
wire signed [3:0] b_1Q2 = 4'sb0111; //b=7/4
|
| 20 |
+
wire signed [6:0] a_0Q7 = -7'sd37;
|
| 21 |
+
|
| 22 |
+
wire signed [9:0] x_in_L_2Q7_abs_b = x_in_L_2Q7_abs - {b_1Q2,5'b00000};
|
| 23 |
+
reg signed [9:0] x_in_L_2Q7_abs_b_reg1;
|
| 24 |
+
always@(posedge clk)begin
|
| 25 |
+
x_in_L_2Q7_abs_b_reg1<=x_in_L_2Q7_abs_b;
|
| 26 |
+
end
|
| 27 |
+
|
| 28 |
+
wire signed [18:0] temp_4Q14 = x_in_L_2Q7_abs_b_reg1*x_in_L_2Q7_abs_b_reg1;
|
| 29 |
+
reg signed [18:0] temp_4Q14_reg1;
|
| 30 |
+
always@(posedge clk)begin
|
| 31 |
+
temp_4Q14_reg1<=temp_4Q14;
|
| 32 |
+
end
|
| 33 |
+
wire signed [25:0] l_4Q21 = a_0Q7*temp_4Q14_reg1+ 23'sb0_1_0_0000_0000_0000_0000_0000;
|
| 34 |
+
reg signed [25:0] l_4Q21_reg1;
|
| 35 |
+
always@(posedge clk)begin
|
| 36 |
+
l_4Q21_reg1<=l_4Q21;
|
| 37 |
+
end
|
| 38 |
+
//wire signed [25:0] l_4Q21 = a_0Q7 * x_in_L_2Q7_abs_b * x_in_L_2Q7_abs_b + 23'sb0_1_0_0000_0000_0000_0000_0000;
|
| 39 |
+
reg signed [25:0] sign_l_4Q21;
|
| 40 |
+
always @(*) begin
|
| 41 |
+
if (sign_reg3==1'b1)begin
|
| 42 |
+
sign_l_4Q21 = ~l_4Q21_reg1+1;
|
| 43 |
+
end
|
| 44 |
+
else begin
|
| 45 |
+
sign_l_4Q21 = l_4Q21_reg1;
|
| 46 |
+
end
|
| 47 |
+
end
|
| 48 |
+
always@(posedge clk)begin
|
| 49 |
+
L_1Q7<=sign_l_4Q21[22:14];
|
| 50 |
+
end
|
| 51 |
+
//assign L_1Q7 = sign_l_4Q21[22:14];
|
| 52 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Transformer Accelerator Based on FPGA
|
| 2 |
+
You can run it on pynq z1 (or any other Zynq device, since the systolic array is parameterized). The repository contains the relevant Verilog code, Vivado configuration and C/Python code for sdk/PYNQ testing. The size of the systolic array can be changed, now it is 16X16.
|
| 3 |
+
In the future, I might add some nonlinear hardware acceleration operators (for accelerating ViT, it's a kind of neural network based on Transformer), such as those that compute Softmax, Gelu and LayerNorm functions. I am still working on to improve the accuracy and performance of this part.
|
| 4 |
+
|
| 5 |
+
How to reproduce this project:
|
| 6 |
+
1. In vivado2019.1, create a new project (note that the boardfile is pynq z1, you can download the corresponding boardfile here: https://pynq.readthedocs.io/en/v3.0.0/overlay_design_methodology/board_settings.html ).
|
| 7 |
+
2. Add all the code to the project
|
| 8 |
+
3. Run prj.tcl
|
| 9 |
+
4. Create a wrapper for the block design and set it as the top module.
|
| 10 |
+
5. Run the generated synthesis and implementation strategies and generate the bitstream.
|
Buck008_Transformer-Accelerator-Based-on-FPGA/prj.tcl
ADDED
|
@@ -0,0 +1,1515 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
################################################################
|
| 3 |
+
# This is a generated script based on design: design_1
|
| 4 |
+
#
|
| 5 |
+
# Though there are limitations about the generated script,
|
| 6 |
+
# the main purpose of this utility is to make learning
|
| 7 |
+
# IP Integrator Tcl commands easier.
|
| 8 |
+
################################################################
|
| 9 |
+
|
| 10 |
+
namespace eval _tcl {
|
| 11 |
+
proc get_script_folder {} {
|
| 12 |
+
set script_path [file normalize [info script]]
|
| 13 |
+
set script_folder [file dirname $script_path]
|
| 14 |
+
return $script_folder
|
| 15 |
+
}
|
| 16 |
+
}
|
| 17 |
+
variable script_folder
|
| 18 |
+
set script_folder [_tcl::get_script_folder]
|
| 19 |
+
|
| 20 |
+
################################################################
|
| 21 |
+
# Check if script is running in correct Vivado version.
|
| 22 |
+
################################################################
|
| 23 |
+
set scripts_vivado_version 2019.1
|
| 24 |
+
set current_vivado_version [version -short]
|
| 25 |
+
|
| 26 |
+
if { [string first $scripts_vivado_version $current_vivado_version] == -1 } {
|
| 27 |
+
puts ""
|
| 28 |
+
catch {common::send_msg_id "BD_TCL-109" "ERROR" "This script was generated using Vivado <$scripts_vivado_version> and is being run in <$current_vivado_version> of Vivado. Please run the script in Vivado <$scripts_vivado_version> then open the design in Vivado <$current_vivado_version>. Upgrade the design by running \"Tools => Report => Report IP Status...\", then run write_bd_tcl to create an updated script."}
|
| 29 |
+
|
| 30 |
+
return 1
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
################################################################
|
| 34 |
+
# START
|
| 35 |
+
################################################################
|
| 36 |
+
|
| 37 |
+
# To test this script, run the following commands from Vivado Tcl console:
|
| 38 |
+
# source design_1_script.tcl
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# The design that will be created by this Tcl script contains the following
|
| 42 |
+
# module references:
|
| 43 |
+
# MM_ultra_top
|
| 44 |
+
|
| 45 |
+
# Please add the sources of those modules before sourcing this Tcl script.
|
| 46 |
+
|
| 47 |
+
# If there is no project opened, this script will create a
|
| 48 |
+
# project, but make sure you do not have an existing project
|
| 49 |
+
# <./myproj/project_1.xpr> in the current working folder.
|
| 50 |
+
|
| 51 |
+
set list_projs [get_projects -quiet]
|
| 52 |
+
if { $list_projs eq "" } {
|
| 53 |
+
create_project project_1 myproj -part xc7z020clg400-1
|
| 54 |
+
set_property BOARD_PART www.digilentinc.com:pynq-z1:part0:1.0 [current_project]
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# CHANGE DESIGN NAME HERE
|
| 59 |
+
variable design_name
|
| 60 |
+
set design_name design_1
|
| 61 |
+
|
| 62 |
+
# If you do not already have an existing IP Integrator design open,
|
| 63 |
+
# you can create a design using the following command:
|
| 64 |
+
# create_bd_design $design_name
|
| 65 |
+
|
| 66 |
+
# Creating design if needed
|
| 67 |
+
set errMsg ""
|
| 68 |
+
set nRet 0
|
| 69 |
+
|
| 70 |
+
set cur_design [current_bd_design -quiet]
|
| 71 |
+
set list_cells [get_bd_cells -quiet]
|
| 72 |
+
|
| 73 |
+
if { ${design_name} eq "" } {
|
| 74 |
+
# USE CASES:
|
| 75 |
+
# 1) Design_name not set
|
| 76 |
+
|
| 77 |
+
set errMsg "Please set the variable <design_name> to a non-empty value."
|
| 78 |
+
set nRet 1
|
| 79 |
+
|
| 80 |
+
} elseif { ${cur_design} ne "" && ${list_cells} eq "" } {
|
| 81 |
+
# USE CASES:
|
| 82 |
+
# 2): Current design opened AND is empty AND names same.
|
| 83 |
+
# 3): Current design opened AND is empty AND names diff; design_name NOT in project.
|
| 84 |
+
# 4): Current design opened AND is empty AND names diff; design_name exists in project.
|
| 85 |
+
|
| 86 |
+
if { $cur_design ne $design_name } {
|
| 87 |
+
common::send_msg_id "BD_TCL-001" "INFO" "Changing value of <design_name> from <$design_name> to <$cur_design> since current design is empty."
|
| 88 |
+
set design_name [get_property NAME $cur_design]
|
| 89 |
+
}
|
| 90 |
+
common::send_msg_id "BD_TCL-002" "INFO" "Constructing design in IPI design <$cur_design>..."
|
| 91 |
+
|
| 92 |
+
} elseif { ${cur_design} ne "" && $list_cells ne "" && $cur_design eq $design_name } {
|
| 93 |
+
# USE CASES:
|
| 94 |
+
# 5) Current design opened AND has components AND same names.
|
| 95 |
+
|
| 96 |
+
set errMsg "Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
| 97 |
+
set nRet 1
|
| 98 |
+
} elseif { [get_files -quiet ${design_name}.bd] ne "" } {
|
| 99 |
+
# USE CASES:
|
| 100 |
+
# 6) Current opened design, has components, but diff names, design_name exists in project.
|
| 101 |
+
# 7) No opened design, design_name exists in project.
|
| 102 |
+
|
| 103 |
+
set errMsg "Design <$design_name> already exists in your project, please set the variable <design_name> to another value."
|
| 104 |
+
set nRet 2
|
| 105 |
+
|
| 106 |
+
} else {
|
| 107 |
+
# USE CASES:
|
| 108 |
+
# 8) No opened design, design_name not in project.
|
| 109 |
+
# 9) Current opened design, has components, but diff names, design_name not in project.
|
| 110 |
+
|
| 111 |
+
common::send_msg_id "BD_TCL-003" "INFO" "Currently there is no design <$design_name> in project, so creating one..."
|
| 112 |
+
|
| 113 |
+
create_bd_design $design_name
|
| 114 |
+
|
| 115 |
+
common::send_msg_id "BD_TCL-004" "INFO" "Making design <$design_name> as current_bd_design."
|
| 116 |
+
current_bd_design $design_name
|
| 117 |
+
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
common::send_msg_id "BD_TCL-005" "INFO" "Currently the variable <design_name> is equal to \"$design_name\"."
|
| 121 |
+
|
| 122 |
+
if { $nRet != 0 } {
|
| 123 |
+
catch {common::send_msg_id "BD_TCL-114" "ERROR" $errMsg}
|
| 124 |
+
return $nRet
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
set bCheckIPsPassed 1
|
| 128 |
+
##################################################################
|
| 129 |
+
# CHECK IPs
|
| 130 |
+
##################################################################
|
| 131 |
+
set bCheckIPs 1
|
| 132 |
+
if { $bCheckIPs == 1 } {
|
| 133 |
+
set list_check_ips "\
|
| 134 |
+
xilinx.com:ip:axi_dma:7.1\
|
| 135 |
+
xilinx.com:ip:smartconnect:1.0\
|
| 136 |
+
xilinx.com:ip:axis_dwidth_converter:1.1\
|
| 137 |
+
xilinx.com:ip:processing_system7:5.5\
|
| 138 |
+
xilinx.com:ip:proc_sys_reset:5.0\
|
| 139 |
+
"
|
| 140 |
+
|
| 141 |
+
set list_ips_missing ""
|
| 142 |
+
common::send_msg_id "BD_TCL-006" "INFO" "Checking if the following IPs exist in the project's IP catalog: $list_check_ips ."
|
| 143 |
+
|
| 144 |
+
foreach ip_vlnv $list_check_ips {
|
| 145 |
+
set ip_obj [get_ipdefs -all $ip_vlnv]
|
| 146 |
+
if { $ip_obj eq "" } {
|
| 147 |
+
lappend list_ips_missing $ip_vlnv
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if { $list_ips_missing ne "" } {
|
| 152 |
+
catch {common::send_msg_id "BD_TCL-115" "ERROR" "The following IPs are not found in the IP Catalog:\n $list_ips_missing\n\nResolution: Please add the repository containing the IP(s) to the project." }
|
| 153 |
+
set bCheckIPsPassed 0
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
##################################################################
|
| 159 |
+
# CHECK Modules
|
| 160 |
+
##################################################################
|
| 161 |
+
set bCheckModules 1
|
| 162 |
+
if { $bCheckModules == 1 } {
|
| 163 |
+
set list_check_mods "\
|
| 164 |
+
MM_ultra_top\
|
| 165 |
+
"
|
| 166 |
+
|
| 167 |
+
set list_mods_missing ""
|
| 168 |
+
common::send_msg_id "BD_TCL-006" "INFO" "Checking if the following modules exist in the project's sources: $list_check_mods ."
|
| 169 |
+
|
| 170 |
+
foreach mod_vlnv $list_check_mods {
|
| 171 |
+
if { [can_resolve_reference $mod_vlnv] == 0 } {
|
| 172 |
+
lappend list_mods_missing $mod_vlnv
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
if { $list_mods_missing ne "" } {
|
| 177 |
+
catch {common::send_msg_id "BD_TCL-115" "ERROR" "The following module(s) are not found in the project: $list_mods_missing" }
|
| 178 |
+
common::send_msg_id "BD_TCL-008" "INFO" "Please add source files for the missing module(s) above."
|
| 179 |
+
set bCheckIPsPassed 0
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
if { $bCheckIPsPassed != 1 } {
|
| 184 |
+
common::send_msg_id "BD_TCL-1003" "WARNING" "Will not continue with creation of design due to the error(s) above."
|
| 185 |
+
return 3
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
##################################################################
|
| 189 |
+
# DESIGN PROCs
|
| 190 |
+
##################################################################
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
# Procedure to create entire design; Provide argument to make
|
| 195 |
+
# procedure reusable. If parentCell is "", will use root.
|
| 196 |
+
proc create_root_design { parentCell } {
|
| 197 |
+
|
| 198 |
+
variable script_folder
|
| 199 |
+
variable design_name
|
| 200 |
+
|
| 201 |
+
if { $parentCell eq "" } {
|
| 202 |
+
set parentCell [get_bd_cells /]
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
# Get object for parentCell
|
| 206 |
+
set parentObj [get_bd_cells $parentCell]
|
| 207 |
+
if { $parentObj == "" } {
|
| 208 |
+
catch {common::send_msg_id "BD_TCL-100" "ERROR" "Unable to find parent cell <$parentCell>!"}
|
| 209 |
+
return
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
# Make sure parentObj is hier blk
|
| 213 |
+
set parentType [get_property TYPE $parentObj]
|
| 214 |
+
if { $parentType ne "hier" } {
|
| 215 |
+
catch {common::send_msg_id "BD_TCL-101" "ERROR" "Parent <$parentObj> has TYPE = <$parentType>. Expected to be <hier>."}
|
| 216 |
+
return
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
# Save current instance; Restore later
|
| 220 |
+
set oldCurInst [current_bd_instance .]
|
| 221 |
+
|
| 222 |
+
# Set parent object as current
|
| 223 |
+
current_bd_instance $parentObj
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
# Create interface ports
|
| 227 |
+
set DDR [ create_bd_intf_port -mode Master -vlnv xilinx.com:interface:ddrx_rtl:1.0 DDR ]
|
| 228 |
+
|
| 229 |
+
set FIXED_IO [ create_bd_intf_port -mode Master -vlnv xilinx.com:display_processing_system7:fixedio_rtl:1.0 FIXED_IO ]
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
# Create ports
|
| 233 |
+
|
| 234 |
+
# Create instance: MM_ultra_top_0, and set properties
|
| 235 |
+
set block_name MM_ultra_top
|
| 236 |
+
set block_cell_name MM_ultra_top_0
|
| 237 |
+
if { [catch {set MM_ultra_top_0 [create_bd_cell -type module -reference $block_name $block_cell_name] } errmsg] } {
|
| 238 |
+
catch {common::send_msg_id "BD_TCL-105" "ERROR" "Unable to add referenced block <$block_name>. Please add the files for ${block_name}'s definition into the project."}
|
| 239 |
+
return 1
|
| 240 |
+
} elseif { $MM_ultra_top_0 eq "" } {
|
| 241 |
+
catch {common::send_msg_id "BD_TCL-106" "ERROR" "Unable to referenced block <$block_name>. Please add the files for ${block_name}'s definition into the project."}
|
| 242 |
+
return 1
|
| 243 |
+
}
|
| 244 |
+
set_property -dict [ list \
|
| 245 |
+
CONFIG.Weight_block_num {2500} \
|
| 246 |
+
CONFIG.array_size {24} \
|
| 247 |
+
CONFIG.in_feature_Block_num {2500} \
|
| 248 |
+
CONFIG.out_feature_block_num {2500} \
|
| 249 |
+
CONFIG.weight_width_block_num_width {5} \
|
| 250 |
+
] $MM_ultra_top_0
|
| 251 |
+
|
| 252 |
+
# Create instance: axi_dma_0, and set properties
|
| 253 |
+
set axi_dma_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_dma:7.1 axi_dma_0 ]
|
| 254 |
+
set_property -dict [ list \
|
| 255 |
+
CONFIG.c_include_mm2s {1} \
|
| 256 |
+
CONFIG.c_include_mm2s_dre {1} \
|
| 257 |
+
CONFIG.c_include_s2mm {0} \
|
| 258 |
+
CONFIG.c_include_s2mm_dre {0} \
|
| 259 |
+
CONFIG.c_include_sg {0} \
|
| 260 |
+
CONFIG.c_m_axi_mm2s_data_width {64} \
|
| 261 |
+
CONFIG.c_m_axis_mm2s_tdata_width {64} \
|
| 262 |
+
CONFIG.c_mm2s_burst_size {256} \
|
| 263 |
+
CONFIG.c_sg_include_stscntrl_strm {0} \
|
| 264 |
+
CONFIG.c_sg_length_width {16} \
|
| 265 |
+
] $axi_dma_0
|
| 266 |
+
|
| 267 |
+
# Create instance: axi_dma_1, and set properties
|
| 268 |
+
set axi_dma_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_dma:7.1 axi_dma_1 ]
|
| 269 |
+
set_property -dict [ list \
|
| 270 |
+
CONFIG.c_include_mm2s {1} \
|
| 271 |
+
CONFIG.c_include_mm2s_dre {1} \
|
| 272 |
+
CONFIG.c_include_s2mm {0} \
|
| 273 |
+
CONFIG.c_include_s2mm_dre {0} \
|
| 274 |
+
CONFIG.c_include_sg {0} \
|
| 275 |
+
CONFIG.c_m_axi_mm2s_data_width {64} \
|
| 276 |
+
CONFIG.c_m_axis_mm2s_tdata_width {64} \
|
| 277 |
+
CONFIG.c_mm2s_burst_size {256} \
|
| 278 |
+
CONFIG.c_sg_include_stscntrl_strm {0} \
|
| 279 |
+
CONFIG.c_sg_length_width {16} \
|
| 280 |
+
] $axi_dma_1
|
| 281 |
+
|
| 282 |
+
# Create instance: axi_dma_2, and set properties
|
| 283 |
+
set axi_dma_2 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_dma:7.1 axi_dma_2 ]
|
| 284 |
+
set_property -dict [ list \
|
| 285 |
+
CONFIG.c_include_mm2s {0} \
|
| 286 |
+
CONFIG.c_include_mm2s_dre {0} \
|
| 287 |
+
CONFIG.c_include_s2mm {1} \
|
| 288 |
+
CONFIG.c_include_s2mm_dre {1} \
|
| 289 |
+
CONFIG.c_include_sg {0} \
|
| 290 |
+
CONFIG.c_m_axi_mm2s_data_width {64} \
|
| 291 |
+
CONFIG.c_m_axis_mm2s_tdata_width {32} \
|
| 292 |
+
CONFIG.c_mm2s_burst_size {16} \
|
| 293 |
+
CONFIG.c_s2mm_burst_size {256} \
|
| 294 |
+
CONFIG.c_sg_include_stscntrl_strm {0} \
|
| 295 |
+
CONFIG.c_sg_length_width {16} \
|
| 296 |
+
] $axi_dma_2
|
| 297 |
+
|
| 298 |
+
# Create instance: axi_smc, and set properties
|
| 299 |
+
set axi_smc [ create_bd_cell -type ip -vlnv xilinx.com:ip:smartconnect:1.0 axi_smc ]
|
| 300 |
+
set_property -dict [ list \
|
| 301 |
+
CONFIG.NUM_SI {1} \
|
| 302 |
+
] $axi_smc
|
| 303 |
+
|
| 304 |
+
# Create instance: axi_smc_1, and set properties
|
| 305 |
+
set axi_smc_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:smartconnect:1.0 axi_smc_1 ]
|
| 306 |
+
set_property -dict [ list \
|
| 307 |
+
CONFIG.NUM_SI {1} \
|
| 308 |
+
] $axi_smc_1
|
| 309 |
+
|
| 310 |
+
# Create instance: axi_smc_2, and set properties
|
| 311 |
+
set axi_smc_2 [ create_bd_cell -type ip -vlnv xilinx.com:ip:smartconnect:1.0 axi_smc_2 ]
|
| 312 |
+
set_property -dict [ list \
|
| 313 |
+
CONFIG.NUM_SI {1} \
|
| 314 |
+
] $axi_smc_2
|
| 315 |
+
|
| 316 |
+
# Create instance: axis_dwidth_converter_0, and set properties
|
| 317 |
+
set axis_dwidth_converter_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axis_dwidth_converter:1.1 axis_dwidth_converter_0 ]
|
| 318 |
+
set_property -dict [ list \
|
| 319 |
+
CONFIG.M_TDATA_NUM_BYTES {24} \
|
| 320 |
+
] $axis_dwidth_converter_0
|
| 321 |
+
|
| 322 |
+
# Create instance: axis_dwidth_converter_1, and set properties
|
| 323 |
+
set axis_dwidth_converter_1 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axis_dwidth_converter:1.1 axis_dwidth_converter_1 ]
|
| 324 |
+
set_property -dict [ list \
|
| 325 |
+
CONFIG.M_TDATA_NUM_BYTES {24} \
|
| 326 |
+
] $axis_dwidth_converter_1
|
| 327 |
+
|
| 328 |
+
# Create instance: axis_dwidth_converter_2, and set properties
|
| 329 |
+
set axis_dwidth_converter_2 [ create_bd_cell -type ip -vlnv xilinx.com:ip:axis_dwidth_converter:1.1 axis_dwidth_converter_2 ]
|
| 330 |
+
set_property -dict [ list \
|
| 331 |
+
CONFIG.M_TDATA_NUM_BYTES {8} \
|
| 332 |
+
] $axis_dwidth_converter_2
|
| 333 |
+
|
| 334 |
+
# Create instance: processing_system7_0, and set properties
|
| 335 |
+
set processing_system7_0 [ create_bd_cell -type ip -vlnv xilinx.com:ip:processing_system7:5.5 processing_system7_0 ]
|
| 336 |
+
set_property -dict [ list \
|
| 337 |
+
CONFIG.PCW_ACT_APU_PERIPHERAL_FREQMHZ {650.000000} \
|
| 338 |
+
CONFIG.PCW_ACT_CAN0_PERIPHERAL_FREQMHZ {23.8095} \
|
| 339 |
+
CONFIG.PCW_ACT_CAN1_PERIPHERAL_FREQMHZ {23.8095} \
|
| 340 |
+
CONFIG.PCW_ACT_CAN_PERIPHERAL_FREQMHZ {10.000000} \
|
| 341 |
+
CONFIG.PCW_ACT_DCI_PERIPHERAL_FREQMHZ {10.096154} \
|
| 342 |
+
CONFIG.PCW_ACT_ENET0_PERIPHERAL_FREQMHZ {10.000000} \
|
| 343 |
+
CONFIG.PCW_ACT_ENET1_PERIPHERAL_FREQMHZ {10.000000} \
|
| 344 |
+
CONFIG.PCW_ACT_FPGA0_PERIPHERAL_FREQMHZ {100.000000} \
|
| 345 |
+
CONFIG.PCW_ACT_FPGA1_PERIPHERAL_FREQMHZ {10.000000} \
|
| 346 |
+
CONFIG.PCW_ACT_FPGA2_PERIPHERAL_FREQMHZ {10.000000} \
|
| 347 |
+
CONFIG.PCW_ACT_FPGA3_PERIPHERAL_FREQMHZ {10.000000} \
|
| 348 |
+
CONFIG.PCW_ACT_I2C_PERIPHERAL_FREQMHZ {50} \
|
| 349 |
+
CONFIG.PCW_ACT_PCAP_PERIPHERAL_FREQMHZ {200.000000} \
|
| 350 |
+
CONFIG.PCW_ACT_QSPI_PERIPHERAL_FREQMHZ {10.000000} \
|
| 351 |
+
CONFIG.PCW_ACT_SDIO_PERIPHERAL_FREQMHZ {50.000000} \
|
| 352 |
+
CONFIG.PCW_ACT_SMC_PERIPHERAL_FREQMHZ {10.000000} \
|
| 353 |
+
CONFIG.PCW_ACT_SPI_PERIPHERAL_FREQMHZ {10.000000} \
|
| 354 |
+
CONFIG.PCW_ACT_TPIU_PERIPHERAL_FREQMHZ {200.000000} \
|
| 355 |
+
CONFIG.PCW_ACT_TTC0_CLK0_PERIPHERAL_FREQMHZ {108.333336} \
|
| 356 |
+
CONFIG.PCW_ACT_TTC0_CLK1_PERIPHERAL_FREQMHZ {108.333336} \
|
| 357 |
+
CONFIG.PCW_ACT_TTC0_CLK2_PERIPHERAL_FREQMHZ {108.333336} \
|
| 358 |
+
CONFIG.PCW_ACT_TTC1_CLK0_PERIPHERAL_FREQMHZ {108.333336} \
|
| 359 |
+
CONFIG.PCW_ACT_TTC1_CLK1_PERIPHERAL_FREQMHZ {108.333336} \
|
| 360 |
+
CONFIG.PCW_ACT_TTC1_CLK2_PERIPHERAL_FREQMHZ {108.333336} \
|
| 361 |
+
CONFIG.PCW_ACT_TTC_PERIPHERAL_FREQMHZ {50} \
|
| 362 |
+
CONFIG.PCW_ACT_UART_PERIPHERAL_FREQMHZ {100.000000} \
|
| 363 |
+
CONFIG.PCW_ACT_USB0_PERIPHERAL_FREQMHZ {60} \
|
| 364 |
+
CONFIG.PCW_ACT_USB1_PERIPHERAL_FREQMHZ {60} \
|
| 365 |
+
CONFIG.PCW_ACT_WDT_PERIPHERAL_FREQMHZ {108.333336} \
|
| 366 |
+
CONFIG.PCW_APU_CLK_RATIO_ENABLE {6:2:1} \
|
| 367 |
+
CONFIG.PCW_APU_PERIPHERAL_FREQMHZ {650} \
|
| 368 |
+
CONFIG.PCW_ARMPLL_CTRL_FBDIV {26} \
|
| 369 |
+
CONFIG.PCW_CAN0_BASEADDR {0xE0008000} \
|
| 370 |
+
CONFIG.PCW_CAN0_HIGHADDR {0xE0008FFF} \
|
| 371 |
+
CONFIG.PCW_CAN0_PERIPHERAL_CLKSRC {External} \
|
| 372 |
+
CONFIG.PCW_CAN0_PERIPHERAL_FREQMHZ {-1} \
|
| 373 |
+
CONFIG.PCW_CAN1_BASEADDR {0xE0009000} \
|
| 374 |
+
CONFIG.PCW_CAN1_HIGHADDR {0xE0009FFF} \
|
| 375 |
+
CONFIG.PCW_CAN1_PERIPHERAL_CLKSRC {External} \
|
| 376 |
+
CONFIG.PCW_CAN1_PERIPHERAL_FREQMHZ {-1} \
|
| 377 |
+
CONFIG.PCW_CAN_PERIPHERAL_CLKSRC {IO PLL} \
|
| 378 |
+
CONFIG.PCW_CAN_PERIPHERAL_DIVISOR0 {1} \
|
| 379 |
+
CONFIG.PCW_CAN_PERIPHERAL_DIVISOR1 {1} \
|
| 380 |
+
CONFIG.PCW_CAN_PERIPHERAL_FREQMHZ {100} \
|
| 381 |
+
CONFIG.PCW_CAN_PERIPHERAL_VALID {0} \
|
| 382 |
+
CONFIG.PCW_CLK0_FREQ {100000000} \
|
| 383 |
+
CONFIG.PCW_CLK1_FREQ {10000000} \
|
| 384 |
+
CONFIG.PCW_CLK2_FREQ {10000000} \
|
| 385 |
+
CONFIG.PCW_CLK3_FREQ {10000000} \
|
| 386 |
+
CONFIG.PCW_CORE0_FIQ_INTR {0} \
|
| 387 |
+
CONFIG.PCW_CORE0_IRQ_INTR {0} \
|
| 388 |
+
CONFIG.PCW_CORE1_FIQ_INTR {0} \
|
| 389 |
+
CONFIG.PCW_CORE1_IRQ_INTR {0} \
|
| 390 |
+
CONFIG.PCW_CPU_CPU_6X4X_MAX_RANGE {667} \
|
| 391 |
+
CONFIG.PCW_CPU_CPU_PLL_FREQMHZ {1300.000} \
|
| 392 |
+
CONFIG.PCW_CPU_PERIPHERAL_CLKSRC {ARM PLL} \
|
| 393 |
+
CONFIG.PCW_CPU_PERIPHERAL_DIVISOR0 {2} \
|
| 394 |
+
CONFIG.PCW_CRYSTAL_PERIPHERAL_FREQMHZ {50} \
|
| 395 |
+
CONFIG.PCW_DCI_PERIPHERAL_CLKSRC {DDR PLL} \
|
| 396 |
+
CONFIG.PCW_DCI_PERIPHERAL_DIVISOR0 {52} \
|
| 397 |
+
CONFIG.PCW_DCI_PERIPHERAL_DIVISOR1 {2} \
|
| 398 |
+
CONFIG.PCW_DCI_PERIPHERAL_FREQMHZ {10.159} \
|
| 399 |
+
CONFIG.PCW_DDRPLL_CTRL_FBDIV {21} \
|
| 400 |
+
CONFIG.PCW_DDR_DDR_PLL_FREQMHZ {1050.000} \
|
| 401 |
+
CONFIG.PCW_DDR_HPRLPR_QUEUE_PARTITION {HPR(0)/LPR(32)} \
|
| 402 |
+
CONFIG.PCW_DDR_HPR_TO_CRITICAL_PRIORITY_LEVEL {15} \
|
| 403 |
+
CONFIG.PCW_DDR_LPR_TO_CRITICAL_PRIORITY_LEVEL {2} \
|
| 404 |
+
CONFIG.PCW_DDR_PERIPHERAL_CLKSRC {DDR PLL} \
|
| 405 |
+
CONFIG.PCW_DDR_PERIPHERAL_DIVISOR0 {2} \
|
| 406 |
+
CONFIG.PCW_DDR_PORT0_HPR_ENABLE {0} \
|
| 407 |
+
CONFIG.PCW_DDR_PORT1_HPR_ENABLE {0} \
|
| 408 |
+
CONFIG.PCW_DDR_PORT2_HPR_ENABLE {0} \
|
| 409 |
+
CONFIG.PCW_DDR_PORT3_HPR_ENABLE {0} \
|
| 410 |
+
CONFIG.PCW_DDR_RAM_BASEADDR {0x00100000} \
|
| 411 |
+
CONFIG.PCW_DDR_RAM_HIGHADDR {0x1FFFFFFF} \
|
| 412 |
+
CONFIG.PCW_DDR_WRITE_TO_CRITICAL_PRIORITY_LEVEL {2} \
|
| 413 |
+
CONFIG.PCW_DM_WIDTH {4} \
|
| 414 |
+
CONFIG.PCW_DQS_WIDTH {4} \
|
| 415 |
+
CONFIG.PCW_DQ_WIDTH {32} \
|
| 416 |
+
CONFIG.PCW_ENET0_BASEADDR {0xE000B000} \
|
| 417 |
+
CONFIG.PCW_ENET0_ENET0_IO {<Select>} \
|
| 418 |
+
CONFIG.PCW_ENET0_GRP_MDIO_ENABLE {0} \
|
| 419 |
+
CONFIG.PCW_ENET0_GRP_MDIO_IO {<Select>} \
|
| 420 |
+
CONFIG.PCW_ENET0_HIGHADDR {0xE000BFFF} \
|
| 421 |
+
CONFIG.PCW_ENET0_PERIPHERAL_CLKSRC {IO PLL} \
|
| 422 |
+
CONFIG.PCW_ENET0_PERIPHERAL_DIVISOR0 {1} \
|
| 423 |
+
CONFIG.PCW_ENET0_PERIPHERAL_DIVISOR1 {1} \
|
| 424 |
+
CONFIG.PCW_ENET0_PERIPHERAL_ENABLE {0} \
|
| 425 |
+
CONFIG.PCW_ENET0_PERIPHERAL_FREQMHZ {1000 Mbps} \
|
| 426 |
+
CONFIG.PCW_ENET0_RESET_ENABLE {1} \
|
| 427 |
+
CONFIG.PCW_ENET0_RESET_IO {MIO 9} \
|
| 428 |
+
CONFIG.PCW_ENET1_BASEADDR {0xE000C000} \
|
| 429 |
+
CONFIG.PCW_ENET1_GRP_MDIO_ENABLE {0} \
|
| 430 |
+
CONFIG.PCW_ENET1_HIGHADDR {0xE000CFFF} \
|
| 431 |
+
CONFIG.PCW_ENET1_PERIPHERAL_CLKSRC {IO PLL} \
|
| 432 |
+
CONFIG.PCW_ENET1_PERIPHERAL_DIVISOR0 {1} \
|
| 433 |
+
CONFIG.PCW_ENET1_PERIPHERAL_DIVISOR1 {1} \
|
| 434 |
+
CONFIG.PCW_ENET1_PERIPHERAL_ENABLE {0} \
|
| 435 |
+
CONFIG.PCW_ENET1_PERIPHERAL_FREQMHZ {1000 Mbps} \
|
| 436 |
+
CONFIG.PCW_ENET1_RESET_ENABLE {0} \
|
| 437 |
+
CONFIG.PCW_ENET_RESET_ENABLE {1} \
|
| 438 |
+
CONFIG.PCW_ENET_RESET_POLARITY {Active Low} \
|
| 439 |
+
CONFIG.PCW_ENET_RESET_SELECT {<Select>} \
|
| 440 |
+
CONFIG.PCW_EN_4K_TIMER {0} \
|
| 441 |
+
CONFIG.PCW_EN_CAN0 {0} \
|
| 442 |
+
CONFIG.PCW_EN_CAN1 {0} \
|
| 443 |
+
CONFIG.PCW_EN_CLK0_PORT {1} \
|
| 444 |
+
CONFIG.PCW_EN_CLK1_PORT {0} \
|
| 445 |
+
CONFIG.PCW_EN_CLK2_PORT {0} \
|
| 446 |
+
CONFIG.PCW_EN_CLK3_PORT {0} \
|
| 447 |
+
CONFIG.PCW_EN_CLKTRIG0_PORT {0} \
|
| 448 |
+
CONFIG.PCW_EN_CLKTRIG1_PORT {0} \
|
| 449 |
+
CONFIG.PCW_EN_CLKTRIG2_PORT {0} \
|
| 450 |
+
CONFIG.PCW_EN_CLKTRIG3_PORT {0} \
|
| 451 |
+
CONFIG.PCW_EN_DDR {1} \
|
| 452 |
+
CONFIG.PCW_EN_EMIO_CAN0 {0} \
|
| 453 |
+
CONFIG.PCW_EN_EMIO_CAN1 {0} \
|
| 454 |
+
CONFIG.PCW_EN_EMIO_CD_SDIO0 {0} \
|
| 455 |
+
CONFIG.PCW_EN_EMIO_CD_SDIO1 {0} \
|
| 456 |
+
CONFIG.PCW_EN_EMIO_ENET0 {0} \
|
| 457 |
+
CONFIG.PCW_EN_EMIO_ENET1 {0} \
|
| 458 |
+
CONFIG.PCW_EN_EMIO_GPIO {0} \
|
| 459 |
+
CONFIG.PCW_EN_EMIO_I2C0 {0} \
|
| 460 |
+
CONFIG.PCW_EN_EMIO_I2C1 {0} \
|
| 461 |
+
CONFIG.PCW_EN_EMIO_MODEM_UART0 {0} \
|
| 462 |
+
CONFIG.PCW_EN_EMIO_MODEM_UART1 {0} \
|
| 463 |
+
CONFIG.PCW_EN_EMIO_PJTAG {0} \
|
| 464 |
+
CONFIG.PCW_EN_EMIO_SDIO0 {0} \
|
| 465 |
+
CONFIG.PCW_EN_EMIO_SDIO1 {0} \
|
| 466 |
+
CONFIG.PCW_EN_EMIO_SPI0 {0} \
|
| 467 |
+
CONFIG.PCW_EN_EMIO_SPI1 {0} \
|
| 468 |
+
CONFIG.PCW_EN_EMIO_SRAM_INT {0} \
|
| 469 |
+
CONFIG.PCW_EN_EMIO_TRACE {0} \
|
| 470 |
+
CONFIG.PCW_EN_EMIO_TTC0 {0} \
|
| 471 |
+
CONFIG.PCW_EN_EMIO_TTC1 {0} \
|
| 472 |
+
CONFIG.PCW_EN_EMIO_UART0 {0} \
|
| 473 |
+
CONFIG.PCW_EN_EMIO_UART1 {0} \
|
| 474 |
+
CONFIG.PCW_EN_EMIO_WDT {0} \
|
| 475 |
+
CONFIG.PCW_EN_EMIO_WP_SDIO0 {0} \
|
| 476 |
+
CONFIG.PCW_EN_EMIO_WP_SDIO1 {0} \
|
| 477 |
+
CONFIG.PCW_EN_ENET0 {0} \
|
| 478 |
+
CONFIG.PCW_EN_ENET1 {0} \
|
| 479 |
+
CONFIG.PCW_EN_GPIO {1} \
|
| 480 |
+
CONFIG.PCW_EN_I2C0 {0} \
|
| 481 |
+
CONFIG.PCW_EN_I2C1 {0} \
|
| 482 |
+
CONFIG.PCW_EN_MODEM_UART0 {0} \
|
| 483 |
+
CONFIG.PCW_EN_MODEM_UART1 {0} \
|
| 484 |
+
CONFIG.PCW_EN_PJTAG {0} \
|
| 485 |
+
CONFIG.PCW_EN_PTP_ENET0 {0} \
|
| 486 |
+
CONFIG.PCW_EN_PTP_ENET1 {0} \
|
| 487 |
+
CONFIG.PCW_EN_QSPI {0} \
|
| 488 |
+
CONFIG.PCW_EN_RST0_PORT {1} \
|
| 489 |
+
CONFIG.PCW_EN_RST1_PORT {0} \
|
| 490 |
+
CONFIG.PCW_EN_RST2_PORT {0} \
|
| 491 |
+
CONFIG.PCW_EN_RST3_PORT {0} \
|
| 492 |
+
CONFIG.PCW_EN_SDIO0 {1} \
|
| 493 |
+
CONFIG.PCW_EN_SDIO1 {0} \
|
| 494 |
+
CONFIG.PCW_EN_SMC {0} \
|
| 495 |
+
CONFIG.PCW_EN_SPI0 {0} \
|
| 496 |
+
CONFIG.PCW_EN_SPI1 {0} \
|
| 497 |
+
CONFIG.PCW_EN_TRACE {0} \
|
| 498 |
+
CONFIG.PCW_EN_TTC0 {0} \
|
| 499 |
+
CONFIG.PCW_EN_TTC1 {0} \
|
| 500 |
+
CONFIG.PCW_EN_UART0 {1} \
|
| 501 |
+
CONFIG.PCW_EN_UART1 {0} \
|
| 502 |
+
CONFIG.PCW_EN_USB0 {1} \
|
| 503 |
+
CONFIG.PCW_EN_USB1 {0} \
|
| 504 |
+
CONFIG.PCW_EN_WDT {0} \
|
| 505 |
+
CONFIG.PCW_FCLK0_PERIPHERAL_CLKSRC {IO PLL} \
|
| 506 |
+
CONFIG.PCW_FCLK0_PERIPHERAL_DIVISOR0 {4} \
|
| 507 |
+
CONFIG.PCW_FCLK0_PERIPHERAL_DIVISOR1 {4} \
|
| 508 |
+
CONFIG.PCW_FCLK1_PERIPHERAL_CLKSRC {IO PLL} \
|
| 509 |
+
CONFIG.PCW_FCLK1_PERIPHERAL_DIVISOR0 {1} \
|
| 510 |
+
CONFIG.PCW_FCLK1_PERIPHERAL_DIVISOR1 {1} \
|
| 511 |
+
CONFIG.PCW_FCLK2_PERIPHERAL_CLKSRC {IO PLL} \
|
| 512 |
+
CONFIG.PCW_FCLK2_PERIPHERAL_DIVISOR0 {1} \
|
| 513 |
+
CONFIG.PCW_FCLK2_PERIPHERAL_DIVISOR1 {1} \
|
| 514 |
+
CONFIG.PCW_FCLK3_PERIPHERAL_CLKSRC {IO PLL} \
|
| 515 |
+
CONFIG.PCW_FCLK3_PERIPHERAL_DIVISOR0 {1} \
|
| 516 |
+
CONFIG.PCW_FCLK3_PERIPHERAL_DIVISOR1 {1} \
|
| 517 |
+
CONFIG.PCW_FCLK_CLK0_BUF {TRUE} \
|
| 518 |
+
CONFIG.PCW_FCLK_CLK1_BUF {FALSE} \
|
| 519 |
+
CONFIG.PCW_FCLK_CLK2_BUF {FALSE} \
|
| 520 |
+
CONFIG.PCW_FCLK_CLK3_BUF {FALSE} \
|
| 521 |
+
CONFIG.PCW_FPGA0_PERIPHERAL_FREQMHZ {100} \
|
| 522 |
+
CONFIG.PCW_FPGA1_PERIPHERAL_FREQMHZ {50} \
|
| 523 |
+
CONFIG.PCW_FPGA2_PERIPHERAL_FREQMHZ {50} \
|
| 524 |
+
CONFIG.PCW_FPGA3_PERIPHERAL_FREQMHZ {50} \
|
| 525 |
+
CONFIG.PCW_FPGA_FCLK0_ENABLE {1} \
|
| 526 |
+
CONFIG.PCW_FPGA_FCLK1_ENABLE {0} \
|
| 527 |
+
CONFIG.PCW_FPGA_FCLK2_ENABLE {0} \
|
| 528 |
+
CONFIG.PCW_FPGA_FCLK3_ENABLE {0} \
|
| 529 |
+
CONFIG.PCW_GPIO_BASEADDR {0xE000A000} \
|
| 530 |
+
CONFIG.PCW_GPIO_EMIO_GPIO_ENABLE {0} \
|
| 531 |
+
CONFIG.PCW_GPIO_EMIO_GPIO_WIDTH {64} \
|
| 532 |
+
CONFIG.PCW_GPIO_HIGHADDR {0xE000AFFF} \
|
| 533 |
+
CONFIG.PCW_GPIO_MIO_GPIO_ENABLE {1} \
|
| 534 |
+
CONFIG.PCW_GPIO_MIO_GPIO_IO {MIO} \
|
| 535 |
+
CONFIG.PCW_GPIO_PERIPHERAL_ENABLE {0} \
|
| 536 |
+
CONFIG.PCW_I2C0_BASEADDR {0xE0004000} \
|
| 537 |
+
CONFIG.PCW_I2C0_HIGHADDR {0xE0004FFF} \
|
| 538 |
+
CONFIG.PCW_I2C0_RESET_ENABLE {0} \
|
| 539 |
+
CONFIG.PCW_I2C1_BASEADDR {0xE0005000} \
|
| 540 |
+
CONFIG.PCW_I2C1_HIGHADDR {0xE0005FFF} \
|
| 541 |
+
CONFIG.PCW_I2C1_RESET_ENABLE {0} \
|
| 542 |
+
CONFIG.PCW_I2C_PERIPHERAL_FREQMHZ {25} \
|
| 543 |
+
CONFIG.PCW_I2C_RESET_ENABLE {1} \
|
| 544 |
+
CONFIG.PCW_I2C_RESET_POLARITY {Active Low} \
|
| 545 |
+
CONFIG.PCW_IMPORT_BOARD_PRESET {None} \
|
| 546 |
+
CONFIG.PCW_INCLUDE_ACP_TRANS_CHECK {0} \
|
| 547 |
+
CONFIG.PCW_INCLUDE_TRACE_BUFFER {0} \
|
| 548 |
+
CONFIG.PCW_IOPLL_CTRL_FBDIV {32} \
|
| 549 |
+
CONFIG.PCW_IO_IO_PLL_FREQMHZ {1600.000} \
|
| 550 |
+
CONFIG.PCW_IRQ_F2P_INTR {0} \
|
| 551 |
+
CONFIG.PCW_IRQ_F2P_MODE {DIRECT} \
|
| 552 |
+
CONFIG.PCW_MIO_0_DIRECTION {inout} \
|
| 553 |
+
CONFIG.PCW_MIO_0_IOTYPE {LVCMOS 3.3V} \
|
| 554 |
+
CONFIG.PCW_MIO_0_PULLUP {enabled} \
|
| 555 |
+
CONFIG.PCW_MIO_0_SLEW {slow} \
|
| 556 |
+
CONFIG.PCW_MIO_10_DIRECTION {inout} \
|
| 557 |
+
CONFIG.PCW_MIO_10_IOTYPE {LVCMOS 3.3V} \
|
| 558 |
+
CONFIG.PCW_MIO_10_PULLUP {enabled} \
|
| 559 |
+
CONFIG.PCW_MIO_10_SLEW {slow} \
|
| 560 |
+
CONFIG.PCW_MIO_11_DIRECTION {inout} \
|
| 561 |
+
CONFIG.PCW_MIO_11_IOTYPE {LVCMOS 3.3V} \
|
| 562 |
+
CONFIG.PCW_MIO_11_PULLUP {enabled} \
|
| 563 |
+
CONFIG.PCW_MIO_11_SLEW {slow} \
|
| 564 |
+
CONFIG.PCW_MIO_12_DIRECTION {inout} \
|
| 565 |
+
CONFIG.PCW_MIO_12_IOTYPE {LVCMOS 3.3V} \
|
| 566 |
+
CONFIG.PCW_MIO_12_PULLUP {enabled} \
|
| 567 |
+
CONFIG.PCW_MIO_12_SLEW {slow} \
|
| 568 |
+
CONFIG.PCW_MIO_13_DIRECTION {inout} \
|
| 569 |
+
CONFIG.PCW_MIO_13_IOTYPE {LVCMOS 3.3V} \
|
| 570 |
+
CONFIG.PCW_MIO_13_PULLUP {enabled} \
|
| 571 |
+
CONFIG.PCW_MIO_13_SLEW {slow} \
|
| 572 |
+
CONFIG.PCW_MIO_14_DIRECTION {in} \
|
| 573 |
+
CONFIG.PCW_MIO_14_IOTYPE {LVCMOS 3.3V} \
|
| 574 |
+
CONFIG.PCW_MIO_14_PULLUP {enabled} \
|
| 575 |
+
CONFIG.PCW_MIO_14_SLEW {slow} \
|
| 576 |
+
CONFIG.PCW_MIO_15_DIRECTION {out} \
|
| 577 |
+
CONFIG.PCW_MIO_15_IOTYPE {LVCMOS 3.3V} \
|
| 578 |
+
CONFIG.PCW_MIO_15_PULLUP {enabled} \
|
| 579 |
+
CONFIG.PCW_MIO_15_SLEW {slow} \
|
| 580 |
+
CONFIG.PCW_MIO_16_DIRECTION {inout} \
|
| 581 |
+
CONFIG.PCW_MIO_16_IOTYPE {LVCMOS 1.8V} \
|
| 582 |
+
CONFIG.PCW_MIO_16_PULLUP {enabled} \
|
| 583 |
+
CONFIG.PCW_MIO_16_SLEW {slow} \
|
| 584 |
+
CONFIG.PCW_MIO_17_DIRECTION {inout} \
|
| 585 |
+
CONFIG.PCW_MIO_17_IOTYPE {LVCMOS 1.8V} \
|
| 586 |
+
CONFIG.PCW_MIO_17_PULLUP {enabled} \
|
| 587 |
+
CONFIG.PCW_MIO_17_SLEW {slow} \
|
| 588 |
+
CONFIG.PCW_MIO_18_DIRECTION {inout} \
|
| 589 |
+
CONFIG.PCW_MIO_18_IOTYPE {LVCMOS 1.8V} \
|
| 590 |
+
CONFIG.PCW_MIO_18_PULLUP {enabled} \
|
| 591 |
+
CONFIG.PCW_MIO_18_SLEW {slow} \
|
| 592 |
+
CONFIG.PCW_MIO_19_DIRECTION {inout} \
|
| 593 |
+
CONFIG.PCW_MIO_19_IOTYPE {LVCMOS 1.8V} \
|
| 594 |
+
CONFIG.PCW_MIO_19_PULLUP {enabled} \
|
| 595 |
+
CONFIG.PCW_MIO_19_SLEW {slow} \
|
| 596 |
+
CONFIG.PCW_MIO_1_DIRECTION {out} \
|
| 597 |
+
CONFIG.PCW_MIO_1_IOTYPE {LVCMOS 3.3V} \
|
| 598 |
+
CONFIG.PCW_MIO_1_PULLUP {enabled} \
|
| 599 |
+
CONFIG.PCW_MIO_1_SLEW {slow} \
|
| 600 |
+
CONFIG.PCW_MIO_20_DIRECTION {inout} \
|
| 601 |
+
CONFIG.PCW_MIO_20_IOTYPE {LVCMOS 1.8V} \
|
| 602 |
+
CONFIG.PCW_MIO_20_PULLUP {enabled} \
|
| 603 |
+
CONFIG.PCW_MIO_20_SLEW {slow} \
|
| 604 |
+
CONFIG.PCW_MIO_21_DIRECTION {inout} \
|
| 605 |
+
CONFIG.PCW_MIO_21_IOTYPE {LVCMOS 1.8V} \
|
| 606 |
+
CONFIG.PCW_MIO_21_PULLUP {enabled} \
|
| 607 |
+
CONFIG.PCW_MIO_21_SLEW {slow} \
|
| 608 |
+
CONFIG.PCW_MIO_22_DIRECTION {inout} \
|
| 609 |
+
CONFIG.PCW_MIO_22_IOTYPE {LVCMOS 1.8V} \
|
| 610 |
+
CONFIG.PCW_MIO_22_PULLUP {enabled} \
|
| 611 |
+
CONFIG.PCW_MIO_22_SLEW {slow} \
|
| 612 |
+
CONFIG.PCW_MIO_23_DIRECTION {inout} \
|
| 613 |
+
CONFIG.PCW_MIO_23_IOTYPE {LVCMOS 1.8V} \
|
| 614 |
+
CONFIG.PCW_MIO_23_PULLUP {enabled} \
|
| 615 |
+
CONFIG.PCW_MIO_23_SLEW {slow} \
|
| 616 |
+
CONFIG.PCW_MIO_24_DIRECTION {inout} \
|
| 617 |
+
CONFIG.PCW_MIO_24_IOTYPE {LVCMOS 1.8V} \
|
| 618 |
+
CONFIG.PCW_MIO_24_PULLUP {enabled} \
|
| 619 |
+
CONFIG.PCW_MIO_24_SLEW {slow} \
|
| 620 |
+
CONFIG.PCW_MIO_25_DIRECTION {inout} \
|
| 621 |
+
CONFIG.PCW_MIO_25_IOTYPE {LVCMOS 1.8V} \
|
| 622 |
+
CONFIG.PCW_MIO_25_PULLUP {enabled} \
|
| 623 |
+
CONFIG.PCW_MIO_25_SLEW {slow} \
|
| 624 |
+
CONFIG.PCW_MIO_26_DIRECTION {inout} \
|
| 625 |
+
CONFIG.PCW_MIO_26_IOTYPE {LVCMOS 1.8V} \
|
| 626 |
+
CONFIG.PCW_MIO_26_PULLUP {enabled} \
|
| 627 |
+
CONFIG.PCW_MIO_26_SLEW {slow} \
|
| 628 |
+
CONFIG.PCW_MIO_27_DIRECTION {inout} \
|
| 629 |
+
CONFIG.PCW_MIO_27_IOTYPE {LVCMOS 1.8V} \
|
| 630 |
+
CONFIG.PCW_MIO_27_PULLUP {enabled} \
|
| 631 |
+
CONFIG.PCW_MIO_27_SLEW {slow} \
|
| 632 |
+
CONFIG.PCW_MIO_28_DIRECTION {inout} \
|
| 633 |
+
CONFIG.PCW_MIO_28_IOTYPE {LVCMOS 1.8V} \
|
| 634 |
+
CONFIG.PCW_MIO_28_PULLUP {enabled} \
|
| 635 |
+
CONFIG.PCW_MIO_28_SLEW {slow} \
|
| 636 |
+
CONFIG.PCW_MIO_29_DIRECTION {in} \
|
| 637 |
+
CONFIG.PCW_MIO_29_IOTYPE {LVCMOS 1.8V} \
|
| 638 |
+
CONFIG.PCW_MIO_29_PULLUP {enabled} \
|
| 639 |
+
CONFIG.PCW_MIO_29_SLEW {slow} \
|
| 640 |
+
CONFIG.PCW_MIO_2_DIRECTION {inout} \
|
| 641 |
+
CONFIG.PCW_MIO_2_IOTYPE {LVCMOS 3.3V} \
|
| 642 |
+
CONFIG.PCW_MIO_2_PULLUP {disabled} \
|
| 643 |
+
CONFIG.PCW_MIO_2_SLEW {slow} \
|
| 644 |
+
CONFIG.PCW_MIO_30_DIRECTION {out} \
|
| 645 |
+
CONFIG.PCW_MIO_30_IOTYPE {LVCMOS 1.8V} \
|
| 646 |
+
CONFIG.PCW_MIO_30_PULLUP {enabled} \
|
| 647 |
+
CONFIG.PCW_MIO_30_SLEW {slow} \
|
| 648 |
+
CONFIG.PCW_MIO_31_DIRECTION {in} \
|
| 649 |
+
CONFIG.PCW_MIO_31_IOTYPE {LVCMOS 1.8V} \
|
| 650 |
+
CONFIG.PCW_MIO_31_PULLUP {enabled} \
|
| 651 |
+
CONFIG.PCW_MIO_31_SLEW {slow} \
|
| 652 |
+
CONFIG.PCW_MIO_32_DIRECTION {inout} \
|
| 653 |
+
CONFIG.PCW_MIO_32_IOTYPE {LVCMOS 1.8V} \
|
| 654 |
+
CONFIG.PCW_MIO_32_PULLUP {enabled} \
|
| 655 |
+
CONFIG.PCW_MIO_32_SLEW {slow} \
|
| 656 |
+
CONFIG.PCW_MIO_33_DIRECTION {inout} \
|
| 657 |
+
CONFIG.PCW_MIO_33_IOTYPE {LVCMOS 1.8V} \
|
| 658 |
+
CONFIG.PCW_MIO_33_PULLUP {enabled} \
|
| 659 |
+
CONFIG.PCW_MIO_33_SLEW {slow} \
|
| 660 |
+
CONFIG.PCW_MIO_34_DIRECTION {inout} \
|
| 661 |
+
CONFIG.PCW_MIO_34_IOTYPE {LVCMOS 1.8V} \
|
| 662 |
+
CONFIG.PCW_MIO_34_PULLUP {enabled} \
|
| 663 |
+
CONFIG.PCW_MIO_34_SLEW {slow} \
|
| 664 |
+
CONFIG.PCW_MIO_35_DIRECTION {inout} \
|
| 665 |
+
CONFIG.PCW_MIO_35_IOTYPE {LVCMOS 1.8V} \
|
| 666 |
+
CONFIG.PCW_MIO_35_PULLUP {enabled} \
|
| 667 |
+
CONFIG.PCW_MIO_35_SLEW {slow} \
|
| 668 |
+
CONFIG.PCW_MIO_36_DIRECTION {in} \
|
| 669 |
+
CONFIG.PCW_MIO_36_IOTYPE {LVCMOS 1.8V} \
|
| 670 |
+
CONFIG.PCW_MIO_36_PULLUP {enabled} \
|
| 671 |
+
CONFIG.PCW_MIO_36_SLEW {slow} \
|
| 672 |
+
CONFIG.PCW_MIO_37_DIRECTION {inout} \
|
| 673 |
+
CONFIG.PCW_MIO_37_IOTYPE {LVCMOS 1.8V} \
|
| 674 |
+
CONFIG.PCW_MIO_37_PULLUP {enabled} \
|
| 675 |
+
CONFIG.PCW_MIO_37_SLEW {slow} \
|
| 676 |
+
CONFIG.PCW_MIO_38_DIRECTION {inout} \
|
| 677 |
+
CONFIG.PCW_MIO_38_IOTYPE {LVCMOS 1.8V} \
|
| 678 |
+
CONFIG.PCW_MIO_38_PULLUP {enabled} \
|
| 679 |
+
CONFIG.PCW_MIO_38_SLEW {slow} \
|
| 680 |
+
CONFIG.PCW_MIO_39_DIRECTION {inout} \
|
| 681 |
+
CONFIG.PCW_MIO_39_IOTYPE {LVCMOS 1.8V} \
|
| 682 |
+
CONFIG.PCW_MIO_39_PULLUP {enabled} \
|
| 683 |
+
CONFIG.PCW_MIO_39_SLEW {slow} \
|
| 684 |
+
CONFIG.PCW_MIO_3_DIRECTION {inout} \
|
| 685 |
+
CONFIG.PCW_MIO_3_IOTYPE {LVCMOS 3.3V} \
|
| 686 |
+
CONFIG.PCW_MIO_3_PULLUP {disabled} \
|
| 687 |
+
CONFIG.PCW_MIO_3_SLEW {slow} \
|
| 688 |
+
CONFIG.PCW_MIO_40_DIRECTION {inout} \
|
| 689 |
+
CONFIG.PCW_MIO_40_IOTYPE {LVCMOS 1.8V} \
|
| 690 |
+
CONFIG.PCW_MIO_40_PULLUP {enabled} \
|
| 691 |
+
CONFIG.PCW_MIO_40_SLEW {slow} \
|
| 692 |
+
CONFIG.PCW_MIO_41_DIRECTION {inout} \
|
| 693 |
+
CONFIG.PCW_MIO_41_IOTYPE {LVCMOS 1.8V} \
|
| 694 |
+
CONFIG.PCW_MIO_41_PULLUP {enabled} \
|
| 695 |
+
CONFIG.PCW_MIO_41_SLEW {slow} \
|
| 696 |
+
CONFIG.PCW_MIO_42_DIRECTION {inout} \
|
| 697 |
+
CONFIG.PCW_MIO_42_IOTYPE {LVCMOS 1.8V} \
|
| 698 |
+
CONFIG.PCW_MIO_42_PULLUP {enabled} \
|
| 699 |
+
CONFIG.PCW_MIO_42_SLEW {slow} \
|
| 700 |
+
CONFIG.PCW_MIO_43_DIRECTION {inout} \
|
| 701 |
+
CONFIG.PCW_MIO_43_IOTYPE {LVCMOS 1.8V} \
|
| 702 |
+
CONFIG.PCW_MIO_43_PULLUP {enabled} \
|
| 703 |
+
CONFIG.PCW_MIO_43_SLEW {slow} \
|
| 704 |
+
CONFIG.PCW_MIO_44_DIRECTION {inout} \
|
| 705 |
+
CONFIG.PCW_MIO_44_IOTYPE {LVCMOS 1.8V} \
|
| 706 |
+
CONFIG.PCW_MIO_44_PULLUP {enabled} \
|
| 707 |
+
CONFIG.PCW_MIO_44_SLEW {slow} \
|
| 708 |
+
CONFIG.PCW_MIO_45_DIRECTION {inout} \
|
| 709 |
+
CONFIG.PCW_MIO_45_IOTYPE {LVCMOS 1.8V} \
|
| 710 |
+
CONFIG.PCW_MIO_45_PULLUP {enabled} \
|
| 711 |
+
CONFIG.PCW_MIO_45_SLEW {slow} \
|
| 712 |
+
CONFIG.PCW_MIO_46_DIRECTION {out} \
|
| 713 |
+
CONFIG.PCW_MIO_46_IOTYPE {LVCMOS 1.8V} \
|
| 714 |
+
CONFIG.PCW_MIO_46_PULLUP {enabled} \
|
| 715 |
+
CONFIG.PCW_MIO_46_SLEW {slow} \
|
| 716 |
+
CONFIG.PCW_MIO_47_DIRECTION {in} \
|
| 717 |
+
CONFIG.PCW_MIO_47_IOTYPE {LVCMOS 1.8V} \
|
| 718 |
+
CONFIG.PCW_MIO_47_PULLUP {enabled} \
|
| 719 |
+
CONFIG.PCW_MIO_47_SLEW {slow} \
|
| 720 |
+
CONFIG.PCW_MIO_48_DIRECTION {inout} \
|
| 721 |
+
CONFIG.PCW_MIO_48_IOTYPE {LVCMOS 1.8V} \
|
| 722 |
+
CONFIG.PCW_MIO_48_PULLUP {enabled} \
|
| 723 |
+
CONFIG.PCW_MIO_48_SLEW {slow} \
|
| 724 |
+
CONFIG.PCW_MIO_49_DIRECTION {inout} \
|
| 725 |
+
CONFIG.PCW_MIO_49_IOTYPE {LVCMOS 1.8V} \
|
| 726 |
+
CONFIG.PCW_MIO_49_PULLUP {enabled} \
|
| 727 |
+
CONFIG.PCW_MIO_49_SLEW {slow} \
|
| 728 |
+
CONFIG.PCW_MIO_4_DIRECTION {inout} \
|
| 729 |
+
CONFIG.PCW_MIO_4_IOTYPE {LVCMOS 3.3V} \
|
| 730 |
+
CONFIG.PCW_MIO_4_PULLUP {disabled} \
|
| 731 |
+
CONFIG.PCW_MIO_4_SLEW {slow} \
|
| 732 |
+
CONFIG.PCW_MIO_50_DIRECTION {inout} \
|
| 733 |
+
CONFIG.PCW_MIO_50_IOTYPE {LVCMOS 1.8V} \
|
| 734 |
+
CONFIG.PCW_MIO_50_PULLUP {enabled} \
|
| 735 |
+
CONFIG.PCW_MIO_50_SLEW {slow} \
|
| 736 |
+
CONFIG.PCW_MIO_51_DIRECTION {inout} \
|
| 737 |
+
CONFIG.PCW_MIO_51_IOTYPE {LVCMOS 1.8V} \
|
| 738 |
+
CONFIG.PCW_MIO_51_PULLUP {enabled} \
|
| 739 |
+
CONFIG.PCW_MIO_51_SLEW {slow} \
|
| 740 |
+
CONFIG.PCW_MIO_52_DIRECTION {inout} \
|
| 741 |
+
CONFIG.PCW_MIO_52_IOTYPE {LVCMOS 1.8V} \
|
| 742 |
+
CONFIG.PCW_MIO_52_PULLUP {enabled} \
|
| 743 |
+
CONFIG.PCW_MIO_52_SLEW {slow} \
|
| 744 |
+
CONFIG.PCW_MIO_53_DIRECTION {inout} \
|
| 745 |
+
CONFIG.PCW_MIO_53_IOTYPE {LVCMOS 1.8V} \
|
| 746 |
+
CONFIG.PCW_MIO_53_PULLUP {enabled} \
|
| 747 |
+
CONFIG.PCW_MIO_53_SLEW {slow} \
|
| 748 |
+
CONFIG.PCW_MIO_5_DIRECTION {inout} \
|
| 749 |
+
CONFIG.PCW_MIO_5_IOTYPE {LVCMOS 3.3V} \
|
| 750 |
+
CONFIG.PCW_MIO_5_PULLUP {disabled} \
|
| 751 |
+
CONFIG.PCW_MIO_5_SLEW {slow} \
|
| 752 |
+
CONFIG.PCW_MIO_6_DIRECTION {out} \
|
| 753 |
+
CONFIG.PCW_MIO_6_IOTYPE {LVCMOS 3.3V} \
|
| 754 |
+
CONFIG.PCW_MIO_6_PULLUP {disabled} \
|
| 755 |
+
CONFIG.PCW_MIO_6_SLEW {slow} \
|
| 756 |
+
CONFIG.PCW_MIO_7_DIRECTION {out} \
|
| 757 |
+
CONFIG.PCW_MIO_7_IOTYPE {LVCMOS 3.3V} \
|
| 758 |
+
CONFIG.PCW_MIO_7_PULLUP {disabled} \
|
| 759 |
+
CONFIG.PCW_MIO_7_SLEW {slow} \
|
| 760 |
+
CONFIG.PCW_MIO_8_DIRECTION {out} \
|
| 761 |
+
CONFIG.PCW_MIO_8_IOTYPE {LVCMOS 3.3V} \
|
| 762 |
+
CONFIG.PCW_MIO_8_PULLUP {disabled} \
|
| 763 |
+
CONFIG.PCW_MIO_8_SLEW {slow} \
|
| 764 |
+
CONFIG.PCW_MIO_9_DIRECTION {out} \
|
| 765 |
+
CONFIG.PCW_MIO_9_IOTYPE {LVCMOS 3.3V} \
|
| 766 |
+
CONFIG.PCW_MIO_9_PULLUP {enabled} \
|
| 767 |
+
CONFIG.PCW_MIO_9_SLEW {slow} \
|
| 768 |
+
CONFIG.PCW_MIO_PRIMITIVE {54} \
|
| 769 |
+
CONFIG.PCW_MIO_TREE_PERIPHERALS {GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#UART 0#UART 0#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#USB 0#SD 0#SD 0#SD 0#SD 0#SD 0#SD 0#USB Reset#SD 0#GPIO#GPIO#GPIO#GPIO#GPIO#GPIO} \
|
| 770 |
+
CONFIG.PCW_MIO_TREE_SIGNALS {gpio[0]#gpio[1]#gpio[2]#gpio[3]#gpio[4]#gpio[5]#gpio[6]#gpio[7]#gpio[8]#gpio[9]#gpio[10]#gpio[11]#gpio[12]#gpio[13]#rx#tx#gpio[16]#gpio[17]#gpio[18]#gpio[19]#gpio[20]#gpio[21]#gpio[22]#gpio[23]#gpio[24]#gpio[25]#gpio[26]#gpio[27]#data[4]#dir#stp#nxt#data[0]#data[1]#data[2]#data[3]#clk#data[5]#data[6]#data[7]#clk#cmd#data[0]#data[1]#data[2]#data[3]#reset#cd#gpio[48]#gpio[49]#gpio[50]#gpio[51]#gpio[52]#gpio[53]} \
|
| 771 |
+
CONFIG.PCW_M_AXI_GP0_ENABLE_STATIC_REMAP {0} \
|
| 772 |
+
CONFIG.PCW_M_AXI_GP0_ID_WIDTH {12} \
|
| 773 |
+
CONFIG.PCW_M_AXI_GP0_SUPPORT_NARROW_BURST {0} \
|
| 774 |
+
CONFIG.PCW_M_AXI_GP0_THREAD_ID_WIDTH {12} \
|
| 775 |
+
CONFIG.PCW_M_AXI_GP1_ENABLE_STATIC_REMAP {0} \
|
| 776 |
+
CONFIG.PCW_M_AXI_GP1_ID_WIDTH {12} \
|
| 777 |
+
CONFIG.PCW_M_AXI_GP1_SUPPORT_NARROW_BURST {0} \
|
| 778 |
+
CONFIG.PCW_M_AXI_GP1_THREAD_ID_WIDTH {12} \
|
| 779 |
+
CONFIG.PCW_NAND_CYCLES_T_AR {1} \
|
| 780 |
+
CONFIG.PCW_NAND_CYCLES_T_CLR {1} \
|
| 781 |
+
CONFIG.PCW_NAND_CYCLES_T_RC {11} \
|
| 782 |
+
CONFIG.PCW_NAND_CYCLES_T_REA {1} \
|
| 783 |
+
CONFIG.PCW_NAND_CYCLES_T_RR {1} \
|
| 784 |
+
CONFIG.PCW_NAND_CYCLES_T_WC {11} \
|
| 785 |
+
CONFIG.PCW_NAND_CYCLES_T_WP {1} \
|
| 786 |
+
CONFIG.PCW_NAND_GRP_D8_ENABLE {0} \
|
| 787 |
+
CONFIG.PCW_NAND_PERIPHERAL_ENABLE {0} \
|
| 788 |
+
CONFIG.PCW_NOR_CS0_T_CEOE {1} \
|
| 789 |
+
CONFIG.PCW_NOR_CS0_T_PC {1} \
|
| 790 |
+
CONFIG.PCW_NOR_CS0_T_RC {11} \
|
| 791 |
+
CONFIG.PCW_NOR_CS0_T_TR {1} \
|
| 792 |
+
CONFIG.PCW_NOR_CS0_T_WC {11} \
|
| 793 |
+
CONFIG.PCW_NOR_CS0_T_WP {1} \
|
| 794 |
+
CONFIG.PCW_NOR_CS0_WE_TIME {0} \
|
| 795 |
+
CONFIG.PCW_NOR_CS1_T_CEOE {1} \
|
| 796 |
+
CONFIG.PCW_NOR_CS1_T_PC {1} \
|
| 797 |
+
CONFIG.PCW_NOR_CS1_T_RC {11} \
|
| 798 |
+
CONFIG.PCW_NOR_CS1_T_TR {1} \
|
| 799 |
+
CONFIG.PCW_NOR_CS1_T_WC {11} \
|
| 800 |
+
CONFIG.PCW_NOR_CS1_T_WP {1} \
|
| 801 |
+
CONFIG.PCW_NOR_CS1_WE_TIME {0} \
|
| 802 |
+
CONFIG.PCW_NOR_GRP_A25_ENABLE {0} \
|
| 803 |
+
CONFIG.PCW_NOR_GRP_CS0_ENABLE {0} \
|
| 804 |
+
CONFIG.PCW_NOR_GRP_CS1_ENABLE {0} \
|
| 805 |
+
CONFIG.PCW_NOR_GRP_SRAM_CS0_ENABLE {0} \
|
| 806 |
+
CONFIG.PCW_NOR_GRP_SRAM_CS1_ENABLE {0} \
|
| 807 |
+
CONFIG.PCW_NOR_GRP_SRAM_INT_ENABLE {0} \
|
| 808 |
+
CONFIG.PCW_NOR_PERIPHERAL_ENABLE {0} \
|
| 809 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_CEOE {1} \
|
| 810 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_PC {1} \
|
| 811 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_RC {11} \
|
| 812 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_TR {1} \
|
| 813 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_WC {11} \
|
| 814 |
+
CONFIG.PCW_NOR_SRAM_CS0_T_WP {1} \
|
| 815 |
+
CONFIG.PCW_NOR_SRAM_CS0_WE_TIME {0} \
|
| 816 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_CEOE {1} \
|
| 817 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_PC {1} \
|
| 818 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_RC {11} \
|
| 819 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_TR {1} \
|
| 820 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_WC {11} \
|
| 821 |
+
CONFIG.PCW_NOR_SRAM_CS1_T_WP {1} \
|
| 822 |
+
CONFIG.PCW_NOR_SRAM_CS1_WE_TIME {0} \
|
| 823 |
+
CONFIG.PCW_OVERRIDE_BASIC_CLOCK {0} \
|
| 824 |
+
CONFIG.PCW_P2F_CAN0_INTR {0} \
|
| 825 |
+
CONFIG.PCW_P2F_CAN1_INTR {0} \
|
| 826 |
+
CONFIG.PCW_P2F_CTI_INTR {0} \
|
| 827 |
+
CONFIG.PCW_P2F_DMAC0_INTR {0} \
|
| 828 |
+
CONFIG.PCW_P2F_DMAC1_INTR {0} \
|
| 829 |
+
CONFIG.PCW_P2F_DMAC2_INTR {0} \
|
| 830 |
+
CONFIG.PCW_P2F_DMAC3_INTR {0} \
|
| 831 |
+
CONFIG.PCW_P2F_DMAC4_INTR {0} \
|
| 832 |
+
CONFIG.PCW_P2F_DMAC5_INTR {0} \
|
| 833 |
+
CONFIG.PCW_P2F_DMAC6_INTR {0} \
|
| 834 |
+
CONFIG.PCW_P2F_DMAC7_INTR {0} \
|
| 835 |
+
CONFIG.PCW_P2F_DMAC_ABORT_INTR {0} \
|
| 836 |
+
CONFIG.PCW_P2F_ENET0_INTR {0} \
|
| 837 |
+
CONFIG.PCW_P2F_ENET1_INTR {0} \
|
| 838 |
+
CONFIG.PCW_P2F_GPIO_INTR {0} \
|
| 839 |
+
CONFIG.PCW_P2F_I2C0_INTR {0} \
|
| 840 |
+
CONFIG.PCW_P2F_I2C1_INTR {0} \
|
| 841 |
+
CONFIG.PCW_P2F_QSPI_INTR {0} \
|
| 842 |
+
CONFIG.PCW_P2F_SDIO0_INTR {0} \
|
| 843 |
+
CONFIG.PCW_P2F_SDIO1_INTR {0} \
|
| 844 |
+
CONFIG.PCW_P2F_SMC_INTR {0} \
|
| 845 |
+
CONFIG.PCW_P2F_SPI0_INTR {0} \
|
| 846 |
+
CONFIG.PCW_P2F_SPI1_INTR {0} \
|
| 847 |
+
CONFIG.PCW_P2F_UART0_INTR {0} \
|
| 848 |
+
CONFIG.PCW_P2F_UART1_INTR {0} \
|
| 849 |
+
CONFIG.PCW_P2F_USB0_INTR {0} \
|
| 850 |
+
CONFIG.PCW_P2F_USB1_INTR {0} \
|
| 851 |
+
CONFIG.PCW_PACKAGE_DDR_BOARD_DELAY0 {0.223} \
|
| 852 |
+
CONFIG.PCW_PACKAGE_DDR_BOARD_DELAY1 {0.212} \
|
| 853 |
+
CONFIG.PCW_PACKAGE_DDR_BOARD_DELAY2 {0.085} \
|
| 854 |
+
CONFIG.PCW_PACKAGE_DDR_BOARD_DELAY3 {0.092} \
|
| 855 |
+
CONFIG.PCW_PACKAGE_DDR_DQS_TO_CLK_DELAY_0 {0.040} \
|
| 856 |
+
CONFIG.PCW_PACKAGE_DDR_DQS_TO_CLK_DELAY_1 {0.058} \
|
| 857 |
+
CONFIG.PCW_PACKAGE_DDR_DQS_TO_CLK_DELAY_2 {-0.009} \
|
| 858 |
+
CONFIG.PCW_PACKAGE_DDR_DQS_TO_CLK_DELAY_3 {-0.033} \
|
| 859 |
+
CONFIG.PCW_PACKAGE_NAME {clg400} \
|
| 860 |
+
CONFIG.PCW_PCAP_PERIPHERAL_CLKSRC {IO PLL} \
|
| 861 |
+
CONFIG.PCW_PCAP_PERIPHERAL_DIVISOR0 {8} \
|
| 862 |
+
CONFIG.PCW_PCAP_PERIPHERAL_FREQMHZ {200} \
|
| 863 |
+
CONFIG.PCW_PERIPHERAL_BOARD_PRESET {part0} \
|
| 864 |
+
CONFIG.PCW_PLL_BYPASSMODE_ENABLE {0} \
|
| 865 |
+
CONFIG.PCW_PRESET_BANK0_VOLTAGE {LVCMOS 3.3V} \
|
| 866 |
+
CONFIG.PCW_PRESET_BANK1_VOLTAGE {LVCMOS 1.8V} \
|
| 867 |
+
CONFIG.PCW_PS7_SI_REV {PRODUCTION} \
|
| 868 |
+
CONFIG.PCW_QSPI_GRP_FBCLK_ENABLE {0} \
|
| 869 |
+
CONFIG.PCW_QSPI_GRP_FBCLK_IO {<Select>} \
|
| 870 |
+
CONFIG.PCW_QSPI_GRP_IO1_ENABLE {0} \
|
| 871 |
+
CONFIG.PCW_QSPI_GRP_SINGLE_SS_ENABLE {0} \
|
| 872 |
+
CONFIG.PCW_QSPI_GRP_SINGLE_SS_IO {<Select>} \
|
| 873 |
+
CONFIG.PCW_QSPI_GRP_SS1_ENABLE {0} \
|
| 874 |
+
CONFIG.PCW_QSPI_INTERNAL_HIGHADDRESS {0xFCFFFFFF} \
|
| 875 |
+
CONFIG.PCW_QSPI_PERIPHERAL_CLKSRC {IO PLL} \
|
| 876 |
+
CONFIG.PCW_QSPI_PERIPHERAL_DIVISOR0 {1} \
|
| 877 |
+
CONFIG.PCW_QSPI_PERIPHERAL_ENABLE {0} \
|
| 878 |
+
CONFIG.PCW_QSPI_PERIPHERAL_FREQMHZ {200} \
|
| 879 |
+
CONFIG.PCW_QSPI_QSPI_IO {<Select>} \
|
| 880 |
+
CONFIG.PCW_SD0_GRP_CD_ENABLE {1} \
|
| 881 |
+
CONFIG.PCW_SD0_GRP_CD_IO {MIO 47} \
|
| 882 |
+
CONFIG.PCW_SD0_GRP_POW_ENABLE {0} \
|
| 883 |
+
CONFIG.PCW_SD0_GRP_WP_ENABLE {0} \
|
| 884 |
+
CONFIG.PCW_SD0_PERIPHERAL_ENABLE {1} \
|
| 885 |
+
CONFIG.PCW_SD0_SD0_IO {MIO 40 .. 45} \
|
| 886 |
+
CONFIG.PCW_SD1_GRP_CD_ENABLE {0} \
|
| 887 |
+
CONFIG.PCW_SD1_GRP_POW_ENABLE {0} \
|
| 888 |
+
CONFIG.PCW_SD1_GRP_WP_ENABLE {0} \
|
| 889 |
+
CONFIG.PCW_SD1_PERIPHERAL_ENABLE {0} \
|
| 890 |
+
CONFIG.PCW_SDIO0_BASEADDR {0xE0100000} \
|
| 891 |
+
CONFIG.PCW_SDIO0_HIGHADDR {0xE0100FFF} \
|
| 892 |
+
CONFIG.PCW_SDIO1_BASEADDR {0xE0101000} \
|
| 893 |
+
CONFIG.PCW_SDIO1_HIGHADDR {0xE0101FFF} \
|
| 894 |
+
CONFIG.PCW_SDIO_PERIPHERAL_CLKSRC {IO PLL} \
|
| 895 |
+
CONFIG.PCW_SDIO_PERIPHERAL_DIVISOR0 {32} \
|
| 896 |
+
CONFIG.PCW_SDIO_PERIPHERAL_FREQMHZ {50} \
|
| 897 |
+
CONFIG.PCW_SDIO_PERIPHERAL_VALID {1} \
|
| 898 |
+
CONFIG.PCW_SINGLE_QSPI_DATA_MODE {<Select>} \
|
| 899 |
+
CONFIG.PCW_SMC_CYCLE_T0 {NA} \
|
| 900 |
+
CONFIG.PCW_SMC_CYCLE_T1 {NA} \
|
| 901 |
+
CONFIG.PCW_SMC_CYCLE_T2 {NA} \
|
| 902 |
+
CONFIG.PCW_SMC_CYCLE_T3 {NA} \
|
| 903 |
+
CONFIG.PCW_SMC_CYCLE_T4 {NA} \
|
| 904 |
+
CONFIG.PCW_SMC_CYCLE_T5 {NA} \
|
| 905 |
+
CONFIG.PCW_SMC_CYCLE_T6 {NA} \
|
| 906 |
+
CONFIG.PCW_SMC_PERIPHERAL_CLKSRC {IO PLL} \
|
| 907 |
+
CONFIG.PCW_SMC_PERIPHERAL_DIVISOR0 {1} \
|
| 908 |
+
CONFIG.PCW_SMC_PERIPHERAL_FREQMHZ {100} \
|
| 909 |
+
CONFIG.PCW_SMC_PERIPHERAL_VALID {0} \
|
| 910 |
+
CONFIG.PCW_SPI0_BASEADDR {0xE0006000} \
|
| 911 |
+
CONFIG.PCW_SPI0_GRP_SS0_ENABLE {0} \
|
| 912 |
+
CONFIG.PCW_SPI0_GRP_SS1_ENABLE {0} \
|
| 913 |
+
CONFIG.PCW_SPI0_GRP_SS2_ENABLE {0} \
|
| 914 |
+
CONFIG.PCW_SPI0_HIGHADDR {0xE0006FFF} \
|
| 915 |
+
CONFIG.PCW_SPI0_PERIPHERAL_ENABLE {0} \
|
| 916 |
+
CONFIG.PCW_SPI1_BASEADDR {0xE0007000} \
|
| 917 |
+
CONFIG.PCW_SPI1_GRP_SS0_ENABLE {0} \
|
| 918 |
+
CONFIG.PCW_SPI1_GRP_SS1_ENABLE {0} \
|
| 919 |
+
CONFIG.PCW_SPI1_GRP_SS2_ENABLE {0} \
|
| 920 |
+
CONFIG.PCW_SPI1_HIGHADDR {0xE0007FFF} \
|
| 921 |
+
CONFIG.PCW_SPI1_PERIPHERAL_ENABLE {0} \
|
| 922 |
+
CONFIG.PCW_SPI_PERIPHERAL_CLKSRC {IO PLL} \
|
| 923 |
+
CONFIG.PCW_SPI_PERIPHERAL_DIVISOR0 {1} \
|
| 924 |
+
CONFIG.PCW_SPI_PERIPHERAL_FREQMHZ {166.666666} \
|
| 925 |
+
CONFIG.PCW_SPI_PERIPHERAL_VALID {0} \
|
| 926 |
+
CONFIG.PCW_S_AXI_ACP_ARUSER_VAL {31} \
|
| 927 |
+
CONFIG.PCW_S_AXI_ACP_AWUSER_VAL {31} \
|
| 928 |
+
CONFIG.PCW_S_AXI_ACP_ID_WIDTH {3} \
|
| 929 |
+
CONFIG.PCW_S_AXI_GP0_ID_WIDTH {6} \
|
| 930 |
+
CONFIG.PCW_S_AXI_GP1_ID_WIDTH {6} \
|
| 931 |
+
CONFIG.PCW_S_AXI_HP0_DATA_WIDTH {64} \
|
| 932 |
+
CONFIG.PCW_S_AXI_HP0_ID_WIDTH {6} \
|
| 933 |
+
CONFIG.PCW_S_AXI_HP1_DATA_WIDTH {64} \
|
| 934 |
+
CONFIG.PCW_S_AXI_HP1_ID_WIDTH {6} \
|
| 935 |
+
CONFIG.PCW_S_AXI_HP2_DATA_WIDTH {64} \
|
| 936 |
+
CONFIG.PCW_S_AXI_HP2_ID_WIDTH {6} \
|
| 937 |
+
CONFIG.PCW_S_AXI_HP3_DATA_WIDTH {64} \
|
| 938 |
+
CONFIG.PCW_S_AXI_HP3_ID_WIDTH {6} \
|
| 939 |
+
CONFIG.PCW_TPIU_PERIPHERAL_CLKSRC {External} \
|
| 940 |
+
CONFIG.PCW_TPIU_PERIPHERAL_DIVISOR0 {1} \
|
| 941 |
+
CONFIG.PCW_TPIU_PERIPHERAL_FREQMHZ {200} \
|
| 942 |
+
CONFIG.PCW_TRACE_BUFFER_CLOCK_DELAY {12} \
|
| 943 |
+
CONFIG.PCW_TRACE_BUFFER_FIFO_SIZE {128} \
|
| 944 |
+
CONFIG.PCW_TRACE_PIPELINE_WIDTH {8} \
|
| 945 |
+
CONFIG.PCW_TTC0_BASEADDR {0xE0104000} \
|
| 946 |
+
CONFIG.PCW_TTC0_CLK0_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 947 |
+
CONFIG.PCW_TTC0_CLK0_PERIPHERAL_DIVISOR0 {1} \
|
| 948 |
+
CONFIG.PCW_TTC0_CLK0_PERIPHERAL_FREQMHZ {133.333333} \
|
| 949 |
+
CONFIG.PCW_TTC0_CLK1_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 950 |
+
CONFIG.PCW_TTC0_CLK1_PERIPHERAL_DIVISOR0 {1} \
|
| 951 |
+
CONFIG.PCW_TTC0_CLK1_PERIPHERAL_FREQMHZ {133.333333} \
|
| 952 |
+
CONFIG.PCW_TTC0_CLK2_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 953 |
+
CONFIG.PCW_TTC0_CLK2_PERIPHERAL_DIVISOR0 {1} \
|
| 954 |
+
CONFIG.PCW_TTC0_CLK2_PERIPHERAL_FREQMHZ {133.333333} \
|
| 955 |
+
CONFIG.PCW_TTC0_HIGHADDR {0xE0104fff} \
|
| 956 |
+
CONFIG.PCW_TTC1_BASEADDR {0xE0105000} \
|
| 957 |
+
CONFIG.PCW_TTC1_CLK0_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 958 |
+
CONFIG.PCW_TTC1_CLK0_PERIPHERAL_DIVISOR0 {1} \
|
| 959 |
+
CONFIG.PCW_TTC1_CLK0_PERIPHERAL_FREQMHZ {133.333333} \
|
| 960 |
+
CONFIG.PCW_TTC1_CLK1_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 961 |
+
CONFIG.PCW_TTC1_CLK1_PERIPHERAL_DIVISOR0 {1} \
|
| 962 |
+
CONFIG.PCW_TTC1_CLK1_PERIPHERAL_FREQMHZ {133.333333} \
|
| 963 |
+
CONFIG.PCW_TTC1_CLK2_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 964 |
+
CONFIG.PCW_TTC1_CLK2_PERIPHERAL_DIVISOR0 {1} \
|
| 965 |
+
CONFIG.PCW_TTC1_CLK2_PERIPHERAL_FREQMHZ {133.333333} \
|
| 966 |
+
CONFIG.PCW_TTC1_HIGHADDR {0xE0105fff} \
|
| 967 |
+
CONFIG.PCW_TTC_PERIPHERAL_FREQMHZ {50} \
|
| 968 |
+
CONFIG.PCW_UART0_BASEADDR {0xE0000000} \
|
| 969 |
+
CONFIG.PCW_UART0_BAUD_RATE {115200} \
|
| 970 |
+
CONFIG.PCW_UART0_GRP_FULL_ENABLE {0} \
|
| 971 |
+
CONFIG.PCW_UART0_HIGHADDR {0xE0000FFF} \
|
| 972 |
+
CONFIG.PCW_UART0_PERIPHERAL_ENABLE {1} \
|
| 973 |
+
CONFIG.PCW_UART0_UART0_IO {MIO 14 .. 15} \
|
| 974 |
+
CONFIG.PCW_UART1_BASEADDR {0xE0001000} \
|
| 975 |
+
CONFIG.PCW_UART1_BAUD_RATE {115200} \
|
| 976 |
+
CONFIG.PCW_UART1_GRP_FULL_ENABLE {0} \
|
| 977 |
+
CONFIG.PCW_UART1_HIGHADDR {0xE0001FFF} \
|
| 978 |
+
CONFIG.PCW_UART1_PERIPHERAL_ENABLE {0} \
|
| 979 |
+
CONFIG.PCW_UART_PERIPHERAL_CLKSRC {IO PLL} \
|
| 980 |
+
CONFIG.PCW_UART_PERIPHERAL_DIVISOR0 {16} \
|
| 981 |
+
CONFIG.PCW_UART_PERIPHERAL_FREQMHZ {100} \
|
| 982 |
+
CONFIG.PCW_UART_PERIPHERAL_VALID {1} \
|
| 983 |
+
CONFIG.PCW_UIPARAM_ACT_DDR_FREQ_MHZ {525.000000} \
|
| 984 |
+
CONFIG.PCW_UIPARAM_DDR_ADV_ENABLE {0} \
|
| 985 |
+
CONFIG.PCW_UIPARAM_DDR_AL {0} \
|
| 986 |
+
CONFIG.PCW_UIPARAM_DDR_BANK_ADDR_COUNT {3} \
|
| 987 |
+
CONFIG.PCW_UIPARAM_DDR_BL {8} \
|
| 988 |
+
CONFIG.PCW_UIPARAM_DDR_BOARD_DELAY0 {0.223} \
|
| 989 |
+
CONFIG.PCW_UIPARAM_DDR_BOARD_DELAY1 {0.212} \
|
| 990 |
+
CONFIG.PCW_UIPARAM_DDR_BOARD_DELAY2 {0.085} \
|
| 991 |
+
CONFIG.PCW_UIPARAM_DDR_BOARD_DELAY3 {0.092} \
|
| 992 |
+
CONFIG.PCW_UIPARAM_DDR_BUS_WIDTH {16 Bit} \
|
| 993 |
+
CONFIG.PCW_UIPARAM_DDR_CL {7} \
|
| 994 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_0_LENGTH_MM {25.8} \
|
| 995 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_0_PACKAGE_LENGTH {80.4535} \
|
| 996 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_0_PROPOGATION_DELAY {160} \
|
| 997 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_1_LENGTH_MM {25.8} \
|
| 998 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_1_PACKAGE_LENGTH {80.4535} \
|
| 999 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_1_PROPOGATION_DELAY {160} \
|
| 1000 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_2_LENGTH_MM {0} \
|
| 1001 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_2_PACKAGE_LENGTH {80.4535} \
|
| 1002 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_2_PROPOGATION_DELAY {160} \
|
| 1003 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_3_LENGTH_MM {0} \
|
| 1004 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_3_PACKAGE_LENGTH {80.4535} \
|
| 1005 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_3_PROPOGATION_DELAY {160} \
|
| 1006 |
+
CONFIG.PCW_UIPARAM_DDR_CLOCK_STOP_EN {0} \
|
| 1007 |
+
CONFIG.PCW_UIPARAM_DDR_COL_ADDR_COUNT {10} \
|
| 1008 |
+
CONFIG.PCW_UIPARAM_DDR_CWL {6} \
|
| 1009 |
+
CONFIG.PCW_UIPARAM_DDR_DEVICE_CAPACITY {4096 MBits} \
|
| 1010 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_0_LENGTH_MM {15.6} \
|
| 1011 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_0_PACKAGE_LENGTH {105.056} \
|
| 1012 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_0_PROPOGATION_DELAY {160} \
|
| 1013 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_1_LENGTH_MM {18.8} \
|
| 1014 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_1_PACKAGE_LENGTH {66.904} \
|
| 1015 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_1_PROPOGATION_DELAY {160} \
|
| 1016 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_2_LENGTH_MM {0} \
|
| 1017 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_2_PACKAGE_LENGTH {89.1715} \
|
| 1018 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_2_PROPOGATION_DELAY {160} \
|
| 1019 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_3_LENGTH_MM {0} \
|
| 1020 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_3_PACKAGE_LENGTH {113.63} \
|
| 1021 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_3_PROPOGATION_DELAY {160} \
|
| 1022 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_TO_CLK_DELAY_0 {0.040} \
|
| 1023 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_TO_CLK_DELAY_1 {0.058} \
|
| 1024 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_TO_CLK_DELAY_2 {-0.009} \
|
| 1025 |
+
CONFIG.PCW_UIPARAM_DDR_DQS_TO_CLK_DELAY_3 {-0.033} \
|
| 1026 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_0_LENGTH_MM {16.5} \
|
| 1027 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_0_PACKAGE_LENGTH {98.503} \
|
| 1028 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_0_PROPOGATION_DELAY {160} \
|
| 1029 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_1_LENGTH_MM {18} \
|
| 1030 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_1_PACKAGE_LENGTH {68.5855} \
|
| 1031 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_1_PROPOGATION_DELAY {160} \
|
| 1032 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_2_LENGTH_MM {0} \
|
| 1033 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_2_PACKAGE_LENGTH {90.295} \
|
| 1034 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_2_PROPOGATION_DELAY {160} \
|
| 1035 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_3_LENGTH_MM {0} \
|
| 1036 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_3_PACKAGE_LENGTH {103.977} \
|
| 1037 |
+
CONFIG.PCW_UIPARAM_DDR_DQ_3_PROPOGATION_DELAY {160} \
|
| 1038 |
+
CONFIG.PCW_UIPARAM_DDR_DRAM_WIDTH {16 Bits} \
|
| 1039 |
+
CONFIG.PCW_UIPARAM_DDR_ECC {Disabled} \
|
| 1040 |
+
CONFIG.PCW_UIPARAM_DDR_ENABLE {1} \
|
| 1041 |
+
CONFIG.PCW_UIPARAM_DDR_FREQ_MHZ {525} \
|
| 1042 |
+
CONFIG.PCW_UIPARAM_DDR_HIGH_TEMP {Normal (0-85)} \
|
| 1043 |
+
CONFIG.PCW_UIPARAM_DDR_MEMORY_TYPE {DDR 3} \
|
| 1044 |
+
CONFIG.PCW_UIPARAM_DDR_PARTNO {MT41J256M16 RE-125} \
|
| 1045 |
+
CONFIG.PCW_UIPARAM_DDR_ROW_ADDR_COUNT {15} \
|
| 1046 |
+
CONFIG.PCW_UIPARAM_DDR_SPEED_BIN {DDR3_1066F} \
|
| 1047 |
+
CONFIG.PCW_UIPARAM_DDR_TRAIN_DATA_EYE {1} \
|
| 1048 |
+
CONFIG.PCW_UIPARAM_DDR_TRAIN_READ_GATE {1} \
|
| 1049 |
+
CONFIG.PCW_UIPARAM_DDR_TRAIN_WRITE_LEVEL {1} \
|
| 1050 |
+
CONFIG.PCW_UIPARAM_DDR_T_FAW {40.0} \
|
| 1051 |
+
CONFIG.PCW_UIPARAM_DDR_T_RAS_MIN {35.0} \
|
| 1052 |
+
CONFIG.PCW_UIPARAM_DDR_T_RC {48.91} \
|
| 1053 |
+
CONFIG.PCW_UIPARAM_DDR_T_RCD {7} \
|
| 1054 |
+
CONFIG.PCW_UIPARAM_DDR_T_RP {7} \
|
| 1055 |
+
CONFIG.PCW_UIPARAM_DDR_USE_INTERNAL_VREF {0} \
|
| 1056 |
+
CONFIG.PCW_UIPARAM_GENERATE_SUMMARY {NA} \
|
| 1057 |
+
CONFIG.PCW_USB0_BASEADDR {0xE0102000} \
|
| 1058 |
+
CONFIG.PCW_USB0_HIGHADDR {0xE0102fff} \
|
| 1059 |
+
CONFIG.PCW_USB0_PERIPHERAL_ENABLE {1} \
|
| 1060 |
+
CONFIG.PCW_USB0_PERIPHERAL_FREQMHZ {60} \
|
| 1061 |
+
CONFIG.PCW_USB0_RESET_ENABLE {1} \
|
| 1062 |
+
CONFIG.PCW_USB0_RESET_IO {MIO 46} \
|
| 1063 |
+
CONFIG.PCW_USB0_USB0_IO {MIO 28 .. 39} \
|
| 1064 |
+
CONFIG.PCW_USB1_BASEADDR {0xE0103000} \
|
| 1065 |
+
CONFIG.PCW_USB1_HIGHADDR {0xE0103fff} \
|
| 1066 |
+
CONFIG.PCW_USB1_PERIPHERAL_ENABLE {0} \
|
| 1067 |
+
CONFIG.PCW_USB1_PERIPHERAL_FREQMHZ {60} \
|
| 1068 |
+
CONFIG.PCW_USB1_RESET_ENABLE {0} \
|
| 1069 |
+
CONFIG.PCW_USB_RESET_ENABLE {1} \
|
| 1070 |
+
CONFIG.PCW_USB_RESET_POLARITY {Active Low} \
|
| 1071 |
+
CONFIG.PCW_USB_RESET_SELECT {Share reset pin} \
|
| 1072 |
+
CONFIG.PCW_USE_AXI_FABRIC_IDLE {0} \
|
| 1073 |
+
CONFIG.PCW_USE_AXI_NONSECURE {0} \
|
| 1074 |
+
CONFIG.PCW_USE_CORESIGHT {0} \
|
| 1075 |
+
CONFIG.PCW_USE_CROSS_TRIGGER {0} \
|
| 1076 |
+
CONFIG.PCW_USE_CR_FABRIC {1} \
|
| 1077 |
+
CONFIG.PCW_USE_DDR_BYPASS {0} \
|
| 1078 |
+
CONFIG.PCW_USE_DEBUG {0} \
|
| 1079 |
+
CONFIG.PCW_USE_DEFAULT_ACP_USER_VAL {0} \
|
| 1080 |
+
CONFIG.PCW_USE_DMA0 {0} \
|
| 1081 |
+
CONFIG.PCW_USE_DMA1 {0} \
|
| 1082 |
+
CONFIG.PCW_USE_DMA2 {0} \
|
| 1083 |
+
CONFIG.PCW_USE_DMA3 {0} \
|
| 1084 |
+
CONFIG.PCW_USE_EXPANDED_IOP {0} \
|
| 1085 |
+
CONFIG.PCW_USE_EXPANDED_PS_SLCR_REGISTERS {0} \
|
| 1086 |
+
CONFIG.PCW_USE_FABRIC_INTERRUPT {0} \
|
| 1087 |
+
CONFIG.PCW_USE_HIGH_OCM {0} \
|
| 1088 |
+
CONFIG.PCW_USE_M_AXI_GP0 {1} \
|
| 1089 |
+
CONFIG.PCW_USE_M_AXI_GP1 {0} \
|
| 1090 |
+
CONFIG.PCW_USE_PROC_EVENT_BUS {0} \
|
| 1091 |
+
CONFIG.PCW_USE_PS_SLCR_REGISTERS {0} \
|
| 1092 |
+
CONFIG.PCW_USE_S_AXI_ACP {0} \
|
| 1093 |
+
CONFIG.PCW_USE_S_AXI_GP0 {0} \
|
| 1094 |
+
CONFIG.PCW_USE_S_AXI_GP1 {0} \
|
| 1095 |
+
CONFIG.PCW_USE_S_AXI_HP0 {1} \
|
| 1096 |
+
CONFIG.PCW_USE_S_AXI_HP1 {1} \
|
| 1097 |
+
CONFIG.PCW_USE_S_AXI_HP2 {1} \
|
| 1098 |
+
CONFIG.PCW_USE_S_AXI_HP3 {0} \
|
| 1099 |
+
CONFIG.PCW_USE_TRACE {0} \
|
| 1100 |
+
CONFIG.PCW_USE_TRACE_DATA_EDGE_DETECTOR {0} \
|
| 1101 |
+
CONFIG.PCW_VALUE_SILVERSION {3} \
|
| 1102 |
+
CONFIG.PCW_WDT_PERIPHERAL_CLKSRC {CPU_1X} \
|
| 1103 |
+
CONFIG.PCW_WDT_PERIPHERAL_DIVISOR0 {1} \
|
| 1104 |
+
CONFIG.PCW_WDT_PERIPHERAL_FREQMHZ {133.333333} \
|
| 1105 |
+
] $processing_system7_0
|
| 1106 |
+
|
| 1107 |
+
# Create instance: ps7_0_axi_periph, and set properties
|
| 1108 |
+
set ps7_0_axi_periph [ create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 ps7_0_axi_periph ]
|
| 1109 |
+
set_property -dict [ list \
|
| 1110 |
+
CONFIG.NUM_MI {4} \
|
| 1111 |
+
] $ps7_0_axi_periph
|
| 1112 |
+
|
| 1113 |
+
# Create instance: rst_ps7_0_100M, and set properties
|
| 1114 |
+
set rst_ps7_0_100M [ create_bd_cell -type ip -vlnv xilinx.com:ip:proc_sys_reset:5.0 rst_ps7_0_100M ]
|
| 1115 |
+
|
| 1116 |
+
# Create interface connections
|
| 1117 |
+
connect_bd_intf_net -intf_net MM_ultra_top_0_m0_axis [get_bd_intf_pins MM_ultra_top_0/m0_axis] [get_bd_intf_pins axis_dwidth_converter_2/S_AXIS]
|
| 1118 |
+
connect_bd_intf_net -intf_net axi_dma_0_M_AXIS_MM2S [get_bd_intf_pins axi_dma_0/M_AXIS_MM2S] [get_bd_intf_pins axis_dwidth_converter_0/S_AXIS]
|
| 1119 |
+
connect_bd_intf_net -intf_net axi_dma_0_M_AXI_MM2S [get_bd_intf_pins axi_dma_0/M_AXI_MM2S] [get_bd_intf_pins axi_smc/S00_AXI]
|
| 1120 |
+
connect_bd_intf_net -intf_net axi_dma_1_M_AXIS_MM2S [get_bd_intf_pins axi_dma_1/M_AXIS_MM2S] [get_bd_intf_pins axis_dwidth_converter_1/S_AXIS]
|
| 1121 |
+
connect_bd_intf_net -intf_net axi_dma_1_M_AXI_MM2S [get_bd_intf_pins axi_dma_1/M_AXI_MM2S] [get_bd_intf_pins axi_smc_1/S00_AXI]
|
| 1122 |
+
connect_bd_intf_net -intf_net axi_dma_2_M_AXI_S2MM [get_bd_intf_pins axi_dma_2/M_AXI_S2MM] [get_bd_intf_pins axi_smc_2/S00_AXI]
|
| 1123 |
+
connect_bd_intf_net -intf_net axi_smc_1_M00_AXI [get_bd_intf_pins axi_smc_1/M00_AXI] [get_bd_intf_pins processing_system7_0/S_AXI_HP1]
|
| 1124 |
+
connect_bd_intf_net -intf_net axi_smc_2_M00_AXI [get_bd_intf_pins axi_smc_2/M00_AXI] [get_bd_intf_pins processing_system7_0/S_AXI_HP2]
|
| 1125 |
+
connect_bd_intf_net -intf_net axi_smc_M00_AXI [get_bd_intf_pins axi_smc/M00_AXI] [get_bd_intf_pins processing_system7_0/S_AXI_HP0]
|
| 1126 |
+
connect_bd_intf_net -intf_net axis_dwidth_converter_0_M_AXIS [get_bd_intf_pins MM_ultra_top_0/s0_axis] [get_bd_intf_pins axis_dwidth_converter_0/M_AXIS]
|
| 1127 |
+
connect_bd_intf_net -intf_net axis_dwidth_converter_1_M_AXIS [get_bd_intf_pins MM_ultra_top_0/s1_axis] [get_bd_intf_pins axis_dwidth_converter_1/M_AXIS]
|
| 1128 |
+
connect_bd_intf_net -intf_net axis_dwidth_converter_2_M_AXIS [get_bd_intf_pins axi_dma_2/S_AXIS_S2MM] [get_bd_intf_pins axis_dwidth_converter_2/M_AXIS]
|
| 1129 |
+
connect_bd_intf_net -intf_net processing_system7_0_DDR [get_bd_intf_ports DDR] [get_bd_intf_pins processing_system7_0/DDR]
|
| 1130 |
+
connect_bd_intf_net -intf_net processing_system7_0_FIXED_IO [get_bd_intf_ports FIXED_IO] [get_bd_intf_pins processing_system7_0/FIXED_IO]
|
| 1131 |
+
connect_bd_intf_net -intf_net processing_system7_0_M_AXI_GP0 [get_bd_intf_pins processing_system7_0/M_AXI_GP0] [get_bd_intf_pins ps7_0_axi_periph/S00_AXI]
|
| 1132 |
+
connect_bd_intf_net -intf_net ps7_0_axi_periph_M00_AXI [get_bd_intf_pins MM_ultra_top_0/s00_axi] [get_bd_intf_pins ps7_0_axi_periph/M00_AXI]
|
| 1133 |
+
connect_bd_intf_net -intf_net ps7_0_axi_periph_M01_AXI [get_bd_intf_pins axi_dma_0/S_AXI_LITE] [get_bd_intf_pins ps7_0_axi_periph/M01_AXI]
|
| 1134 |
+
connect_bd_intf_net -intf_net ps7_0_axi_periph_M02_AXI [get_bd_intf_pins axi_dma_1/S_AXI_LITE] [get_bd_intf_pins ps7_0_axi_periph/M02_AXI]
|
| 1135 |
+
connect_bd_intf_net -intf_net ps7_0_axi_periph_M03_AXI [get_bd_intf_pins axi_dma_2/S_AXI_LITE] [get_bd_intf_pins ps7_0_axi_periph/M03_AXI]
|
| 1136 |
+
|
| 1137 |
+
# Create port connections
|
| 1138 |
+
connect_bd_net -net processing_system7_0_FCLK_CLK0 [get_bd_pins MM_ultra_top_0/aclk] [get_bd_pins axi_dma_0/m_axi_mm2s_aclk] [get_bd_pins axi_dma_0/s_axi_lite_aclk] [get_bd_pins axi_dma_1/m_axi_mm2s_aclk] [get_bd_pins axi_dma_1/s_axi_lite_aclk] [get_bd_pins axi_dma_2/m_axi_s2mm_aclk] [get_bd_pins axi_dma_2/s_axi_lite_aclk] [get_bd_pins axi_smc/aclk] [get_bd_pins axi_smc_1/aclk] [get_bd_pins axi_smc_2/aclk] [get_bd_pins axis_dwidth_converter_0/aclk] [get_bd_pins axis_dwidth_converter_1/aclk] [get_bd_pins axis_dwidth_converter_2/aclk] [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins processing_system7_0/M_AXI_GP0_ACLK] [get_bd_pins processing_system7_0/S_AXI_HP0_ACLK] [get_bd_pins processing_system7_0/S_AXI_HP1_ACLK] [get_bd_pins processing_system7_0/S_AXI_HP2_ACLK] [get_bd_pins ps7_0_axi_periph/ACLK] [get_bd_pins ps7_0_axi_periph/M00_ACLK] [get_bd_pins ps7_0_axi_periph/M01_ACLK] [get_bd_pins ps7_0_axi_periph/M02_ACLK] [get_bd_pins ps7_0_axi_periph/M03_ACLK] [get_bd_pins ps7_0_axi_periph/S00_ACLK] [get_bd_pins rst_ps7_0_100M/slowest_sync_clk]
|
| 1139 |
+
connect_bd_net -net processing_system7_0_FCLK_RESET0_N [get_bd_pins processing_system7_0/FCLK_RESET0_N] [get_bd_pins rst_ps7_0_100M/ext_reset_in]
|
| 1140 |
+
connect_bd_net -net rst_ps7_0_100M_peripheral_aresetn [get_bd_pins MM_ultra_top_0/aresetn] [get_bd_pins axi_dma_0/axi_resetn] [get_bd_pins axi_dma_1/axi_resetn] [get_bd_pins axi_dma_2/axi_resetn] [get_bd_pins axi_smc/aresetn] [get_bd_pins axi_smc_1/aresetn] [get_bd_pins axi_smc_2/aresetn] [get_bd_pins axis_dwidth_converter_0/aresetn] [get_bd_pins axis_dwidth_converter_1/aresetn] [get_bd_pins axis_dwidth_converter_2/aresetn] [get_bd_pins ps7_0_axi_periph/ARESETN] [get_bd_pins ps7_0_axi_periph/M00_ARESETN] [get_bd_pins ps7_0_axi_periph/M01_ARESETN] [get_bd_pins ps7_0_axi_periph/M02_ARESETN] [get_bd_pins ps7_0_axi_periph/M03_ARESETN] [get_bd_pins ps7_0_axi_periph/S00_ARESETN] [get_bd_pins rst_ps7_0_100M/peripheral_aresetn]
|
| 1141 |
+
|
| 1142 |
+
# Create address segments
|
| 1143 |
+
create_bd_addr_seg -range 0x20000000 -offset 0x00000000 [get_bd_addr_spaces axi_dma_0/Data_MM2S] [get_bd_addr_segs processing_system7_0/S_AXI_HP0/HP0_DDR_LOWOCM] SEG_processing_system7_0_HP0_DDR_LOWOCM
|
| 1144 |
+
create_bd_addr_seg -range 0x20000000 -offset 0x00000000 [get_bd_addr_spaces axi_dma_1/Data_MM2S] [get_bd_addr_segs processing_system7_0/S_AXI_HP1/HP1_DDR_LOWOCM] SEG_processing_system7_0_HP1_DDR_LOWOCM
|
| 1145 |
+
create_bd_addr_seg -range 0x20000000 -offset 0x00000000 [get_bd_addr_spaces axi_dma_2/Data_S2MM] [get_bd_addr_segs processing_system7_0/S_AXI_HP2/HP2_DDR_LOWOCM] SEG_processing_system7_0_HP2_DDR_LOWOCM
|
| 1146 |
+
create_bd_addr_seg -range 0x00010000 -offset 0x43C00000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs MM_ultra_top_0/s00_axi/reg0] SEG_MM_ultra_top_0_reg0
|
| 1147 |
+
create_bd_addr_seg -range 0x00010000 -offset 0x40400000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs axi_dma_0/S_AXI_LITE/Reg] SEG_axi_dma_0_Reg
|
| 1148 |
+
create_bd_addr_seg -range 0x00010000 -offset 0x40410000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs axi_dma_1/S_AXI_LITE/Reg] SEG_axi_dma_1_Reg
|
| 1149 |
+
create_bd_addr_seg -range 0x00010000 -offset 0x40420000 [get_bd_addr_spaces processing_system7_0/Data] [get_bd_addr_segs axi_dma_2/S_AXI_LITE/Reg] SEG_axi_dma_2_Reg
|
| 1150 |
+
|
| 1151 |
+
# Perform GUI Layout
|
| 1152 |
+
regenerate_bd_layout -layout_string {
|
| 1153 |
+
"ExpandedHierarchyInLayout":"",
|
| 1154 |
+
"guistr":"# # String gsaved with Nlview 7.0.19 2019-03-26 bk=1.5019 VDI=41 GEI=35 GUI=JA:9.0 non-TLS-threadsafe
|
| 1155 |
+
# -string -flagsOSRD
|
| 1156 |
+
preplace port DDR -pg 1 -lvl 11 -x 3350 -y 180 -defaultsOSRD
|
| 1157 |
+
preplace port FIXED_IO -pg 1 -lvl 11 -x 3350 -y 200 -defaultsOSRD
|
| 1158 |
+
preplace inst processing_system7_0 -pg 1 -lvl 9 -x 2860 -y 230 -defaultsOSRD
|
| 1159 |
+
preplace inst axi_dma_0 -pg 1 -lvl 3 -x 920 -y 110 -defaultsOSRD
|
| 1160 |
+
preplace inst axi_dma_1 -pg 1 -lvl 3 -x 920 -y 300 -defaultsOSRD
|
| 1161 |
+
preplace inst axi_dma_2 -pg 1 -lvl 7 -x 2120 -y 360 -defaultsOSRD
|
| 1162 |
+
preplace inst axis_dwidth_converter_0 -pg 1 -lvl 4 -x 1270 -y 100 -defaultsOSRD
|
| 1163 |
+
preplace inst axis_dwidth_converter_1 -pg 1 -lvl 4 -x 1270 -y 280 -defaultsOSRD
|
| 1164 |
+
preplace inst axis_dwidth_converter_2 -pg 1 -lvl 6 -x 1830 -y 300 -defaultsOSRD
|
| 1165 |
+
preplace inst axi_smc -pg 1 -lvl 8 -x 2470 -y 200 -defaultsOSRD
|
| 1166 |
+
preplace inst rst_ps7_0_100M -pg 1 -lvl 1 -x 200 -y 120 -defaultsOSRD
|
| 1167 |
+
preplace inst axi_smc_1 -pg 1 -lvl 8 -x 2470 -y 500 -defaultsOSRD
|
| 1168 |
+
preplace inst axi_smc_2 -pg 1 -lvl 8 -x 2470 -y 360 -defaultsOSRD
|
| 1169 |
+
preplace inst ps7_0_axi_periph -pg 1 -lvl 2 -x 540 -y 230 -defaultsOSRD
|
| 1170 |
+
preplace inst MM_ultra_top_0 -pg 1 -lvl 5 -x 1550 -y 280 -defaultsOSRD
|
| 1171 |
+
preplace netloc processing_system7_0_FCLK_CLK0 1 0 10 30 20 370 50 710 210 1130 190 1400 380 1680 380 1950 460 2300 280 2610 80 3090
|
| 1172 |
+
preplace netloc processing_system7_0_FCLK_RESET0_N 1 0 10 20 10 NJ 10 NJ 10 1100J 20 NJ 20 NJ 20 NJ 20 NJ 20 NJ 20 3110
|
| 1173 |
+
preplace netloc rst_ps7_0_100M_peripheral_aresetn 1 1 7 380 40 730 20 1090 360 1410 390 1690 390 1940 470 2310
|
| 1174 |
+
preplace netloc axi_dma_1_M_AXI_MM2S 1 3 5 1110 180 NJ 180 NJ 180 NJ 180 2290J
|
| 1175 |
+
preplace netloc axi_smc_1_M00_AXI 1 8 1 2620 220n
|
| 1176 |
+
preplace netloc axi_dma_0_M_AXI_MM2S 1 3 5 1110 10 NJ 10 NJ 10 NJ 10 2310J
|
| 1177 |
+
preplace netloc axi_dma_1_M_AXIS_MM2S 1 3 1 1140 260n
|
| 1178 |
+
preplace netloc axi_dma_0_M_AXIS_MM2S 1 3 1 1120 80n
|
| 1179 |
+
preplace netloc processing_system7_0_DDR 1 9 2 NJ 180 N
|
| 1180 |
+
preplace netloc axis_dwidth_converter_1_M_AXIS 1 4 1 1380 260n
|
| 1181 |
+
preplace netloc ps7_0_axi_periph_M02_AXI 1 2 1 700 240n
|
| 1182 |
+
preplace netloc axi_smc_M00_AXI 1 8 1 N 200
|
| 1183 |
+
preplace netloc processing_system7_0_M_AXI_GP0 1 1 9 390 -10 NJ -10 NJ -10 NJ -10 NJ -10 NJ -10 NJ -10 NJ -10 3100
|
| 1184 |
+
preplace netloc MM_ultra_top_0_m0_axis 1 5 1 N 280
|
| 1185 |
+
preplace netloc axis_dwidth_converter_0_M_AXIS 1 4 1 1410 100n
|
| 1186 |
+
preplace netloc axi_smc_2_M00_AXI 1 8 1 2630 240n
|
| 1187 |
+
preplace netloc ps7_0_axi_periph_M03_AXI 1 2 5 690 0 NJ 0 NJ 0 NJ 0 1950J
|
| 1188 |
+
preplace netloc axis_dwidth_converter_2_M_AXIS 1 6 1 1940 300n
|
| 1189 |
+
preplace netloc ps7_0_axi_periph_M00_AXI 1 2 3 N 200 NJ 200 1390J
|
| 1190 |
+
preplace netloc ps7_0_axi_periph_M01_AXI 1 2 1 720 80n
|
| 1191 |
+
preplace netloc axi_dma_2_M_AXI_S2MM 1 7 1 N 340
|
| 1192 |
+
preplace netloc processing_system7_0_FIXED_IO 1 9 2 NJ 200 N
|
| 1193 |
+
levelinfo -pg 1 0 200 540 920 1270 1550 1830 2120 2470 2860 3230 3350
|
| 1194 |
+
pagesize -pg 1 -db -bbox -sgen 0 -40 3470 610
|
| 1195 |
+
"
|
| 1196 |
+
}
|
| 1197 |
+
# Restore current instance
|
| 1198 |
+
current_bd_instance $oldCurInst
|
| 1199 |
+
|
| 1200 |
+
validate_bd_design
|
| 1201 |
+
save_bd_design
|
| 1202 |
+
close_bd_design $design_name
|
| 1203 |
+
}
|
| 1204 |
+
# End of create_root_design()
|
| 1205 |
+
|
| 1206 |
+
|
| 1207 |
+
##################################################################
|
| 1208 |
+
# MAIN FLOW
|
| 1209 |
+
##################################################################
|
| 1210 |
+
|
| 1211 |
+
create_root_design ""
|
| 1212 |
+
set_property GENERATE_SYNTH_CHECKPOINT "0" [get_files design_1.bd ]
|
| 1213 |
+
set_property REGISTERED_WITH_MANAGER "1" [get_files design_1.bd ]
|
| 1214 |
+
|
| 1215 |
+
# Create 'synth_1' run (if not found)
|
| 1216 |
+
if {[string equal [get_runs -quiet synth_1] ""]} {
|
| 1217 |
+
create_run -name synth_1 -part xc7z020clg400-1 -flow {Vivado Synthesis 2019} -strategy "Flow_AreaMultThresholdDSP" -report_strategy {No Reports} -constrset constrs_1
|
| 1218 |
+
} else {
|
| 1219 |
+
set_property strategy "Flow_AreaMultThresholdDSP" [get_runs synth_1]
|
| 1220 |
+
set_property flow "Vivado Synthesis 2019" [get_runs synth_1]
|
| 1221 |
+
}
|
| 1222 |
+
set obj [get_runs synth_1]
|
| 1223 |
+
set_property set_report_strategy_name 1 $obj
|
| 1224 |
+
set_property report_strategy {Vivado Synthesis Default Reports} $obj
|
| 1225 |
+
set_property set_report_strategy_name 0 $obj
|
| 1226 |
+
# Create 'synth_1_synth_report_utilization_0' report (if not found)
|
| 1227 |
+
if { [ string equal [get_report_configs -of_objects [get_runs synth_1] synth_1_synth_report_utilization_0] "" ] } {
|
| 1228 |
+
create_report_config -report_name synth_1_synth_report_utilization_0 -report_type report_utilization:1.0 -steps synth_design -runs synth_1
|
| 1229 |
+
}
|
| 1230 |
+
set obj [get_report_configs -of_objects [get_runs synth_1] synth_1_synth_report_utilization_0]
|
| 1231 |
+
if { $obj != "" } {
|
| 1232 |
+
|
| 1233 |
+
}
|
| 1234 |
+
set obj [get_runs synth_1]
|
| 1235 |
+
set_property -name "strategy" -value "Flow_AreaMultThresholdDSP" -objects $obj
|
| 1236 |
+
set_property -name "steps.synth_design.args.directive" -value "AreaMultThresholdDSP" -objects $obj
|
| 1237 |
+
|
| 1238 |
+
# set the current synth run
|
| 1239 |
+
current_run -synthesis [get_runs synth_1]
|
| 1240 |
+
|
| 1241 |
+
# Create 'impl_1' run (if not found)
|
| 1242 |
+
if {[string equal [get_runs -quiet impl_1] ""]} {
|
| 1243 |
+
create_run -name impl_1 -part xc7z020clg400-1 -flow {Vivado Implementation 2019} -strategy "Performance_ExplorePostRoutePhysOpt" -report_strategy {No Reports} -constrset constrs_1 -parent_run synth_1
|
| 1244 |
+
} else {
|
| 1245 |
+
set_property strategy "Performance_ExplorePostRoutePhysOpt" [get_runs impl_1]
|
| 1246 |
+
set_property flow "Vivado Implementation 2019" [get_runs impl_1]
|
| 1247 |
+
}
|
| 1248 |
+
set obj [get_runs impl_1]
|
| 1249 |
+
set_property set_report_strategy_name 1 $obj
|
| 1250 |
+
set_property report_strategy {Vivado Implementation Default Reports} $obj
|
| 1251 |
+
set_property set_report_strategy_name 0 $obj
|
| 1252 |
+
# Create 'impl_1_init_report_timing_summary_0' report (if not found)
|
| 1253 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_init_report_timing_summary_0] "" ] } {
|
| 1254 |
+
create_report_config -report_name impl_1_init_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps init_design -runs impl_1
|
| 1255 |
+
}
|
| 1256 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_init_report_timing_summary_0]
|
| 1257 |
+
if { $obj != "" } {
|
| 1258 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1259 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1260 |
+
|
| 1261 |
+
}
|
| 1262 |
+
# Create 'impl_1_opt_report_drc_0' report (if not found)
|
| 1263 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_opt_report_drc_0] "" ] } {
|
| 1264 |
+
create_report_config -report_name impl_1_opt_report_drc_0 -report_type report_drc:1.0 -steps opt_design -runs impl_1
|
| 1265 |
+
}
|
| 1266 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_opt_report_drc_0]
|
| 1267 |
+
if { $obj != "" } {
|
| 1268 |
+
|
| 1269 |
+
}
|
| 1270 |
+
# Create 'impl_1_opt_report_timing_summary_0' report (if not found)
|
| 1271 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_opt_report_timing_summary_0] "" ] } {
|
| 1272 |
+
create_report_config -report_name impl_1_opt_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps opt_design -runs impl_1
|
| 1273 |
+
}
|
| 1274 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_opt_report_timing_summary_0]
|
| 1275 |
+
if { $obj != "" } {
|
| 1276 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1277 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1278 |
+
|
| 1279 |
+
}
|
| 1280 |
+
# Create 'impl_1_power_opt_report_timing_summary_0' report (if not found)
|
| 1281 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_power_opt_report_timing_summary_0] "" ] } {
|
| 1282 |
+
create_report_config -report_name impl_1_power_opt_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps power_opt_design -runs impl_1
|
| 1283 |
+
}
|
| 1284 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_power_opt_report_timing_summary_0]
|
| 1285 |
+
if { $obj != "" } {
|
| 1286 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1287 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1288 |
+
|
| 1289 |
+
}
|
| 1290 |
+
# Create 'impl_1_place_report_io_0' report (if not found)
|
| 1291 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_io_0] "" ] } {
|
| 1292 |
+
create_report_config -report_name impl_1_place_report_io_0 -report_type report_io:1.0 -steps place_design -runs impl_1
|
| 1293 |
+
}
|
| 1294 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_io_0]
|
| 1295 |
+
if { $obj != "" } {
|
| 1296 |
+
|
| 1297 |
+
}
|
| 1298 |
+
# Create 'impl_1_place_report_utilization_0' report (if not found)
|
| 1299 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_utilization_0] "" ] } {
|
| 1300 |
+
create_report_config -report_name impl_1_place_report_utilization_0 -report_type report_utilization:1.0 -steps place_design -runs impl_1
|
| 1301 |
+
}
|
| 1302 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_utilization_0]
|
| 1303 |
+
if { $obj != "" } {
|
| 1304 |
+
|
| 1305 |
+
}
|
| 1306 |
+
# Create 'impl_1_place_report_control_sets_0' report (if not found)
|
| 1307 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_control_sets_0] "" ] } {
|
| 1308 |
+
create_report_config -report_name impl_1_place_report_control_sets_0 -report_type report_control_sets:1.0 -steps place_design -runs impl_1
|
| 1309 |
+
}
|
| 1310 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_control_sets_0]
|
| 1311 |
+
if { $obj != "" } {
|
| 1312 |
+
set_property -name "options.verbose" -value "1" -objects $obj
|
| 1313 |
+
|
| 1314 |
+
}
|
| 1315 |
+
# Create 'impl_1_place_report_incremental_reuse_0' report (if not found)
|
| 1316 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_incremental_reuse_0] "" ] } {
|
| 1317 |
+
create_report_config -report_name impl_1_place_report_incremental_reuse_0 -report_type report_incremental_reuse:1.0 -steps place_design -runs impl_1
|
| 1318 |
+
}
|
| 1319 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_incremental_reuse_0]
|
| 1320 |
+
if { $obj != "" } {
|
| 1321 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1322 |
+
|
| 1323 |
+
}
|
| 1324 |
+
# Create 'impl_1_place_report_incremental_reuse_1' report (if not found)
|
| 1325 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_incremental_reuse_1] "" ] } {
|
| 1326 |
+
create_report_config -report_name impl_1_place_report_incremental_reuse_1 -report_type report_incremental_reuse:1.0 -steps place_design -runs impl_1
|
| 1327 |
+
}
|
| 1328 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_incremental_reuse_1]
|
| 1329 |
+
if { $obj != "" } {
|
| 1330 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1331 |
+
|
| 1332 |
+
}
|
| 1333 |
+
# Create 'impl_1_place_report_timing_summary_0' report (if not found)
|
| 1334 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_timing_summary_0] "" ] } {
|
| 1335 |
+
create_report_config -report_name impl_1_place_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps place_design -runs impl_1
|
| 1336 |
+
}
|
| 1337 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_place_report_timing_summary_0]
|
| 1338 |
+
if { $obj != "" } {
|
| 1339 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1340 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1341 |
+
|
| 1342 |
+
}
|
| 1343 |
+
# Create 'impl_1_post_place_power_opt_report_timing_summary_0' report (if not found)
|
| 1344 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_post_place_power_opt_report_timing_summary_0] "" ] } {
|
| 1345 |
+
create_report_config -report_name impl_1_post_place_power_opt_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps post_place_power_opt_design -runs impl_1
|
| 1346 |
+
}
|
| 1347 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_post_place_power_opt_report_timing_summary_0]
|
| 1348 |
+
if { $obj != "" } {
|
| 1349 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1350 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1351 |
+
|
| 1352 |
+
}
|
| 1353 |
+
# Create 'impl_1_phys_opt_report_timing_summary_0' report (if not found)
|
| 1354 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_phys_opt_report_timing_summary_0] "" ] } {
|
| 1355 |
+
create_report_config -report_name impl_1_phys_opt_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps phys_opt_design -runs impl_1
|
| 1356 |
+
}
|
| 1357 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_phys_opt_report_timing_summary_0]
|
| 1358 |
+
if { $obj != "" } {
|
| 1359 |
+
set_property -name "is_enabled" -value "0" -objects $obj
|
| 1360 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1361 |
+
|
| 1362 |
+
}
|
| 1363 |
+
# Create 'impl_1_route_report_drc_0' report (if not found)
|
| 1364 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_drc_0] "" ] } {
|
| 1365 |
+
create_report_config -report_name impl_1_route_report_drc_0 -report_type report_drc:1.0 -steps route_design -runs impl_1
|
| 1366 |
+
}
|
| 1367 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_drc_0]
|
| 1368 |
+
if { $obj != "" } {
|
| 1369 |
+
|
| 1370 |
+
}
|
| 1371 |
+
# Create 'impl_1_route_report_methodology_0' report (if not found)
|
| 1372 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_methodology_0] "" ] } {
|
| 1373 |
+
create_report_config -report_name impl_1_route_report_methodology_0 -report_type report_methodology:1.0 -steps route_design -runs impl_1
|
| 1374 |
+
}
|
| 1375 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_methodology_0]
|
| 1376 |
+
if { $obj != "" } {
|
| 1377 |
+
|
| 1378 |
+
}
|
| 1379 |
+
# Create 'impl_1_route_report_power_0' report (if not found)
|
| 1380 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_power_0] "" ] } {
|
| 1381 |
+
create_report_config -report_name impl_1_route_report_power_0 -report_type report_power:1.0 -steps route_design -runs impl_1
|
| 1382 |
+
}
|
| 1383 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_power_0]
|
| 1384 |
+
if { $obj != "" } {
|
| 1385 |
+
|
| 1386 |
+
}
|
| 1387 |
+
# Create 'impl_1_route_report_route_status_0' report (if not found)
|
| 1388 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_route_status_0] "" ] } {
|
| 1389 |
+
create_report_config -report_name impl_1_route_report_route_status_0 -report_type report_route_status:1.0 -steps route_design -runs impl_1
|
| 1390 |
+
}
|
| 1391 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_route_status_0]
|
| 1392 |
+
if { $obj != "" } {
|
| 1393 |
+
|
| 1394 |
+
}
|
| 1395 |
+
# Create 'impl_1_route_report_timing_summary_0' report (if not found)
|
| 1396 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_timing_summary_0] "" ] } {
|
| 1397 |
+
create_report_config -report_name impl_1_route_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps route_design -runs impl_1
|
| 1398 |
+
}
|
| 1399 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_timing_summary_0]
|
| 1400 |
+
if { $obj != "" } {
|
| 1401 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1402 |
+
|
| 1403 |
+
}
|
| 1404 |
+
# Create 'impl_1_route_report_incremental_reuse_0' report (if not found)
|
| 1405 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_incremental_reuse_0] "" ] } {
|
| 1406 |
+
create_report_config -report_name impl_1_route_report_incremental_reuse_0 -report_type report_incremental_reuse:1.0 -steps route_design -runs impl_1
|
| 1407 |
+
}
|
| 1408 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_incremental_reuse_0]
|
| 1409 |
+
if { $obj != "" } {
|
| 1410 |
+
|
| 1411 |
+
}
|
| 1412 |
+
# Create 'impl_1_route_report_clock_utilization_0' report (if not found)
|
| 1413 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_clock_utilization_0] "" ] } {
|
| 1414 |
+
create_report_config -report_name impl_1_route_report_clock_utilization_0 -report_type report_clock_utilization:1.0 -steps route_design -runs impl_1
|
| 1415 |
+
}
|
| 1416 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_clock_utilization_0]
|
| 1417 |
+
if { $obj != "" } {
|
| 1418 |
+
|
| 1419 |
+
}
|
| 1420 |
+
# Create 'impl_1_route_report_bus_skew_0' report (if not found)
|
| 1421 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_bus_skew_0] "" ] } {
|
| 1422 |
+
create_report_config -report_name impl_1_route_report_bus_skew_0 -report_type report_bus_skew:1.1 -steps route_design -runs impl_1
|
| 1423 |
+
}
|
| 1424 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_route_report_bus_skew_0]
|
| 1425 |
+
if { $obj != "" } {
|
| 1426 |
+
set_property -name "options.warn_on_violation" -value "1" -objects $obj
|
| 1427 |
+
|
| 1428 |
+
}
|
| 1429 |
+
# Create 'impl_1_post_route_phys_opt_report_timing_summary_0' report (if not found)
|
| 1430 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_post_route_phys_opt_report_timing_summary_0] "" ] } {
|
| 1431 |
+
create_report_config -report_name impl_1_post_route_phys_opt_report_timing_summary_0 -report_type report_timing_summary:1.0 -steps post_route_phys_opt_design -runs impl_1
|
| 1432 |
+
}
|
| 1433 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_post_route_phys_opt_report_timing_summary_0]
|
| 1434 |
+
if { $obj != "" } {
|
| 1435 |
+
set_property -name "options.max_paths" -value "10" -objects $obj
|
| 1436 |
+
set_property -name "options.warn_on_violation" -value "1" -objects $obj
|
| 1437 |
+
|
| 1438 |
+
}
|
| 1439 |
+
# Create 'impl_1_post_route_phys_opt_report_bus_skew_0' report (if not found)
|
| 1440 |
+
if { [ string equal [get_report_configs -of_objects [get_runs impl_1] impl_1_post_route_phys_opt_report_bus_skew_0] "" ] } {
|
| 1441 |
+
create_report_config -report_name impl_1_post_route_phys_opt_report_bus_skew_0 -report_type report_bus_skew:1.1 -steps post_route_phys_opt_design -runs impl_1
|
| 1442 |
+
}
|
| 1443 |
+
set obj [get_report_configs -of_objects [get_runs impl_1] impl_1_post_route_phys_opt_report_bus_skew_0]
|
| 1444 |
+
if { $obj != "" } {
|
| 1445 |
+
set_property -name "options.warn_on_violation" -value "1" -objects $obj
|
| 1446 |
+
|
| 1447 |
+
}
|
| 1448 |
+
set obj [get_runs impl_1]
|
| 1449 |
+
set_property -name "strategy" -value "Performance_ExplorePostRoutePhysOpt" -objects $obj
|
| 1450 |
+
set_property -name "steps.opt_design.args.directive" -value "Explore" -objects $obj
|
| 1451 |
+
set_property -name "steps.place_design.args.directive" -value "Explore" -objects $obj
|
| 1452 |
+
set_property -name "steps.phys_opt_design.is_enabled" -value "1" -objects $obj
|
| 1453 |
+
set_property -name "steps.phys_opt_design.args.directive" -value "Explore" -objects $obj
|
| 1454 |
+
set_property -name "steps.route_design.args.directive" -value "Explore" -objects $obj
|
| 1455 |
+
set_property -name "steps.route_design.args.more options" -value "-tns_cleanup" -objects $obj
|
| 1456 |
+
set_property -name "steps.post_route_phys_opt_design.is_enabled" -value "1" -objects $obj
|
| 1457 |
+
set_property -name "steps.post_route_phys_opt_design.args.directive" -value "Explore" -objects $obj
|
| 1458 |
+
set_property -name "steps.write_bitstream.args.readback_file" -value "0" -objects $obj
|
| 1459 |
+
set_property -name "steps.write_bitstream.args.verbose" -value "0" -objects $obj
|
| 1460 |
+
|
| 1461 |
+
# set the current impl run
|
| 1462 |
+
current_run -implementation [get_runs impl_1]
|
| 1463 |
+
|
| 1464 |
+
# puts "INFO: Project created:${_xil_proj_name_}"
|
| 1465 |
+
# Create 'drc_1' gadget (if not found)
|
| 1466 |
+
if {[string equal [get_dashboard_gadgets [ list "drc_1" ] ] ""]} {
|
| 1467 |
+
create_dashboard_gadget -name {drc_1} -type drc
|
| 1468 |
+
}
|
| 1469 |
+
set obj [get_dashboard_gadgets [ list "drc_1" ] ]
|
| 1470 |
+
set_property -name "reports" -value "impl_1#impl_1_route_report_drc_0" -objects $obj
|
| 1471 |
+
|
| 1472 |
+
# Create 'methodology_1' gadget (if not found)
|
| 1473 |
+
if {[string equal [get_dashboard_gadgets [ list "methodology_1" ] ] ""]} {
|
| 1474 |
+
create_dashboard_gadget -name {methodology_1} -type methodology
|
| 1475 |
+
}
|
| 1476 |
+
set obj [get_dashboard_gadgets [ list "methodology_1" ] ]
|
| 1477 |
+
set_property -name "reports" -value "impl_1#impl_1_route_report_methodology_0" -objects $obj
|
| 1478 |
+
|
| 1479 |
+
# Create 'power_1' gadget (if not found)
|
| 1480 |
+
if {[string equal [get_dashboard_gadgets [ list "power_1" ] ] ""]} {
|
| 1481 |
+
create_dashboard_gadget -name {power_1} -type power
|
| 1482 |
+
}
|
| 1483 |
+
set obj [get_dashboard_gadgets [ list "power_1" ] ]
|
| 1484 |
+
set_property -name "reports" -value "impl_1#impl_1_route_report_power_0" -objects $obj
|
| 1485 |
+
|
| 1486 |
+
# Create 'timing_1' gadget (if not found)
|
| 1487 |
+
if {[string equal [get_dashboard_gadgets [ list "timing_1" ] ] ""]} {
|
| 1488 |
+
create_dashboard_gadget -name {timing_1} -type timing
|
| 1489 |
+
}
|
| 1490 |
+
set obj [get_dashboard_gadgets [ list "timing_1" ] ]
|
| 1491 |
+
set_property -name "reports" -value "impl_1#impl_1_route_report_timing_summary_0" -objects $obj
|
| 1492 |
+
|
| 1493 |
+
# Create 'utilization_1' gadget (if not found)
|
| 1494 |
+
if {[string equal [get_dashboard_gadgets [ list "utilization_1" ] ] ""]} {
|
| 1495 |
+
create_dashboard_gadget -name {utilization_1} -type utilization
|
| 1496 |
+
}
|
| 1497 |
+
set obj [get_dashboard_gadgets [ list "utilization_1" ] ]
|
| 1498 |
+
set_property -name "reports" -value "synth_1#synth_1_synth_report_utilization_0" -objects $obj
|
| 1499 |
+
set_property -name "run.step" -value "synth_design" -objects $obj
|
| 1500 |
+
set_property -name "run.type" -value "synthesis" -objects $obj
|
| 1501 |
+
|
| 1502 |
+
# Create 'utilization_2' gadget (if not found)
|
| 1503 |
+
if {[string equal [get_dashboard_gadgets [ list "utilization_2" ] ] ""]} {
|
| 1504 |
+
create_dashboard_gadget -name {utilization_2} -type utilization
|
| 1505 |
+
}
|
| 1506 |
+
set obj [get_dashboard_gadgets [ list "utilization_2" ] ]
|
| 1507 |
+
set_property -name "reports" -value "impl_1#impl_1_place_report_utilization_0" -objects $obj
|
| 1508 |
+
|
| 1509 |
+
move_dashboard_gadget -name {utilization_1} -row 0 -col 0
|
| 1510 |
+
move_dashboard_gadget -name {power_1} -row 1 -col 0
|
| 1511 |
+
move_dashboard_gadget -name {drc_1} -row 2 -col 0
|
| 1512 |
+
move_dashboard_gadget -name {timing_1} -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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from pynq import allocate
|
| 3 |
+
from pynq import MMIO
|
| 4 |
+
|
| 5 |
+
A_SIZE = 25
|
| 6 |
+
in_F_max_size = 4000 * A_SIZE
|
| 7 |
+
in_W_max_size = 4000 * A_SIZE
|
| 8 |
+
out_F_max_size = 4000 * A_SIZE
|
| 9 |
+
in_F_width_max = 64 * A_SIZE
|
| 10 |
+
in_W_width_max = 64 * A_SIZE
|
| 11 |
+
shift_max = 32
|
| 12 |
+
|
| 13 |
+
def mat_create(shape, data_type = np.int8):
|
| 14 |
+
height = shape[0]
|
| 15 |
+
width = shape[1]
|
| 16 |
+
if height % A_SIZE != 0:
|
| 17 |
+
An_h = height + A_SIZE - height % A_SIZE
|
| 18 |
+
else:
|
| 19 |
+
An_h = height
|
| 20 |
+
|
| 21 |
+
if width % A_SIZE != 0:
|
| 22 |
+
An_w = width+ A_SIZE - width % A_SIZE
|
| 23 |
+
else:
|
| 24 |
+
An_w = width
|
| 25 |
+
A = allocate(shape=(An_h,An_w), dtype=data_type)
|
| 26 |
+
return [A[0:height,0:width], A]
|
| 27 |
+
|
| 28 |
+
def mat_setValue(A,B:np.ndarray): #use numpy array to set value
|
| 29 |
+
A[0][:] = B
|
| 30 |
+
|
| 31 |
+
def mat_getNdarray(A):
|
| 32 |
+
B = np.zeros((A[0].shape[0],A[0].shape[1]))
|
| 33 |
+
B = A[0].copy()
|
| 34 |
+
return B
|
| 35 |
+
|
| 36 |
+
def mat_delete(A):
|
| 37 |
+
A[1].freebuffer()
|
| 38 |
+
|
| 39 |
+
def mat_print(A):
|
| 40 |
+
print(A[0])
|
| 41 |
+
|
| 42 |
+
def mat_mul_soft(A,B,C,shift):
|
| 43 |
+
C0 = A[0].astype(np.int32) @ B[0].astype(np.int32)
|
| 44 |
+
C0 = np.right_shift(C0,shift)
|
| 45 |
+
C0 = np.clip(C0,-128,127)
|
| 46 |
+
C[0][:] = C0
|
| 47 |
+
|
| 48 |
+
def ini_MM():
|
| 49 |
+
global MM_ultra
|
| 50 |
+
global in_f_dma
|
| 51 |
+
global in_w_dma
|
| 52 |
+
global out_f_dma
|
| 53 |
+
|
| 54 |
+
MM_ultra_addr= 0xA0030000
|
| 55 |
+
MM_ultra_addr_range = 0xFFF
|
| 56 |
+
MM_ultra = MMIO(MM_ultra_addr, MM_ultra_addr_range)
|
| 57 |
+
|
| 58 |
+
global XAXIDMA_IDLE_MASK
|
| 59 |
+
XAXIDMA_IDLE_MASK = 0x00000002
|
| 60 |
+
|
| 61 |
+
IN_FEATURE_DMA_ADDR = 0xA0000000
|
| 62 |
+
in_f_range = 0x10000
|
| 63 |
+
in_f_dma = MMIO(IN_FEATURE_DMA_ADDR, in_f_range)
|
| 64 |
+
|
| 65 |
+
IN_WEIGHT_DMA_ADDR = 0xA0010000
|
| 66 |
+
in_w_range = 0x10000
|
| 67 |
+
in_w_dma = MMIO(IN_WEIGHT_DMA_ADDR, in_w_range)
|
| 68 |
+
|
| 69 |
+
OUT_FEATURE_DMA_ADDR = 0xA0020000
|
| 70 |
+
out_f_range = 0x10000
|
| 71 |
+
out_f_dma = MMIO(OUT_FEATURE_DMA_ADDR, out_f_range)
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def in_feature_transfer(array, start_offset = 0, len = 0):
|
| 75 |
+
start_addr = array.physical_address + start_offset
|
| 76 |
+
if len == 0:
|
| 77 |
+
len = array.nbytes
|
| 78 |
+
array.flush()
|
| 79 |
+
in_f_dma.write(0x0,0x4) #reset
|
| 80 |
+
in_f_dma.write(0x18,start_addr)
|
| 81 |
+
in_f_dma.write(0x0,0x1) #open channel
|
| 82 |
+
in_f_dma.write(0x28,len)
|
| 83 |
+
|
| 84 |
+
def in_weight_transfer(array, start_offset = 0, len = 0):
|
| 85 |
+
start_addr = array.physical_address + start_offset
|
| 86 |
+
if len == 0:
|
| 87 |
+
len = array.nbytes
|
| 88 |
+
array.flush()
|
| 89 |
+
in_w_dma.write(0x0,0x4) #reset
|
| 90 |
+
in_w_dma.write(0x18,start_addr)
|
| 91 |
+
in_w_dma.write(0x0,0x1) #open channel
|
| 92 |
+
in_w_dma.write(0x28,len)
|
| 93 |
+
|
| 94 |
+
def out_feature_transfer(array, start_offset = 0, len = 0):
|
| 95 |
+
start_addr = array.physical_address + start_offset
|
| 96 |
+
if len == 0:
|
| 97 |
+
len = array.nbytes
|
| 98 |
+
out_f_dma.write(0x30,0x4) #reset
|
| 99 |
+
out_f_dma.write(0x48,start_addr)
|
| 100 |
+
out_f_dma.write(0x30,0x1) #open channel
|
| 101 |
+
out_f_dma.write(0x58,len)
|
| 102 |
+
array.invalidate()
|
| 103 |
+
|
| 104 |
+
def out_feature_wait():
|
| 105 |
+
while False if out_f_dma.read(0x34) & XAXIDMA_IDLE_MASK else True:
|
| 106 |
+
pass
|
| 107 |
+
def in_feature_wait():
|
| 108 |
+
while False if in_f_dma.read(0x4) & XAXIDMA_IDLE_MASK else True:
|
| 109 |
+
pass
|
| 110 |
+
def in_weight_wait():
|
| 111 |
+
while False if in_w_dma.read(0x4) & XAXIDMA_IDLE_MASK else True:
|
| 112 |
+
pass
|
| 113 |
+
|
| 114 |
+
def mat_mul(A, B, C,shift=0):
|
| 115 |
+
A = A[1]
|
| 116 |
+
B = B[1]
|
| 117 |
+
C = C[1]
|
| 118 |
+
A_h = A.shape[0]
|
| 119 |
+
A_w = A.shape[1]
|
| 120 |
+
B_h = B.shape[0]
|
| 121 |
+
B_w = B.shape[1]
|
| 122 |
+
if A_h == 1:
|
| 123 |
+
print("\033[31mThe height of matrix A can not be 1\033[0m")
|
| 124 |
+
return
|
| 125 |
+
if A_w > in_F_width_max:
|
| 126 |
+
print("\033[31mThe width of matrix A is too large\033[0m")
|
| 127 |
+
return
|
| 128 |
+
if A_w != B_h:
|
| 129 |
+
print("\033[31mThe width of matrix A is not equal to the height of matrix B\033[0m")
|
| 130 |
+
return
|
| 131 |
+
if A_w % A_SIZE != 0 :
|
| 132 |
+
print("\033[31mThe width of matrix A is not the integer multiple of A_SIZE\033[0m")
|
| 133 |
+
return
|
| 134 |
+
if B_w % A_SIZE != 0 :
|
| 135 |
+
print("\033[31mThe width of matrix B is not the integer multiple of A_SIZE\033[0m")
|
| 136 |
+
return
|
| 137 |
+
if A.nbytes > in_F_max_size:
|
| 138 |
+
print("\033[31mThe size of matrix A is too large\033[0m")
|
| 139 |
+
return
|
| 140 |
+
if B.nbytes > in_W_max_size:
|
| 141 |
+
print("\033[31mThe size of matrix B is too large\033[0m")
|
| 142 |
+
return
|
| 143 |
+
if C.nbytes > in_W_max_size:
|
| 144 |
+
print("\033[31mThe size of matrix C is too large\033[0m")
|
| 145 |
+
return
|
| 146 |
+
F_width_block_num = int(A_w / A_SIZE)
|
| 147 |
+
W_width_block_num = int(B_w /A_SIZE)
|
| 148 |
+
MM_ultra.write(0x0,shift)
|
| 149 |
+
MM_ultra.write(0x4,A_h)
|
| 150 |
+
MM_ultra.write(0x8,F_width_block_num)
|
| 151 |
+
MM_ultra.write(0xc,W_width_block_num)
|
| 152 |
+
out_feature_transfer(C)
|
| 153 |
+
in_feature_transfer(A)
|
| 154 |
+
in_weight_transfer(B)
|
| 155 |
+
out_feature_wait()
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/README.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Empty application. Add your own sources.
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/defines.h
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef SRC_DEFINES_H_
|
| 2 |
+
#define SRC_DEFINES_H_
|
| 3 |
+
#include "xparameters.h"
|
| 4 |
+
#define CACHE_LINE_SIZE 32
|
| 5 |
+
|
| 6 |
+
#define MM_ADDR XPAR_MM_ULTRA_TOP_0_BASEADDR
|
| 7 |
+
#define SHIFT_ADDR MM_ADDR
|
| 8 |
+
#define FL_ADDR (MM_ADDR + 0x04)
|
| 9 |
+
#define FWBN_ADDR (MM_ADDR +0x08)
|
| 10 |
+
#define WWBN_ADDR (MM_ADDR +0x0c)
|
| 11 |
+
|
| 12 |
+
#define WEIGHT_DMA_ADDR XPAR_AXI_DMA_1_BASEADDR
|
| 13 |
+
#define WEIGHT_MM2S_DMACR (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_CR_OFFSET) //MM2S DMA Control register
|
| 14 |
+
#define WEIGHT_MM2S_DMASR (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SR_OFFSET) //MM2S DMA Status register
|
| 15 |
+
#define WEIGHT_MM2S_SA (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //MM2S Source Address
|
| 16 |
+
#define WEIGHT_MM2S_LENGTH (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //MM2S Transfer Length (Bytes)
|
| 17 |
+
|
| 18 |
+
#define FEATURE_DMA_ADDR XPAR_AXI_DMA_0_BASEADDR
|
| 19 |
+
#define FEATURE_MM2S_DMACR (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_CR_OFFSET) //MM2S DMA Control register
|
| 20 |
+
#define FEATURE_MM2S_DMASR (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SR_OFFSET) //MM2S DMA Status register
|
| 21 |
+
#define FEATURE_MM2S_SA (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //MM2S Source Address
|
| 22 |
+
#define FEATURE_MM2S_LENGTH (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //MM2S Transfer Length (Bytes)
|
| 23 |
+
|
| 24 |
+
#define RESULT_DMA_ADDR XPAR_AXI_DMA_2_BASEADDR
|
| 25 |
+
#define RESULT_S2MM_DMACR (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_CR_OFFSET) //S2MM DMA Control register
|
| 26 |
+
#define RESULT_S2MM_DMASR (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_SR_OFFSET) //S2MM DMA Status register
|
| 27 |
+
#define RESULT_S2MM_DA (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //S2MM Destination Address
|
| 28 |
+
#define RESULT_S2MM_LENGTH (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //S2MM Transfer Length (Bytes)
|
| 29 |
+
|
| 30 |
+
#define A_SIZE 24
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
#endif /* SRC_DEFINES_H_ */
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/main.c
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "xparameters.h"
|
| 2 |
+
#include "xil_io.h"
|
| 3 |
+
#include "stdio.h"
|
| 4 |
+
#include "xtime_l.h"
|
| 5 |
+
#include <stdlib.h>
|
| 6 |
+
#include "xil_cache.h"
|
| 7 |
+
#include "xil_types.h"
|
| 8 |
+
#include "xaxidma_hw.h"
|
| 9 |
+
#include "sleep.h"
|
| 10 |
+
#include "matrix.h"
|
| 11 |
+
#include "defines.h"
|
| 12 |
+
|
| 13 |
+
#define CAL_SOFT 1
|
| 14 |
+
XTime t1,t2,t3,t4,t5,t6;
|
| 15 |
+
|
| 16 |
+
int main()
|
| 17 |
+
{
|
| 18 |
+
int times = 10;
|
| 19 |
+
int a;
|
| 20 |
+
for(a=0;a<times;a++){
|
| 21 |
+
printf("/*************************************************************/\n");
|
| 22 |
+
printf("Hello,%d\n",a);
|
| 23 |
+
u32 shift = 10;
|
| 24 |
+
u32 IN_ROWS_NUM = 160;
|
| 25 |
+
u32 IN_COLS_NUM = 160;
|
| 26 |
+
u32 OUT_COLS_NUM = 160;
|
| 27 |
+
|
| 28 |
+
u32 F_width_block_num = IN_COLS_NUM / A_SIZE;
|
| 29 |
+
u32 W_width_block_num = OUT_COLS_NUM /A_SIZE;
|
| 30 |
+
// Xil_DCacheDisable();
|
| 31 |
+
int feature_in_size = IN_ROWS_NUM * IN_COLS_NUM;
|
| 32 |
+
int feature_out_size = IN_ROWS_NUM * OUT_COLS_NUM;
|
| 33 |
+
int weight_size = IN_COLS_NUM * OUT_COLS_NUM;
|
| 34 |
+
|
| 35 |
+
#if CAL_SOFT
|
| 36 |
+
matrix A = mat_create(IN_ROWS_NUM,IN_COLS_NUM);
|
| 37 |
+
matrix B = mat_create(IN_COLS_NUM,OUT_COLS_NUM);
|
| 38 |
+
matrix C = mat_create(IN_ROWS_NUM,OUT_COLS_NUM);
|
| 39 |
+
#endif
|
| 40 |
+
s8 *weight_buffer ;
|
| 41 |
+
s8 *feature_in_buffer;
|
| 42 |
+
s8 *feature_out_buffer;
|
| 43 |
+
|
| 44 |
+
XTime_GetTime(&t1);
|
| 45 |
+
feature_in_buffer = (s8*) malloc(feature_in_size);
|
| 46 |
+
weight_buffer = (s8*) malloc(weight_size);
|
| 47 |
+
feature_out_buffer = (s8*) malloc(feature_out_size);
|
| 48 |
+
|
| 49 |
+
XTime_GetTime(&t2);
|
| 50 |
+
int i;
|
| 51 |
+
int j;
|
| 52 |
+
for(i=0;i<IN_ROWS_NUM;i++){
|
| 53 |
+
for(j=0;j<IN_COLS_NUM;j++){
|
| 54 |
+
int value = rand()%256-128;//rand()%16-7;
|
| 55 |
+
// int value = (i * A_SIZE +j + 128)%256 - 128;
|
| 56 |
+
// int value = 1;
|
| 57 |
+
*(feature_in_buffer + i * IN_COLS_NUM + j)=value;
|
| 58 |
+
#if CAL_SOFT
|
| 59 |
+
mat_setValue(A,i,j,value);
|
| 60 |
+
#endif
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
for(i=0;i<IN_COLS_NUM;i++){
|
| 64 |
+
for(j=0;j<OUT_COLS_NUM;j++){
|
| 65 |
+
int value = rand()%256-128;//rand()%16-7;
|
| 66 |
+
// int value = (i * A_SIZE +j + 128)%256 - 128;
|
| 67 |
+
// int value = 2;
|
| 68 |
+
*(weight_buffer + i * OUT_COLS_NUM + j)=value;
|
| 69 |
+
#if CAL_SOFT
|
| 70 |
+
mat_setValue(B,i,j,value);
|
| 71 |
+
#endif
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
Xil_DCacheFlushRange(weight_buffer,weight_size);
|
| 76 |
+
Xil_DCacheFlushRange(feature_in_buffer,feature_in_size);
|
| 77 |
+
Xil_DCacheFlushRange(feature_out_buffer,feature_out_size);//make sure that the invalidate data will not cause data loss
|
| 78 |
+
Xil_DCacheInvalidateRange(feature_out_buffer,feature_out_size);
|
| 79 |
+
XTime_GetTime(&t3);
|
| 80 |
+
Xil_Out32(SHIFT_ADDR,shift);
|
| 81 |
+
Xil_Out32(FL_ADDR,IN_ROWS_NUM);
|
| 82 |
+
Xil_Out32(FWBN_ADDR,F_width_block_num);
|
| 83 |
+
Xil_Out32(WWBN_ADDR,W_width_block_num);
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
//first open receive channel
|
| 87 |
+
Xil_Out32(RESULT_S2MM_DMACR, 0x4);//reset
|
| 88 |
+
Xil_Out32(RESULT_S2MM_DA, (u32)feature_out_buffer); //set addr
|
| 89 |
+
Xil_Out32(RESULT_S2MM_DMACR, 0x1); //open channel
|
| 90 |
+
Xil_Out32(RESULT_S2MM_LENGTH,feature_out_size); //set length
|
| 91 |
+
|
| 92 |
+
Xil_Out32(WEIGHT_MM2S_DMACR, 0x4);
|
| 93 |
+
Xil_Out32(WEIGHT_MM2S_SA, (u32)weight_buffer);
|
| 94 |
+
Xil_Out32(WEIGHT_MM2S_DMACR, 0x1);
|
| 95 |
+
Xil_Out32(WEIGHT_MM2S_LENGTH,weight_size);
|
| 96 |
+
|
| 97 |
+
Xil_Out32(FEATURE_MM2S_DMACR, 0x4);
|
| 98 |
+
Xil_Out32(FEATURE_MM2S_SA, (u32)feature_in_buffer);
|
| 99 |
+
Xil_Out32(FEATURE_MM2S_DMACR, 0x1);
|
| 100 |
+
Xil_Out32(FEATURE_MM2S_LENGTH,feature_in_size);
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
while((Xil_In32(RESULT_S2MM_DMASR) & XAXIDMA_IDLE_MASK) ? FALSE : TRUE){
|
| 104 |
+
printf("*\n");
|
| 105 |
+
};
|
| 106 |
+
// sleep(1);
|
| 107 |
+
XTime_GetTime(&t4);
|
| 108 |
+
|
| 109 |
+
XTime_GetTime(&t5);
|
| 110 |
+
#if CAL_SOFT
|
| 111 |
+
mat_mul(A,B,C,shift);
|
| 112 |
+
#endif
|
| 113 |
+
XTime_GetTime(&t6);
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
float T_allocBuffer = (float)(t2-t1)*(1000000 / COUNTS_PER_SECOND);
|
| 117 |
+
float T_hard = (float)(t4-t3)*1000000 / COUNTS_PER_SECOND;
|
| 118 |
+
#if CAL_SOFT
|
| 119 |
+
float T_soft = (float)(t6-t5)*1000000 / COUNTS_PER_SECOND;
|
| 120 |
+
#endif
|
| 121 |
+
|
| 122 |
+
#if CAL_SOFT
|
| 123 |
+
unsigned long error_num = 0;
|
| 124 |
+
for(i=0;i<IN_ROWS_NUM;i++){
|
| 125 |
+
for(j=0;j<OUT_COLS_NUM;j++){
|
| 126 |
+
int temp = (int)*(feature_out_buffer + i * OUT_COLS_NUM + j)- mat_getValue(C,i,j);
|
| 127 |
+
if(temp!=0){
|
| 128 |
+
error_num++;
|
| 129 |
+
if(error_num < 1000){
|
| 130 |
+
printf("row %d, col %d: %7d,%7d\n",i,j,temp,mat_getValue(C,i,j));
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
#endif
|
| 137 |
+
printf("Time spent on memory allocation:%.2fus\n",T_allocBuffer);
|
| 138 |
+
|
| 139 |
+
printf("Time spent on hardware calculation:%.2fus\n",T_hard);
|
| 140 |
+
#if CAL_SOFT
|
| 141 |
+
printf("Time spent on software calculation��%.2fus\n",T_soft);
|
| 142 |
+
#endif
|
| 143 |
+
free(weight_buffer);
|
| 144 |
+
free(feature_in_buffer);
|
| 145 |
+
free(feature_out_buffer);
|
| 146 |
+
#if CAL_SOFT
|
| 147 |
+
mat_free(A);
|
| 148 |
+
mat_free(B);
|
| 149 |
+
mat_free(C);
|
| 150 |
+
#endif
|
| 151 |
+
printf("END\n");
|
| 152 |
+
printf("/*************************************************************/\n\n\n\n\n\n\n");
|
| 153 |
+
}
|
| 154 |
+
return 0;
|
| 155 |
+
}
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/matrix.c
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include"matrix.h"
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
matrix mat_create(int num_of_rows, int num_of_cols){
|
| 5 |
+
matrix A;
|
| 6 |
+
A.num_of_rows = num_of_rows;
|
| 7 |
+
A.num_of_cols = num_of_cols;
|
| 8 |
+
DATA_TYPE * ddrAddr = (DATA_TYPE*) malloc( num_of_rows * num_of_cols * sizeof(DATA_TYPE));
|
| 9 |
+
A.ddrAddr = ddrAddr;
|
| 10 |
+
return A;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
void mat_setValue(matrix A, int row, int col, DATA_TYPE value){
|
| 14 |
+
if((row > A.num_of_rows-1) || (col > A.num_of_cols -1)){
|
| 15 |
+
printf("mat_setValue: index out of bound, row = %d, col = %d\n",row,col);
|
| 16 |
+
return;
|
| 17 |
+
}
|
| 18 |
+
if(row <0 || col < 0){
|
| 19 |
+
printf("mat_setValue: negative index\n");
|
| 20 |
+
return;
|
| 21 |
+
}
|
| 22 |
+
*(A.ddrAddr + row * A.num_of_cols + col) = value;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
DATA_TYPE mat_getValue(matrix A, int row, int col){
|
| 26 |
+
if((row > A.num_of_rows-1) || (col > A.num_of_cols -1)){
|
| 27 |
+
printf("mat_getValue: index out of bound, row = %d, col = %d\n",row,col);
|
| 28 |
+
return 0;
|
| 29 |
+
}
|
| 30 |
+
if(row <0 || col < 0){
|
| 31 |
+
printf("mat_getValue: negative index\n");
|
| 32 |
+
return 0;
|
| 33 |
+
}
|
| 34 |
+
return *(A.ddrAddr + row * A.num_of_cols + col);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
void mat_set(matrix_Ptr A_p, void * addr, int num_of_rows, int num_of_cols){
|
| 38 |
+
int size = num_of_cols * num_of_rows * sizeof(DATA_TYPE);
|
| 39 |
+
free(A_p->ddrAddr);
|
| 40 |
+
A_p->ddrAddr = (DATA_TYPE *) malloc(size);
|
| 41 |
+
memcpy(A_p->ddrAddr,addr,size);
|
| 42 |
+
A_p->num_of_cols = num_of_cols;
|
| 43 |
+
A_p->num_of_rows = num_of_rows;
|
| 44 |
+
return;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
void mat_mul(matrix A, matrix B, matrix C, int R_shift){ //A * B = C
|
| 48 |
+
if(A.num_of_cols != B.num_of_rows){
|
| 49 |
+
printf("size mismatch\n");
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
if(A.num_of_rows != C.num_of_rows || B.num_of_cols != C.num_of_cols){
|
| 53 |
+
printf("size mismatch\n");
|
| 54 |
+
return;
|
| 55 |
+
}
|
| 56 |
+
int temp;
|
| 57 |
+
int i;
|
| 58 |
+
int j;
|
| 59 |
+
int k;
|
| 60 |
+
|
| 61 |
+
for (i=0;i<C.num_of_rows;i++){
|
| 62 |
+
// printf("\n");
|
| 63 |
+
for(j=0;j<C.num_of_cols;j++){
|
| 64 |
+
temp=0;
|
| 65 |
+
for(k=0;k<A.num_of_cols;k++){
|
| 66 |
+
temp = temp + mat_getValue(A,i,k)*mat_getValue(B,k,j);
|
| 67 |
+
}
|
| 68 |
+
// printf("temp: %d\n",temp);
|
| 69 |
+
if(R_shift > 0){
|
| 70 |
+
temp = (temp+(1<<(R_shift-1))) >> R_shift;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
if (temp > MAX_LIMIT){
|
| 74 |
+
temp = MAX_LIMIT;
|
| 75 |
+
}
|
| 76 |
+
if (temp < MIN_LIMIT){
|
| 77 |
+
temp = MIN_LIMIT;
|
| 78 |
+
}
|
| 79 |
+
// printf("%d",temp);
|
| 80 |
+
mat_setValue(C,i,j,temp);
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
};
|
| 84 |
+
|
| 85 |
+
void mat_print(matrix A){
|
| 86 |
+
int i,j;
|
| 87 |
+
for(i=0;i<A.num_of_rows;i++){
|
| 88 |
+
printf("row %d: ",i);
|
| 89 |
+
for(j=0;j<A.num_of_cols;j++){
|
| 90 |
+
printf("%7d",(int)mat_getValue(A,i,j));
|
| 91 |
+
}
|
| 92 |
+
printf("\n");
|
| 93 |
+
}
|
| 94 |
+
printf("\n");
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
void mat_free(matrix A){
|
| 98 |
+
free(A.ddrAddr);
|
| 99 |
+
}
|
| 100 |
+
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sdk/matrix.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef SRC_MATRIX_H_
|
| 2 |
+
#define SRC_MATRIX_H_
|
| 3 |
+
#include "xil_types.h"
|
| 4 |
+
#include <stdio.h>
|
| 5 |
+
#include<stdlib.h>
|
| 6 |
+
#include <limits.h>
|
| 7 |
+
#include "xil_printf.h"
|
| 8 |
+
#include <string.h>
|
| 9 |
+
|
| 10 |
+
#define DATA_TYPE s8
|
| 11 |
+
#define MAX_LIMIT 127
|
| 12 |
+
#define MIN_LIMIT -128
|
| 13 |
+
|
| 14 |
+
typedef struct{
|
| 15 |
+
int num_of_rows;
|
| 16 |
+
int num_of_cols;
|
| 17 |
+
DATA_TYPE *ddrAddr;
|
| 18 |
+
} matrix, *matrix_Ptr;
|
| 19 |
+
|
| 20 |
+
matrix mat_create(int num_of_rows, int num_of_cols);
|
| 21 |
+
void mat_setValue(matrix A, int row, int col, DATA_TYPE value);
|
| 22 |
+
DATA_TYPE mat_getValue(matrix A, int row, int col);
|
| 23 |
+
void mat_set(matrix_Ptr A, void * addr, int num_of_rows, int num_of_cols);
|
| 24 |
+
void mat_mul(matrix A, matrix B, matrix C, int R_shift);
|
| 25 |
+
void mat_free(matrix A);
|
| 26 |
+
void mat_print(matrix A);
|
| 27 |
+
|
| 28 |
+
#endif /* SRC_MATRIX_H_ */
|
Buck008_Transformer-Accelerator-Based-on-FPGA/sim/MM_Ultra_tb.sv
ADDED
|
@@ -0,0 +1,378 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ns
|
| 2 |
+
|
| 3 |
+
`define A_size 16
|
| 4 |
+
`define DATA_WIDTH 8
|
| 5 |
+
`define SHIFT_WIDTH 10
|
| 6 |
+
`define IN_Feature_Block_num 2400
|
| 7 |
+
`define Weight_Block_num 2400
|
| 8 |
+
`define OUT_Feature_Block_num 2400
|
| 9 |
+
`define OUT_MEM_WIDTH 21
|
| 10 |
+
`define F_length_width 10
|
| 11 |
+
`define F_width_block_num_width 5
|
| 12 |
+
`define W_width_block_num_width 5
|
| 13 |
+
|
| 14 |
+
`define IN_ROWS_NUM 200 //MM_buffer also has limit
|
| 15 |
+
`define IN_COLS_NUM 96 //Must be integer multiple of A_size
|
| 16 |
+
`define OUT_COLS_NUM 160 //Must be integer multiple of A_size
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
module MM_Ultra_tb;
|
| 20 |
+
|
| 21 |
+
parameter integer P_shift = 9;
|
| 22 |
+
parameter integer P_F_length = `IN_ROWS_NUM;
|
| 23 |
+
parameter integer P_F_width_block_num = `IN_COLS_NUM / `A_size;
|
| 24 |
+
parameter integer P_W_width_block_num = `OUT_COLS_NUM / `A_size;
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
task MM_soft(input integer x[`IN_ROWS_NUM-1:0][`IN_COLS_NUM-1:0],
|
| 29 |
+
input integer y[`IN_COLS_NUM-1:0][`OUT_COLS_NUM-1:0],
|
| 30 |
+
input integer scale,
|
| 31 |
+
output integer z[`IN_ROWS_NUM-1:0][`OUT_COLS_NUM-1:0]);
|
| 32 |
+
begin
|
| 33 |
+
automatic integer temp;
|
| 34 |
+
automatic integer i;
|
| 35 |
+
automatic integer j;
|
| 36 |
+
automatic integer k;
|
| 37 |
+
|
| 38 |
+
for (i=0;i<`IN_ROWS_NUM;i++)begin
|
| 39 |
+
for (j=0;j<`OUT_COLS_NUM;j++)begin
|
| 40 |
+
temp = 0;
|
| 41 |
+
for (k=0;k<`IN_COLS_NUM;k++) begin
|
| 42 |
+
temp = temp + x[i][k] * y[k][j];
|
| 43 |
+
end
|
| 44 |
+
|
| 45 |
+
// $display("%d",temp);
|
| 46 |
+
if(scale > 0 )begin
|
| 47 |
+
temp = (temp+(1<<(scale-1))) >>> scale; //round
|
| 48 |
+
end
|
| 49 |
+
if (temp > 127)
|
| 50 |
+
temp = 127;
|
| 51 |
+
if (temp < -128)
|
| 52 |
+
temp = -128;
|
| 53 |
+
// $display("%d",temp);
|
| 54 |
+
z[i][j] = temp;
|
| 55 |
+
end
|
| 56 |
+
end
|
| 57 |
+
end
|
| 58 |
+
endtask
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
reg clk;
|
| 62 |
+
reg rst_n;
|
| 63 |
+
|
| 64 |
+
reg [`SHIFT_WIDTH-1:0] shift;
|
| 65 |
+
reg [`F_length_width-1:0] F_length; //1 ~ block_num *A_size
|
| 66 |
+
reg [`F_width_block_num_width-1:0] F_width_block_num; //1 ~ block_num
|
| 67 |
+
reg [`W_width_block_num_width-1:0] W_width_block_num; //1 ~ block_num
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
reg in_F_valid;
|
| 71 |
+
wire in_F_last;
|
| 72 |
+
wire in_F_ready;
|
| 73 |
+
wire [`A_size * `DATA_WIDTH - 1:0] in_F_data;
|
| 74 |
+
|
| 75 |
+
reg out_data_ready;
|
| 76 |
+
reg in_W_valid;
|
| 77 |
+
wire in_W_last;
|
| 78 |
+
wire in_W_ready;
|
| 79 |
+
wire [`A_size * `DATA_WIDTH - 1:0] in_W_data;
|
| 80 |
+
|
| 81 |
+
wire out_data_valid;
|
| 82 |
+
wire out_data_last;
|
| 83 |
+
wire [`A_size * `DATA_WIDTH -1:0] out_data;
|
| 84 |
+
|
| 85 |
+
genvar i,j;
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
MM_ultra
|
| 89 |
+
#(
|
| 90 |
+
.A_size(`A_size), //Determines the side length of SA, that is, the size
|
| 91 |
+
.data_width(`DATA_WIDTH), //Determines the quantized data bit width
|
| 92 |
+
.shift_width(`SHIFT_WIDTH), //Determines the bit width of the shifter shift variable
|
| 93 |
+
.Weight_Block_num(`Weight_Block_num), //Determines the number of weight_buffer_blocks in the IN_BUFFER.
|
| 94 |
+
.IN_Feature_Block_num(`IN_Feature_Block_num), //Determines the number of feature_buffer_blocks in the IN_BUFFER.
|
| 95 |
+
.OUT_Feature_Block_num(`OUT_Feature_Block_num), //Determines the number of feature_buffer_blocks in the OUT_BUFFER.
|
| 96 |
+
.OUT_MEM_WIDTH(`OUT_MEM_WIDTH), //Determines the data bit width of the OUT_BUFFER
|
| 97 |
+
.F_length_width(`F_length_width), //Determines the bit width of the F_length register and the bram size in the MM_buffer
|
| 98 |
+
.F_width_block_num_width(`F_width_block_num_width),
|
| 99 |
+
.W_width_block_num_width(`W_width_block_num_width)
|
| 100 |
+
//F length and W width block num will be multiplied. Notice the timing
|
| 101 |
+
)u_MM_ultra(
|
| 102 |
+
.clk(clk),
|
| 103 |
+
.rst_n(rst_n),
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
.shift_in(shift),
|
| 107 |
+
.F_length_in(F_length), //1 ~ block_num *A_size
|
| 108 |
+
.F_width_block_num_in(F_width_block_num), //1 ~ block_num
|
| 109 |
+
.W_width_block_num_in(W_width_block_num), //1 ~ block_num
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
.in_F_valid(in_F_valid),
|
| 113 |
+
.in_F_last(in_F_last),
|
| 114 |
+
.in_F_ready(in_F_ready),
|
| 115 |
+
.in_F_data(in_F_data),
|
| 116 |
+
|
| 117 |
+
.in_W_valid(in_W_valid),
|
| 118 |
+
.in_W_last(in_W_last),
|
| 119 |
+
.in_W_ready(in_W_ready),
|
| 120 |
+
.in_W_data(in_W_data),
|
| 121 |
+
|
| 122 |
+
.out_data_valid(out_data_valid),
|
| 123 |
+
.out_data_last(out_data_last),
|
| 124 |
+
.out_data_ready(out_data_ready),
|
| 125 |
+
.out_data(out_data)
|
| 126 |
+
);
|
| 127 |
+
|
| 128 |
+
integer x[`IN_ROWS_NUM-1:0][`IN_COLS_NUM-1:0];
|
| 129 |
+
integer y[`IN_COLS_NUM-1:0][`OUT_COLS_NUM-1:0];
|
| 130 |
+
|
| 131 |
+
integer x_flatten[`IN_ROWS_NUM * `IN_COLS_NUM - 1:0];
|
| 132 |
+
integer y_flatten[`IN_COLS_NUM * `OUT_COLS_NUM - 1:0];
|
| 133 |
+
|
| 134 |
+
initial begin
|
| 135 |
+
integer i;
|
| 136 |
+
integer j;
|
| 137 |
+
$display("x:");
|
| 138 |
+
$write("[");
|
| 139 |
+
for(i=0;i<`IN_ROWS_NUM;i++)begin
|
| 140 |
+
$write("[");
|
| 141 |
+
for(j=0;j<`IN_COLS_NUM;j++)begin
|
| 142 |
+
// automatic integer temp = (i * `IN_COLS_NUM + j)%256 - 128;
|
| 143 |
+
automatic integer temp = $random%128;
|
| 144 |
+
// automatic integer temp = 1;
|
| 145 |
+
if (temp > 127)
|
| 146 |
+
temp = 127;
|
| 147 |
+
if(temp < -128)
|
| 148 |
+
temp = -128;
|
| 149 |
+
x[i][j] = temp;
|
| 150 |
+
x_flatten[i*`IN_COLS_NUM + j] = temp;
|
| 151 |
+
$write("%5d,",x[i][j]);
|
| 152 |
+
end
|
| 153 |
+
$display("],");
|
| 154 |
+
end
|
| 155 |
+
$write("]");
|
| 156 |
+
$display();
|
| 157 |
+
$display("y:");
|
| 158 |
+
$write("[");
|
| 159 |
+
for(i=0;i<`IN_COLS_NUM;i++)begin
|
| 160 |
+
$write("[");
|
| 161 |
+
for(j=0;j<`OUT_COLS_NUM;j++)begin
|
| 162 |
+
// automatic integer temp = j;
|
| 163 |
+
automatic integer temp = $random%128;
|
| 164 |
+
// automatic integer temp = 1;
|
| 165 |
+
if (temp > 127)
|
| 166 |
+
temp = 127;
|
| 167 |
+
if(temp < -128)
|
| 168 |
+
temp = -128;
|
| 169 |
+
y[i][j] = temp;
|
| 170 |
+
y_flatten[i*`OUT_COLS_NUM + j] = temp;
|
| 171 |
+
$write("%5d,",y[i][j]);
|
| 172 |
+
end
|
| 173 |
+
$display("],");
|
| 174 |
+
end
|
| 175 |
+
$display("]");
|
| 176 |
+
end
|
| 177 |
+
integer z_soft[`IN_ROWS_NUM-1:0][`OUT_COLS_NUM-1:0];
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
wire [`A_size * `DATA_WIDTH - 1:0] x_in_array [`IN_ROWS_NUM * P_F_width_block_num - 1:0];
|
| 182 |
+
wire [`A_size * `DATA_WIDTH - 1:0] y_in_array [`IN_COLS_NUM * P_W_width_block_num - 1:0];
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
generate
|
| 186 |
+
for(i=0;i<`IN_ROWS_NUM * P_F_width_block_num;i++)begin
|
| 187 |
+
for(j=0;j<`A_size;j++)begin
|
| 188 |
+
assign x_in_array[i][j*`DATA_WIDTH +: `DATA_WIDTH] = x_flatten[i*`A_size + j];
|
| 189 |
+
end
|
| 190 |
+
end
|
| 191 |
+
|
| 192 |
+
for(i=0;i<`IN_COLS_NUM * P_W_width_block_num;i++)begin
|
| 193 |
+
for(j=0;j<`A_size;j++)begin
|
| 194 |
+
assign y_in_array[i][j*`DATA_WIDTH +: `DATA_WIDTH] = y_flatten[i*`A_size + j];
|
| 195 |
+
end
|
| 196 |
+
end
|
| 197 |
+
endgenerate
|
| 198 |
+
|
| 199 |
+
reg start_trans;
|
| 200 |
+
initial start_trans = 0;
|
| 201 |
+
|
| 202 |
+
reg [31:0] in_F_addr;
|
| 203 |
+
initial in_F_addr = 0;
|
| 204 |
+
|
| 205 |
+
always @(posedge clk ) begin
|
| 206 |
+
if(in_F_last)
|
| 207 |
+
in_F_addr <=0;
|
| 208 |
+
if(in_F_valid)
|
| 209 |
+
in_F_addr <= in_F_addr + 1;
|
| 210 |
+
end
|
| 211 |
+
|
| 212 |
+
assign in_F_data = x_in_array[in_F_addr];
|
| 213 |
+
wire [`DATA_WIDTH - 1:0] F_in_data_display [`A_size - 1:0];
|
| 214 |
+
generate
|
| 215 |
+
for(i=0;i<`A_size;i++)begin
|
| 216 |
+
assign F_in_data_display[i] = in_F_data[i*`DATA_WIDTH +: `DATA_WIDTH];
|
| 217 |
+
end
|
| 218 |
+
endgenerate
|
| 219 |
+
assign in_F_last =(in_F_addr == `IN_ROWS_NUM * P_F_width_block_num - 1)? 1:0;
|
| 220 |
+
|
| 221 |
+
always @(posedge clk) begin
|
| 222 |
+
if(~rst_n)
|
| 223 |
+
in_F_valid <= 0;
|
| 224 |
+
else if (start_trans)
|
| 225 |
+
in_F_valid <= 1;
|
| 226 |
+
else if (in_F_last)
|
| 227 |
+
in_F_valid <= 0;
|
| 228 |
+
end
|
| 229 |
+
|
| 230 |
+
reg [31:0] in_W_addr;
|
| 231 |
+
initial in_W_addr = 0;
|
| 232 |
+
|
| 233 |
+
always @(posedge clk ) begin
|
| 234 |
+
if(in_W_last)
|
| 235 |
+
in_W_addr <=0;
|
| 236 |
+
if(in_W_valid)
|
| 237 |
+
in_W_addr <= in_W_addr + 1;
|
| 238 |
+
end
|
| 239 |
+
|
| 240 |
+
assign in_W_data = y_in_array[in_W_addr];
|
| 241 |
+
wire [`DATA_WIDTH - 1:0] W_in_data_display [`A_size - 1:0];
|
| 242 |
+
generate
|
| 243 |
+
for(i=0;i<`A_size;i++)begin
|
| 244 |
+
assign W_in_data_display[i] = in_W_data[i*`DATA_WIDTH +: `DATA_WIDTH];
|
| 245 |
+
end
|
| 246 |
+
endgenerate
|
| 247 |
+
assign in_W_last =(in_W_addr == `IN_COLS_NUM * P_W_width_block_num - 1)? 1:0;
|
| 248 |
+
|
| 249 |
+
always @(posedge clk) begin
|
| 250 |
+
if(~rst_n)
|
| 251 |
+
in_W_valid <= 0;
|
| 252 |
+
else if (start_trans)
|
| 253 |
+
in_W_valid <= 1;
|
| 254 |
+
else if (in_W_last)
|
| 255 |
+
in_W_valid <= 0;
|
| 256 |
+
end
|
| 257 |
+
|
| 258 |
+
wire [`DATA_WIDTH - 1:0] out_data_display [`A_size - 1:0];
|
| 259 |
+
generate
|
| 260 |
+
for(i=0;i<`A_size;i++)begin
|
| 261 |
+
assign out_data_display[i] = out_data[i*`DATA_WIDTH +: `DATA_WIDTH];
|
| 262 |
+
end
|
| 263 |
+
endgenerate
|
| 264 |
+
|
| 265 |
+
reg [`A_size * `DATA_WIDTH - 1:0] z_hard [`IN_ROWS_NUM * P_W_width_block_num-1:0];
|
| 266 |
+
reg [31:0] z_hard_addr;
|
| 267 |
+
integer z_hard_array [`IN_ROWS_NUM-1:0][`OUT_COLS_NUM-1:0];
|
| 268 |
+
wire [`DATA_WIDTH - 1:0] z_hard_flatten [`IN_ROWS_NUM * `OUT_COLS_NUM-1:0];
|
| 269 |
+
initial z_hard_addr = 0;
|
| 270 |
+
|
| 271 |
+
always @(posedge clk ) begin
|
| 272 |
+
if (out_data_last)
|
| 273 |
+
z_hard_addr <= 0;
|
| 274 |
+
else if(out_data_valid&out_data_ready)
|
| 275 |
+
z_hard_addr <= z_hard_addr + 1;
|
| 276 |
+
end
|
| 277 |
+
|
| 278 |
+
always @(posedge clk) begin
|
| 279 |
+
if(out_data_valid &out_data_ready)
|
| 280 |
+
z_hard[z_hard_addr] <= out_data;
|
| 281 |
+
end
|
| 282 |
+
|
| 283 |
+
generate
|
| 284 |
+
for(i = 0;i<`IN_ROWS_NUM * P_W_width_block_num;i++)begin
|
| 285 |
+
for(j=0;j<`A_size;j++)begin
|
| 286 |
+
assign z_hard_flatten[i*`A_size+j] = z_hard[i][j*`DATA_WIDTH +: `DATA_WIDTH];
|
| 287 |
+
end
|
| 288 |
+
end
|
| 289 |
+
|
| 290 |
+
for(i=0;i<`IN_ROWS_NUM;i++)begin
|
| 291 |
+
for(j=0;j<`OUT_COLS_NUM;j++)begin
|
| 292 |
+
always @(*) begin
|
| 293 |
+
z_hard_array[i][j] = $signed(z_hard_flatten[i*`OUT_COLS_NUM + j]);
|
| 294 |
+
end
|
| 295 |
+
end
|
| 296 |
+
end
|
| 297 |
+
endgenerate
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
initial clk = 0;
|
| 302 |
+
always begin
|
| 303 |
+
#5 clk = ~clk;
|
| 304 |
+
end
|
| 305 |
+
|
| 306 |
+
reg out_data_ready_gen;
|
| 307 |
+
|
| 308 |
+
initial out_data_ready_gen = 0;
|
| 309 |
+
always begin
|
| 310 |
+
#10 out_data_ready_gen = //~out_data_ready_gen;
|
| 311 |
+
{$random}%2;
|
| 312 |
+
end
|
| 313 |
+
|
| 314 |
+
always @(posedge clk ) begin
|
| 315 |
+
out_data_ready <= out_data_ready_gen;
|
| 316 |
+
end
|
| 317 |
+
|
| 318 |
+
initial begin
|
| 319 |
+
shift = 0;
|
| 320 |
+
F_length = 0;
|
| 321 |
+
F_width_block_num = 0;
|
| 322 |
+
W_width_block_num =0;
|
| 323 |
+
end
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
initial begin
|
| 327 |
+
rst_n = 0;
|
| 328 |
+
#50 rst_n = 1;
|
| 329 |
+
#50
|
| 330 |
+
#1000
|
| 331 |
+
shift = P_shift;
|
| 332 |
+
F_length = P_F_length;
|
| 333 |
+
F_width_block_num = P_F_width_block_num;
|
| 334 |
+
W_width_block_num = P_W_width_block_num;
|
| 335 |
+
MM_soft(x,y,shift,z_soft);
|
| 336 |
+
#1000 start_trans = 1;
|
| 337 |
+
#10 start_trans = 0;
|
| 338 |
+
end
|
| 339 |
+
integer error = 0;
|
| 340 |
+
integer zero_error = 0;
|
| 341 |
+
|
| 342 |
+
integer m,n;
|
| 343 |
+
always begin
|
| 344 |
+
#10
|
| 345 |
+
if(out_data_last) begin
|
| 346 |
+
error = 0;
|
| 347 |
+
#(200*`IN_ROWS_NUM)
|
| 348 |
+
$display("z_hard:");
|
| 349 |
+
for(m=0;m<`IN_ROWS_NUM;m++)begin
|
| 350 |
+
for(n=0;n<`OUT_COLS_NUM;n++)begin
|
| 351 |
+
if($signed(z_hard_array[m][n])!= z_soft[m][n])begin
|
| 352 |
+
$write("error:hard = %0d, soft = %0d. ",$signed(z_hard_array[m][n]),z_soft[m][n]);
|
| 353 |
+
error++;
|
| 354 |
+
end
|
| 355 |
+
else
|
| 356 |
+
$write("%7d,",$signed(z_hard_array[m][n]));
|
| 357 |
+
end
|
| 358 |
+
$display();
|
| 359 |
+
end
|
| 360 |
+
#10;
|
| 361 |
+
if(error != 0)
|
| 362 |
+
$display("Error!, error = %d.",error);
|
| 363 |
+
else
|
| 364 |
+
$display("No Error.");
|
| 365 |
+
|
| 366 |
+
for(m=0;m<`OUT_Feature_Block_num;m++)begin
|
| 367 |
+
if(u_MM_ultra.u_MM_out_buffer.F_array[m]!=0)
|
| 368 |
+
zero_error= zero_error+1;
|
| 369 |
+
end
|
| 370 |
+
if(zero_error != 0)
|
| 371 |
+
$display("Error!, zero_error = %d.",zero_error);
|
| 372 |
+
else
|
| 373 |
+
$display("No zero_error.");
|
| 374 |
+
$finish();
|
| 375 |
+
end
|
| 376 |
+
end
|
| 377 |
+
|
| 378 |
+
endmodule
|
Buck008_Transformer-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id="1">
|
| 7 |
+
<top_modules>
|
| 8 |
+
<top_module name="MM_Ultra_tb" />
|
| 9 |
+
<top_module name="glbl" />
|
| 10 |
+
</top_modules>
|
| 11 |
+
</db_ref>
|
| 12 |
+
</db_ref_list>
|
| 13 |
+
<zoom_setting>
|
| 14 |
+
<ZoomStartTime time="183045494684fs"></ZoomStartTime>
|
| 15 |
+
<ZoomEndTime time="190760901064fs"></ZoomEndTime>
|
| 16 |
+
<Cursor1Time time="181222017000fs"></Cursor1Time>
|
| 17 |
+
</zoom_setting>
|
| 18 |
+
<column_width_setting>
|
| 19 |
+
<NameColumnWidth column_width="306"></NameColumnWidth>
|
| 20 |
+
<ValueColumnWidth column_width="72"></ValueColumnWidth>
|
| 21 |
+
</column_width_setting>
|
| 22 |
+
<WVObjectSize size="6" />
|
| 23 |
+
<wvobject fp_name="group67" type="group">
|
| 24 |
+
<obj_property name="label">tb</obj_property>
|
| 25 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 26 |
+
<obj_property name="isExpanded"></obj_property>
|
| 27 |
+
<wvobject fp_name="/MM_Ultra_tb/clk" type="logic">
|
| 28 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 29 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 30 |
+
</wvobject>
|
| 31 |
+
<wvobject fp_name="/MM_Ultra_tb/rst_n" type="logic">
|
| 32 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 33 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 34 |
+
</wvobject>
|
| 35 |
+
<wvobject fp_name="/MM_Ultra_tb/start_trans" type="logic">
|
| 36 |
+
<obj_property name="ElementShortName">start_trans</obj_property>
|
| 37 |
+
<obj_property name="ObjectShortName">start_trans</obj_property>
|
| 38 |
+
</wvobject>
|
| 39 |
+
<wvobject fp_name="group68" type="group">
|
| 40 |
+
<obj_property name="label">registers</obj_property>
|
| 41 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 42 |
+
<obj_property name="isExpanded"></obj_property>
|
| 43 |
+
<wvobject fp_name="/MM_Ultra_tb/shift" type="array">
|
| 44 |
+
<obj_property name="ElementShortName">shift[9:0]</obj_property>
|
| 45 |
+
<obj_property name="ObjectShortName">shift[9:0]</obj_property>
|
| 46 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 47 |
+
</wvobject>
|
| 48 |
+
<wvobject fp_name="/MM_Ultra_tb/F_length" type="array">
|
| 49 |
+
<obj_property name="ElementShortName">F_length[9:0]</obj_property>
|
| 50 |
+
<obj_property name="ObjectShortName">F_length[9:0]</obj_property>
|
| 51 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 52 |
+
</wvobject>
|
| 53 |
+
<wvobject fp_name="/MM_Ultra_tb/F_width_block_num" type="array">
|
| 54 |
+
<obj_property name="ElementShortName">F_width_block_num[4:0]</obj_property>
|
| 55 |
+
<obj_property name="ObjectShortName">F_width_block_num[4:0]</obj_property>
|
| 56 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 57 |
+
</wvobject>
|
| 58 |
+
<wvobject fp_name="/MM_Ultra_tb/W_width_block_num" type="array">
|
| 59 |
+
<obj_property name="ElementShortName">W_width_block_num[4:0]</obj_property>
|
| 60 |
+
<obj_property name="ObjectShortName">W_width_block_num[4:0]</obj_property>
|
| 61 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 62 |
+
</wvobject>
|
| 63 |
+
</wvobject>
|
| 64 |
+
<wvobject fp_name="group69" type="group">
|
| 65 |
+
<obj_property name="label">IN_F</obj_property>
|
| 66 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 67 |
+
<obj_property name="isExpanded"></obj_property>
|
| 68 |
+
<wvobject fp_name="/MM_Ultra_tb/in_F_valid" type="logic">
|
| 69 |
+
<obj_property name="ElementShortName">in_F_valid</obj_property>
|
| 70 |
+
<obj_property name="ObjectShortName">in_F_valid</obj_property>
|
| 71 |
+
</wvobject>
|
| 72 |
+
<wvobject fp_name="/MM_Ultra_tb/in_F_last" type="logic">
|
| 73 |
+
<obj_property name="ElementShortName">in_F_last</obj_property>
|
| 74 |
+
<obj_property name="ObjectShortName">in_F_last</obj_property>
|
| 75 |
+
</wvobject>
|
| 76 |
+
<wvobject fp_name="/MM_Ultra_tb/in_F_ready" type="logic">
|
| 77 |
+
<obj_property name="ElementShortName">in_F_ready</obj_property>
|
| 78 |
+
<obj_property name="ObjectShortName">in_F_ready</obj_property>
|
| 79 |
+
</wvobject>
|
| 80 |
+
<wvobject fp_name="/MM_Ultra_tb/in_F_data" type="array">
|
| 81 |
+
<obj_property name="ElementShortName">in_F_data[127:0]</obj_property>
|
| 82 |
+
<obj_property name="ObjectShortName">in_F_data[127:0]</obj_property>
|
| 83 |
+
</wvobject>
|
| 84 |
+
<wvobject fp_name="/MM_Ultra_tb/in_F_addr" type="array">
|
| 85 |
+
<obj_property name="ElementShortName">in_F_addr[31:0]</obj_property>
|
| 86 |
+
<obj_property name="ObjectShortName">in_F_addr[31:0]</obj_property>
|
| 87 |
+
</wvobject>
|
| 88 |
+
<wvobject fp_name="/MM_Ultra_tb/F_in_data_display" type="array">
|
| 89 |
+
<obj_property name="ElementShortName">F_in_data_display[15:0][7:0]</obj_property>
|
| 90 |
+
<obj_property name="ObjectShortName">F_in_data_display[15:0][7:0]</obj_property>
|
| 91 |
+
</wvobject>
|
| 92 |
+
</wvobject>
|
| 93 |
+
<wvobject fp_name="group70" type="group">
|
| 94 |
+
<obj_property name="label">IN_W</obj_property>
|
| 95 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 96 |
+
<wvobject fp_name="/MM_Ultra_tb/in_W_valid" type="logic">
|
| 97 |
+
<obj_property name="ElementShortName">in_W_valid</obj_property>
|
| 98 |
+
<obj_property name="ObjectShortName">in_W_valid</obj_property>
|
| 99 |
+
</wvobject>
|
| 100 |
+
<wvobject fp_name="/MM_Ultra_tb/in_W_last" type="logic">
|
| 101 |
+
<obj_property name="ElementShortName">in_W_last</obj_property>
|
| 102 |
+
<obj_property name="ObjectShortName">in_W_last</obj_property>
|
| 103 |
+
</wvobject>
|
| 104 |
+
<wvobject fp_name="/MM_Ultra_tb/in_W_ready" type="logic">
|
| 105 |
+
<obj_property name="ElementShortName">in_W_ready</obj_property>
|
| 106 |
+
<obj_property name="ObjectShortName">in_W_ready</obj_property>
|
| 107 |
+
</wvobject>
|
| 108 |
+
<wvobject fp_name="/MM_Ultra_tb/in_W_data" type="array">
|
| 109 |
+
<obj_property name="ElementShortName">in_W_data[127:0]</obj_property>
|
| 110 |
+
<obj_property name="ObjectShortName">in_W_data[127:0]</obj_property>
|
| 111 |
+
</wvobject>
|
| 112 |
+
<wvobject fp_name="/MM_Ultra_tb/in_W_addr" type="array">
|
| 113 |
+
<obj_property name="ElementShortName">in_W_addr[31:0]</obj_property>
|
| 114 |
+
<obj_property name="ObjectShortName">in_W_addr[31:0]</obj_property>
|
| 115 |
+
</wvobject>
|
| 116 |
+
<wvobject fp_name="/MM_Ultra_tb/W_in_data_display" type="array">
|
| 117 |
+
<obj_property name="ElementShortName">W_in_data_display[15:0][7:0]</obj_property>
|
| 118 |
+
<obj_property name="ObjectShortName">W_in_data_display[15:0][7:0]</obj_property>
|
| 119 |
+
</wvobject>
|
| 120 |
+
</wvobject>
|
| 121 |
+
<wvobject fp_name="group71" type="group">
|
| 122 |
+
<obj_property name="label">OUT_D</obj_property>
|
| 123 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 124 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_valid" type="logic">
|
| 125 |
+
<obj_property name="ElementShortName">out_data_valid</obj_property>
|
| 126 |
+
<obj_property name="ObjectShortName">out_data_valid</obj_property>
|
| 127 |
+
</wvobject>
|
| 128 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_ready" type="logic">
|
| 129 |
+
<obj_property name="ElementShortName">out_data_ready</obj_property>
|
| 130 |
+
<obj_property name="ObjectShortName">out_data_ready</obj_property>
|
| 131 |
+
</wvobject>
|
| 132 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_last" type="logic">
|
| 133 |
+
<obj_property name="ElementShortName">out_data_last</obj_property>
|
| 134 |
+
<obj_property name="ObjectShortName">out_data_last</obj_property>
|
| 135 |
+
</wvobject>
|
| 136 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data" type="array">
|
| 137 |
+
<obj_property name="ElementShortName">out_data[127:0]</obj_property>
|
| 138 |
+
<obj_property name="ObjectShortName">out_data[127:0]</obj_property>
|
| 139 |
+
</wvobject>
|
| 140 |
+
<wvobject fp_name="/MM_Ultra_tb/z_hard_addr" type="array">
|
| 141 |
+
<obj_property name="ElementShortName">z_hard_addr[31:0]</obj_property>
|
| 142 |
+
<obj_property name="ObjectShortName">z_hard_addr[31:0]</obj_property>
|
| 143 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 144 |
+
</wvobject>
|
| 145 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_display" type="array">
|
| 146 |
+
<obj_property name="ElementShortName">out_data_display[15:0][7:0]</obj_property>
|
| 147 |
+
<obj_property name="ObjectShortName">out_data_display[15:0][7:0]</obj_property>
|
| 148 |
+
<obj_property name="Radix">SIGNEDDECRADIX</obj_property>
|
| 149 |
+
</wvobject>
|
| 150 |
+
</wvobject>
|
| 151 |
+
<wvobject fp_name="group72" type="group">
|
| 152 |
+
<obj_property name="label">parameters</obj_property>
|
| 153 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 154 |
+
<wvobject fp_name="/MM_Ultra_tb/P_shift" type="array">
|
| 155 |
+
<obj_property name="ElementShortName">P_shift[31:0]</obj_property>
|
| 156 |
+
<obj_property name="ObjectShortName">P_shift[31:0]</obj_property>
|
| 157 |
+
</wvobject>
|
| 158 |
+
<wvobject fp_name="/MM_Ultra_tb/P_F_length" type="array">
|
| 159 |
+
<obj_property name="ElementShortName">P_F_length[31:0]</obj_property>
|
| 160 |
+
<obj_property name="ObjectShortName">P_F_length[31:0]</obj_property>
|
| 161 |
+
</wvobject>
|
| 162 |
+
<wvobject fp_name="/MM_Ultra_tb/P_F_width_block_num" type="array">
|
| 163 |
+
<obj_property name="ElementShortName">P_F_width_block_num[31:0]</obj_property>
|
| 164 |
+
<obj_property name="ObjectShortName">P_F_width_block_num[31:0]</obj_property>
|
| 165 |
+
</wvobject>
|
| 166 |
+
<wvobject fp_name="/MM_Ultra_tb/P_W_width_block_num" type="array">
|
| 167 |
+
<obj_property name="ElementShortName">P_W_width_block_num[31:0]</obj_property>
|
| 168 |
+
<obj_property name="ObjectShortName">P_W_width_block_num[31:0]</obj_property>
|
| 169 |
+
</wvobject>
|
| 170 |
+
</wvobject>
|
| 171 |
+
</wvobject>
|
| 172 |
+
<wvobject fp_name="group116" type="group">
|
| 173 |
+
<obj_property name="label">MM_Ultra</obj_property>
|
| 174 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 175 |
+
<obj_property name="isExpanded"></obj_property>
|
| 176 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/clk" type="logic">
|
| 177 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 178 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 179 |
+
</wvobject>
|
| 180 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/rst_n" type="logic">
|
| 181 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 182 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 183 |
+
</wvobject>
|
| 184 |
+
<wvobject fp_name="group108" type="group">
|
| 185 |
+
<obj_property name="label">registers</obj_property>
|
| 186 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 187 |
+
<obj_property name="isExpanded"></obj_property>
|
| 188 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/shift" type="array">
|
| 189 |
+
<obj_property name="ElementShortName">shift[9:0]</obj_property>
|
| 190 |
+
<obj_property name="ObjectShortName">shift[9:0]</obj_property>
|
| 191 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 192 |
+
</wvobject>
|
| 193 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/F_length" type="array">
|
| 194 |
+
<obj_property name="ElementShortName">F_length[9:0]</obj_property>
|
| 195 |
+
<obj_property name="ObjectShortName">F_length[9:0]</obj_property>
|
| 196 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 197 |
+
</wvobject>
|
| 198 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/F_width_block_num" type="array">
|
| 199 |
+
<obj_property name="ElementShortName">F_width_block_num[4:0]</obj_property>
|
| 200 |
+
<obj_property name="ObjectShortName">F_width_block_num[4:0]</obj_property>
|
| 201 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 202 |
+
</wvobject>
|
| 203 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/W_width_block_num" type="array">
|
| 204 |
+
<obj_property name="ElementShortName">W_width_block_num[4:0]</obj_property>
|
| 205 |
+
<obj_property name="ObjectShortName">W_width_block_num[4:0]</obj_property>
|
| 206 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 207 |
+
</wvobject>
|
| 208 |
+
</wvobject>
|
| 209 |
+
<wvobject fp_name="group109" type="group">
|
| 210 |
+
<obj_property name="label">IN_F</obj_property>
|
| 211 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 212 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_F_valid" type="logic">
|
| 213 |
+
<obj_property name="ElementShortName">in_F_valid</obj_property>
|
| 214 |
+
<obj_property name="ObjectShortName">in_F_valid</obj_property>
|
| 215 |
+
</wvobject>
|
| 216 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_F_last" type="logic">
|
| 217 |
+
<obj_property name="ElementShortName">in_F_last</obj_property>
|
| 218 |
+
<obj_property name="ObjectShortName">in_F_last</obj_property>
|
| 219 |
+
</wvobject>
|
| 220 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_F_ready" type="logic">
|
| 221 |
+
<obj_property name="ElementShortName">in_F_ready</obj_property>
|
| 222 |
+
<obj_property name="ObjectShortName">in_F_ready</obj_property>
|
| 223 |
+
</wvobject>
|
| 224 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_F_data" type="array">
|
| 225 |
+
<obj_property name="ElementShortName">in_F_data[127:0]</obj_property>
|
| 226 |
+
<obj_property name="ObjectShortName">in_F_data[127:0]</obj_property>
|
| 227 |
+
</wvobject>
|
| 228 |
+
</wvobject>
|
| 229 |
+
<wvobject fp_name="group110" type="group">
|
| 230 |
+
<obj_property name="label">IN_W</obj_property>
|
| 231 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 232 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_W_valid" type="logic">
|
| 233 |
+
<obj_property name="ElementShortName">in_W_valid</obj_property>
|
| 234 |
+
<obj_property name="ObjectShortName">in_W_valid</obj_property>
|
| 235 |
+
</wvobject>
|
| 236 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_W_last" type="logic">
|
| 237 |
+
<obj_property name="ElementShortName">in_W_last</obj_property>
|
| 238 |
+
<obj_property name="ObjectShortName">in_W_last</obj_property>
|
| 239 |
+
</wvobject>
|
| 240 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_W_ready" type="logic">
|
| 241 |
+
<obj_property name="ElementShortName">in_W_ready</obj_property>
|
| 242 |
+
<obj_property name="ObjectShortName">in_W_ready</obj_property>
|
| 243 |
+
</wvobject>
|
| 244 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_W_data" type="array">
|
| 245 |
+
<obj_property name="ElementShortName">in_W_data[127:0]</obj_property>
|
| 246 |
+
<obj_property name="ObjectShortName">in_W_data[127:0]</obj_property>
|
| 247 |
+
</wvobject>
|
| 248 |
+
</wvobject>
|
| 249 |
+
<wvobject fp_name="group111" type="group">
|
| 250 |
+
<obj_property name="label">OUT_D</obj_property>
|
| 251 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 252 |
+
<obj_property name="isExpanded"></obj_property>
|
| 253 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/out_data_valid" type="logic">
|
| 254 |
+
<obj_property name="ElementShortName">out_data_valid</obj_property>
|
| 255 |
+
<obj_property name="ObjectShortName">out_data_valid</obj_property>
|
| 256 |
+
</wvobject>
|
| 257 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_ready" type="logic">
|
| 258 |
+
<obj_property name="ElementShortName">out_data_ready</obj_property>
|
| 259 |
+
<obj_property name="ObjectShortName">out_data_ready</obj_property>
|
| 260 |
+
</wvobject>
|
| 261 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/out_data_last" type="logic">
|
| 262 |
+
<obj_property name="ElementShortName">out_data_last</obj_property>
|
| 263 |
+
<obj_property name="ObjectShortName">out_data_last</obj_property>
|
| 264 |
+
</wvobject>
|
| 265 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/out_data" type="array">
|
| 266 |
+
<obj_property name="ElementShortName">out_data[127:0]</obj_property>
|
| 267 |
+
<obj_property name="ObjectShortName">out_data[127:0]</obj_property>
|
| 268 |
+
</wvobject>
|
| 269 |
+
<wvobject fp_name="/MM_Ultra_tb/out_data_display" type="array">
|
| 270 |
+
<obj_property name="ElementShortName">out_data_display[15:0][7:0]</obj_property>
|
| 271 |
+
<obj_property name="ObjectShortName">out_data_display[15:0][7:0]</obj_property>
|
| 272 |
+
<obj_property name="Radix">SIGNEDDECRADIX</obj_property>
|
| 273 |
+
</wvobject>
|
| 274 |
+
</wvobject>
|
| 275 |
+
<wvobject fp_name="group112" type="group">
|
| 276 |
+
<obj_property name="label">MM_buffer_out</obj_property>
|
| 277 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 278 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/MM_buffer_out_data" type="array">
|
| 279 |
+
<obj_property name="ElementShortName">MM_buffer_out_data[319:0]</obj_property>
|
| 280 |
+
<obj_property name="ObjectShortName">MM_buffer_out_data[319:0]</obj_property>
|
| 281 |
+
</wvobject>
|
| 282 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/MM_buffer_out_valid" type="logic">
|
| 283 |
+
<obj_property name="ElementShortName">MM_buffer_out_valid</obj_property>
|
| 284 |
+
<obj_property name="ObjectShortName">MM_buffer_out_valid</obj_property>
|
| 285 |
+
</wvobject>
|
| 286 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/MM_buffer_out_last" type="logic">
|
| 287 |
+
<obj_property name="ElementShortName">MM_buffer_out_last</obj_property>
|
| 288 |
+
<obj_property name="ObjectShortName">MM_buffer_out_last</obj_property>
|
| 289 |
+
</wvobject>
|
| 290 |
+
</wvobject>
|
| 291 |
+
<wvobject fp_name="group113" type="group">
|
| 292 |
+
<obj_property name="label">IN_MM_buffer_F</obj_property>
|
| 293 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 294 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_F_valid" type="logic">
|
| 295 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_valid</obj_property>
|
| 296 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_valid</obj_property>
|
| 297 |
+
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
| 298 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 299 |
+
</wvobject>
|
| 300 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_F_last" type="logic">
|
| 301 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_last</obj_property>
|
| 302 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_last</obj_property>
|
| 303 |
+
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
| 304 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 305 |
+
</wvobject>
|
| 306 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_F_ready" type="logic">
|
| 307 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_ready</obj_property>
|
| 308 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_ready</obj_property>
|
| 309 |
+
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
| 310 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 311 |
+
</wvobject>
|
| 312 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_F_data" type="array">
|
| 313 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_data[127:0]</obj_property>
|
| 314 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_data[127:0]</obj_property>
|
| 315 |
+
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
| 316 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 317 |
+
</wvobject>
|
| 318 |
+
</wvobject>
|
| 319 |
+
<wvobject fp_name="group114" type="group">
|
| 320 |
+
<obj_property name="label">IN_MM_buffer_W</obj_property>
|
| 321 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 322 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_W_valid" type="logic">
|
| 323 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_valid</obj_property>
|
| 324 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_valid</obj_property>
|
| 325 |
+
<obj_property name="CustomSignalColor">#00FFFF</obj_property>
|
| 326 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 327 |
+
</wvobject>
|
| 328 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_W_last" type="logic">
|
| 329 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_last</obj_property>
|
| 330 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_last</obj_property>
|
| 331 |
+
<obj_property name="CustomSignalColor">#00FFFF</obj_property>
|
| 332 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 333 |
+
</wvobject>
|
| 334 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_W_ready" type="logic">
|
| 335 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_ready</obj_property>
|
| 336 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_ready</obj_property>
|
| 337 |
+
<obj_property name="CustomSignalColor">#00FFFF</obj_property>
|
| 338 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 339 |
+
</wvobject>
|
| 340 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/in_MM_buffer_W_data" type="array">
|
| 341 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_data[127:0]</obj_property>
|
| 342 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_data[127:0]</obj_property>
|
| 343 |
+
<obj_property name="CustomSignalColor">#00FFFF</obj_property>
|
| 344 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 345 |
+
</wvobject>
|
| 346 |
+
</wvobject>
|
| 347 |
+
<wvobject fp_name="group115" type="group">
|
| 348 |
+
<obj_property name="label">parameters</obj_property>
|
| 349 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 350 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/A_size" type="array">
|
| 351 |
+
<obj_property name="ElementShortName">A_size[31:0]</obj_property>
|
| 352 |
+
<obj_property name="ObjectShortName">A_size[31:0]</obj_property>
|
| 353 |
+
</wvobject>
|
| 354 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/data_width" type="array">
|
| 355 |
+
<obj_property name="ElementShortName">data_width[31:0]</obj_property>
|
| 356 |
+
<obj_property name="ObjectShortName">data_width[31:0]</obj_property>
|
| 357 |
+
</wvobject>
|
| 358 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/shift_width" type="array">
|
| 359 |
+
<obj_property name="ElementShortName">shift_width[31:0]</obj_property>
|
| 360 |
+
<obj_property name="ObjectShortName">shift_width[31:0]</obj_property>
|
| 361 |
+
</wvobject>
|
| 362 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/log2_array_m" type="array">
|
| 363 |
+
<obj_property name="ElementShortName">log2_array_m[31:0]</obj_property>
|
| 364 |
+
<obj_property name="ObjectShortName">log2_array_m[31:0]</obj_property>
|
| 365 |
+
</wvobject>
|
| 366 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/Weight_Block_num" type="array">
|
| 367 |
+
<obj_property name="ElementShortName">Weight_Block_num[31:0]</obj_property>
|
| 368 |
+
<obj_property name="ObjectShortName">Weight_Block_num[31:0]</obj_property>
|
| 369 |
+
</wvobject>
|
| 370 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/IN_Feature_Block_num" type="array">
|
| 371 |
+
<obj_property name="ElementShortName">IN_Feature_Block_num[31:0]</obj_property>
|
| 372 |
+
<obj_property name="ObjectShortName">IN_Feature_Block_num[31:0]</obj_property>
|
| 373 |
+
</wvobject>
|
| 374 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/OUT_Feature_Block_num" type="array">
|
| 375 |
+
<obj_property name="ElementShortName">OUT_Feature_Block_num[31:0]</obj_property>
|
| 376 |
+
<obj_property name="ObjectShortName">OUT_Feature_Block_num[31:0]</obj_property>
|
| 377 |
+
</wvobject>
|
| 378 |
+
</wvobject>
|
| 379 |
+
</wvobject>
|
| 380 |
+
<wvobject fp_name="group1982" type="group">
|
| 381 |
+
<obj_property name="label">MM_in_buffer</obj_property>
|
| 382 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 383 |
+
<obj_property name="isExpanded"></obj_property>
|
| 384 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/clk" type="logic">
|
| 385 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 386 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 387 |
+
</wvobject>
|
| 388 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/rst_n" type="logic">
|
| 389 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 390 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 391 |
+
</wvobject>
|
| 392 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/MM_buffer_out_last" type="logic">
|
| 393 |
+
<obj_property name="ElementShortName">MM_buffer_out_last</obj_property>
|
| 394 |
+
<obj_property name="ObjectShortName">MM_buffer_out_last</obj_property>
|
| 395 |
+
</wvobject>
|
| 396 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/start" type="logic">
|
| 397 |
+
<obj_property name="ElementShortName">start</obj_property>
|
| 398 |
+
<obj_property name="ObjectShortName">start</obj_property>
|
| 399 |
+
</wvobject>
|
| 400 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/state" type="array">
|
| 401 |
+
<obj_property name="ElementShortName">state[1:0]</obj_property>
|
| 402 |
+
<obj_property name="ObjectShortName">state[1:0]</obj_property>
|
| 403 |
+
</wvobject>
|
| 404 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/W_block_size" type="array">
|
| 405 |
+
<obj_property name="ElementShortName">W_block_size[11:0]</obj_property>
|
| 406 |
+
<obj_property name="ObjectShortName">W_block_size[11:0]</obj_property>
|
| 407 |
+
</wvobject>
|
| 408 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_block_size" type="array">
|
| 409 |
+
<obj_property name="ElementShortName">F_block_size[11:0]</obj_property>
|
| 410 |
+
<obj_property name="ObjectShortName">F_block_size[11:0]</obj_property>
|
| 411 |
+
</wvobject>
|
| 412 |
+
<wvobject fp_name="group1983" type="group">
|
| 413 |
+
<obj_property name="label">registers</obj_property>
|
| 414 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 415 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/W_width_block_num" type="array">
|
| 416 |
+
<obj_property name="ElementShortName">W_width_block_num[4:0]</obj_property>
|
| 417 |
+
<obj_property name="ObjectShortName">W_width_block_num[4:0]</obj_property>
|
| 418 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 419 |
+
</wvobject>
|
| 420 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_width_block_num" type="array">
|
| 421 |
+
<obj_property name="ElementShortName">F_width_block_num[4:0]</obj_property>
|
| 422 |
+
<obj_property name="ObjectShortName">F_width_block_num[4:0]</obj_property>
|
| 423 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 424 |
+
</wvobject>
|
| 425 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_length" type="array">
|
| 426 |
+
<obj_property name="ElementShortName">F_length[9:0]</obj_property>
|
| 427 |
+
<obj_property name="ObjectShortName">F_length[9:0]</obj_property>
|
| 428 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 429 |
+
</wvobject>
|
| 430 |
+
</wvobject>
|
| 431 |
+
<wvobject fp_name="group1984" type="group">
|
| 432 |
+
<obj_property name="label">IN_F</obj_property>
|
| 433 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 434 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_valid" type="logic">
|
| 435 |
+
<obj_property name="ElementShortName">in_F_valid</obj_property>
|
| 436 |
+
<obj_property name="ObjectShortName">in_F_valid</obj_property>
|
| 437 |
+
</wvobject>
|
| 438 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_last" type="logic">
|
| 439 |
+
<obj_property name="ElementShortName">in_F_last</obj_property>
|
| 440 |
+
<obj_property name="ObjectShortName">in_F_last</obj_property>
|
| 441 |
+
</wvobject>
|
| 442 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_ready" type="logic">
|
| 443 |
+
<obj_property name="ElementShortName">in_F_ready</obj_property>
|
| 444 |
+
<obj_property name="ObjectShortName">in_F_ready</obj_property>
|
| 445 |
+
</wvobject>
|
| 446 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_data" type="array">
|
| 447 |
+
<obj_property name="ElementShortName">in_F_data[127:0]</obj_property>
|
| 448 |
+
<obj_property name="ObjectShortName">in_F_data[127:0]</obj_property>
|
| 449 |
+
</wvobject>
|
| 450 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_cnt" type="array">
|
| 451 |
+
<obj_property name="ElementShortName">in_F_cnt[11:0]</obj_property>
|
| 452 |
+
<obj_property name="ObjectShortName">in_F_cnt[11:0]</obj_property>
|
| 453 |
+
</wvobject>
|
| 454 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_F_addr" type="array">
|
| 455 |
+
<obj_property name="ElementShortName">in_F_addr[11:0]</obj_property>
|
| 456 |
+
<obj_property name="ObjectShortName">in_F_addr[11:0]</obj_property>
|
| 457 |
+
</wvobject>
|
| 458 |
+
</wvobject>
|
| 459 |
+
<wvobject fp_name="group1985" type="group">
|
| 460 |
+
<obj_property name="label">IN_W</obj_property>
|
| 461 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 462 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_valid" type="logic">
|
| 463 |
+
<obj_property name="ElementShortName">in_W_valid</obj_property>
|
| 464 |
+
<obj_property name="ObjectShortName">in_W_valid</obj_property>
|
| 465 |
+
</wvobject>
|
| 466 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_last" type="logic">
|
| 467 |
+
<obj_property name="ElementShortName">in_W_last</obj_property>
|
| 468 |
+
<obj_property name="ObjectShortName">in_W_last</obj_property>
|
| 469 |
+
</wvobject>
|
| 470 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_ready" type="logic">
|
| 471 |
+
<obj_property name="ElementShortName">in_W_ready</obj_property>
|
| 472 |
+
<obj_property name="ObjectShortName">in_W_ready</obj_property>
|
| 473 |
+
</wvobject>
|
| 474 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_data" type="array">
|
| 475 |
+
<obj_property name="ElementShortName">in_W_data[127:0]</obj_property>
|
| 476 |
+
<obj_property name="ObjectShortName">in_W_data[127:0]</obj_property>
|
| 477 |
+
</wvobject>
|
| 478 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_cnt" type="array">
|
| 479 |
+
<obj_property name="ElementShortName">in_W_cnt[11:0]</obj_property>
|
| 480 |
+
<obj_property name="ObjectShortName">in_W_cnt[11:0]</obj_property>
|
| 481 |
+
</wvobject>
|
| 482 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_W_addr" type="array">
|
| 483 |
+
<obj_property name="ElementShortName">in_W_addr[11:0]</obj_property>
|
| 484 |
+
<obj_property name="ObjectShortName">in_W_addr[11:0]</obj_property>
|
| 485 |
+
</wvobject>
|
| 486 |
+
</wvobject>
|
| 487 |
+
<wvobject fp_name="group1986" type="group">
|
| 488 |
+
<obj_property name="label">IN_MM_buffer_F</obj_property>
|
| 489 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 490 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_F_valid" type="logic">
|
| 491 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_valid</obj_property>
|
| 492 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_valid</obj_property>
|
| 493 |
+
</wvobject>
|
| 494 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_F_last" type="logic">
|
| 495 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_last</obj_property>
|
| 496 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_last</obj_property>
|
| 497 |
+
</wvobject>
|
| 498 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_F_ready" type="logic">
|
| 499 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_ready</obj_property>
|
| 500 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_ready</obj_property>
|
| 501 |
+
</wvobject>
|
| 502 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_F_data" type="array">
|
| 503 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_data[127:0]</obj_property>
|
| 504 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_data[127:0]</obj_property>
|
| 505 |
+
</wvobject>
|
| 506 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_F_cnt" type="array">
|
| 507 |
+
<obj_property name="ElementShortName">in_MM_buffer_F_cnt[11:0]</obj_property>
|
| 508 |
+
<obj_property name="ObjectShortName">in_MM_buffer_F_cnt[11:0]</obj_property>
|
| 509 |
+
</wvobject>
|
| 510 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/out_F_row_addr" type="array">
|
| 511 |
+
<obj_property name="ElementShortName">out_F_row_addr[9:0]</obj_property>
|
| 512 |
+
<obj_property name="ObjectShortName">out_F_row_addr[9:0]</obj_property>
|
| 513 |
+
</wvobject>
|
| 514 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/out_F_col_addr" type="array">
|
| 515 |
+
<obj_property name="ElementShortName">out_F_col_addr[4:0]</obj_property>
|
| 516 |
+
<obj_property name="ObjectShortName">out_F_col_addr[4:0]</obj_property>
|
| 517 |
+
</wvobject>
|
| 518 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/out_F_addr" type="array">
|
| 519 |
+
<obj_property name="ElementShortName">out_F_addr[11:0]</obj_property>
|
| 520 |
+
<obj_property name="ObjectShortName">out_F_addr[11:0]</obj_property>
|
| 521 |
+
</wvobject>
|
| 522 |
+
</wvobject>
|
| 523 |
+
<wvobject fp_name="group1987" type="group">
|
| 524 |
+
<obj_property name="label">IN_MM_buffer_W</obj_property>
|
| 525 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 526 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_W_valid" type="logic">
|
| 527 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_valid</obj_property>
|
| 528 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_valid</obj_property>
|
| 529 |
+
</wvobject>
|
| 530 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_W_last" type="logic">
|
| 531 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_last</obj_property>
|
| 532 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_last</obj_property>
|
| 533 |
+
</wvobject>
|
| 534 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_W_ready" type="logic">
|
| 535 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_ready</obj_property>
|
| 536 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_ready</obj_property>
|
| 537 |
+
</wvobject>
|
| 538 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_W_data" type="array">
|
| 539 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_data[127:0]</obj_property>
|
| 540 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_data[127:0]</obj_property>
|
| 541 |
+
</wvobject>
|
| 542 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/in_MM_buffer_W_cnt" type="array">
|
| 543 |
+
<obj_property name="ElementShortName">in_MM_buffer_W_cnt[11:0]</obj_property>
|
| 544 |
+
<obj_property name="ObjectShortName">in_MM_buffer_W_cnt[11:0]</obj_property>
|
| 545 |
+
</wvobject>
|
| 546 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/out_W_addr" type="array">
|
| 547 |
+
<obj_property name="ElementShortName">out_W_addr[11:0]</obj_property>
|
| 548 |
+
<obj_property name="ObjectShortName">out_W_addr[11:0]</obj_property>
|
| 549 |
+
</wvobject>
|
| 550 |
+
</wvobject>
|
| 551 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/temp_m" type="array">
|
| 552 |
+
<obj_property name="ElementShortName">temp_m[8:0]</obj_property>
|
| 553 |
+
<obj_property name="ObjectShortName">temp_m[8:0]</obj_property>
|
| 554 |
+
</wvobject>
|
| 555 |
+
<wvobject fp_name="group1988" type="group">
|
| 556 |
+
<obj_property name="label">parameters</obj_property>
|
| 557 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 558 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/A_size" type="array">
|
| 559 |
+
<obj_property name="ElementShortName">A_size[31:0]</obj_property>
|
| 560 |
+
<obj_property name="ObjectShortName">A_size[31:0]</obj_property>
|
| 561 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 562 |
+
</wvobject>
|
| 563 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/data_width" type="array">
|
| 564 |
+
<obj_property name="ElementShortName">data_width[31:0]</obj_property>
|
| 565 |
+
<obj_property name="ObjectShortName">data_width[31:0]</obj_property>
|
| 566 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 567 |
+
</wvobject>
|
| 568 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/Weight_Block_num" type="array">
|
| 569 |
+
<obj_property name="ElementShortName">Weight_Block_num[31:0]</obj_property>
|
| 570 |
+
<obj_property name="ObjectShortName">Weight_Block_num[31:0]</obj_property>
|
| 571 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 572 |
+
</wvobject>
|
| 573 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/IN_Feature_Block_num" type="array">
|
| 574 |
+
<obj_property name="ElementShortName">IN_Feature_Block_num[31:0]</obj_property>
|
| 575 |
+
<obj_property name="ObjectShortName">IN_Feature_Block_num[31:0]</obj_property>
|
| 576 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 577 |
+
</wvobject>
|
| 578 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_length_width" type="array">
|
| 579 |
+
<obj_property name="ElementShortName">F_length_width[31:0]</obj_property>
|
| 580 |
+
<obj_property name="ObjectShortName">F_length_width[31:0]</obj_property>
|
| 581 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 582 |
+
</wvobject>
|
| 583 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_width_block_num_width" type="array">
|
| 584 |
+
<obj_property name="ElementShortName">F_width_block_num_width[31:0]</obj_property>
|
| 585 |
+
<obj_property name="ObjectShortName">F_width_block_num_width[31:0]</obj_property>
|
| 586 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 587 |
+
</wvobject>
|
| 588 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/W_width_block_num_width" type="array">
|
| 589 |
+
<obj_property name="ElementShortName">W_width_block_num_width[31:0]</obj_property>
|
| 590 |
+
<obj_property name="ObjectShortName">W_width_block_num_width[31:0]</obj_property>
|
| 591 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 592 |
+
</wvobject>
|
| 593 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/F_size_width" type="array">
|
| 594 |
+
<obj_property name="ElementShortName">F_size_width[31:0]</obj_property>
|
| 595 |
+
<obj_property name="ObjectShortName">F_size_width[31:0]</obj_property>
|
| 596 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 597 |
+
</wvobject>
|
| 598 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/W_size_width" type="array">
|
| 599 |
+
<obj_property name="ElementShortName">W_size_width[31:0]</obj_property>
|
| 600 |
+
<obj_property name="ObjectShortName">W_size_width[31:0]</obj_property>
|
| 601 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 602 |
+
</wvobject>
|
| 603 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_in_buffer/log_A_size" type="array">
|
| 604 |
+
<obj_property name="ElementShortName">log_A_size[31:0]</obj_property>
|
| 605 |
+
<obj_property name="ObjectShortName">log_A_size[31:0]</obj_property>
|
| 606 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 607 |
+
</wvobject>
|
| 608 |
+
</wvobject>
|
| 609 |
+
</wvobject>
|
| 610 |
+
<wvobject fp_name="group230" type="group">
|
| 611 |
+
<obj_property name="label">MM_buffer</obj_property>
|
| 612 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 613 |
+
<obj_property name="isExpanded"></obj_property>
|
| 614 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/clk" type="logic">
|
| 615 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 616 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 617 |
+
</wvobject>
|
| 618 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/rst_n" type="logic">
|
| 619 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 620 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 621 |
+
</wvobject>
|
| 622 |
+
<wvobject fp_name="group220" type="group">
|
| 623 |
+
<obj_property name="label">registers</obj_property>
|
| 624 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 625 |
+
<obj_property name="isExpanded"></obj_property>
|
| 626 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/FL" type="array">
|
| 627 |
+
<obj_property name="ElementShortName">FL[9:0]</obj_property>
|
| 628 |
+
<obj_property name="ObjectShortName">FL[9:0]</obj_property>
|
| 629 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 630 |
+
</wvobject>
|
| 631 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/num_blobk_W" type="array">
|
| 632 |
+
<obj_property name="ElementShortName">num_blobk_W[4:0]</obj_property>
|
| 633 |
+
<obj_property name="ObjectShortName">num_blobk_W[4:0]</obj_property>
|
| 634 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 635 |
+
</wvobject>
|
| 636 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/total_WL_reg" type="array">
|
| 637 |
+
<obj_property name="ElementShortName">total_WL_reg[8:0]</obj_property>
|
| 638 |
+
<obj_property name="ObjectShortName">total_WL_reg[8:0]</obj_property>
|
| 639 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 640 |
+
</wvobject>
|
| 641 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/FL_reg" type="array">
|
| 642 |
+
<obj_property name="ElementShortName">FL_reg[9:0]</obj_property>
|
| 643 |
+
<obj_property name="ObjectShortName">FL_reg[9:0]</obj_property>
|
| 644 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 645 |
+
</wvobject>
|
| 646 |
+
</wvobject>
|
| 647 |
+
<wvobject fp_name="group224" type="group">
|
| 648 |
+
<obj_property name="label">Control</obj_property>
|
| 649 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 650 |
+
<obj_property name="isExpanded"></obj_property>
|
| 651 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/state" type="array">
|
| 652 |
+
<obj_property name="ElementShortName">state[1:0]</obj_property>
|
| 653 |
+
<obj_property name="ObjectShortName">state[1:0]</obj_property>
|
| 654 |
+
</wvobject>
|
| 655 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/start" type="logic">
|
| 656 |
+
<obj_property name="ElementShortName">start</obj_property>
|
| 657 |
+
<obj_property name="ObjectShortName">start</obj_property>
|
| 658 |
+
</wvobject>
|
| 659 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/start_ahead1" type="logic">
|
| 660 |
+
<obj_property name="ElementShortName">start_ahead1</obj_property>
|
| 661 |
+
<obj_property name="ObjectShortName">start_ahead1</obj_property>
|
| 662 |
+
</wvobject>
|
| 663 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/set_w_delay1" type="logic">
|
| 664 |
+
<obj_property name="ElementShortName">set_w_delay1</obj_property>
|
| 665 |
+
<obj_property name="ObjectShortName">set_w_delay1</obj_property>
|
| 666 |
+
</wvobject>
|
| 667 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/w_end" type="logic">
|
| 668 |
+
<obj_property name="ElementShortName">w_end</obj_property>
|
| 669 |
+
<obj_property name="ObjectShortName">w_end</obj_property>
|
| 670 |
+
</wvobject>
|
| 671 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/weight_flag_up" type="logic">
|
| 672 |
+
<obj_property name="ElementShortName">weight_flag_up</obj_property>
|
| 673 |
+
<obj_property name="ObjectShortName">weight_flag_up</obj_property>
|
| 674 |
+
</wvobject>
|
| 675 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/both_full" type="logic">
|
| 676 |
+
<obj_property name="ElementShortName">both_full</obj_property>
|
| 677 |
+
<obj_property name="ObjectShortName">both_full</obj_property>
|
| 678 |
+
</wvobject>
|
| 679 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/both_full_delay1" type="logic">
|
| 680 |
+
<obj_property name="ElementShortName">both_full_delay1</obj_property>
|
| 681 |
+
<obj_property name="ObjectShortName">both_full_delay1</obj_property>
|
| 682 |
+
</wvobject>
|
| 683 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/set_w" type="logic">
|
| 684 |
+
<obj_property name="ElementShortName">set_w</obj_property>
|
| 685 |
+
<obj_property name="ObjectShortName">set_w</obj_property>
|
| 686 |
+
</wvobject>
|
| 687 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/total_last" type="logic">
|
| 688 |
+
<obj_property name="ElementShortName">total_last</obj_property>
|
| 689 |
+
<obj_property name="ObjectShortName">total_last</obj_property>
|
| 690 |
+
</wvobject>
|
| 691 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/wdata_flag_up" type="logic">
|
| 692 |
+
<obj_property name="ElementShortName">wdata_flag_up</obj_property>
|
| 693 |
+
<obj_property name="ObjectShortName">wdata_flag_up</obj_property>
|
| 694 |
+
</wvobject>
|
| 695 |
+
</wvobject>
|
| 696 |
+
<wvobject fp_name="group221" type="group">
|
| 697 |
+
<obj_property name="label">MM_buffer_in_weight</obj_property>
|
| 698 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 699 |
+
<obj_property name="isExpanded"></obj_property>
|
| 700 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inWeight_data" type="array">
|
| 701 |
+
<obj_property name="ElementShortName">MM_buffer_inWeight_data[127:0]</obj_property>
|
| 702 |
+
<obj_property name="ObjectShortName">MM_buffer_inWeight_data[127:0]</obj_property>
|
| 703 |
+
</wvobject>
|
| 704 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inWeight_valid" type="logic">
|
| 705 |
+
<obj_property name="ElementShortName">MM_buffer_inWeight_valid</obj_property>
|
| 706 |
+
<obj_property name="ObjectShortName">MM_buffer_inWeight_valid</obj_property>
|
| 707 |
+
</wvobject>
|
| 708 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inWeight_ready" type="logic">
|
| 709 |
+
<obj_property name="ElementShortName">MM_buffer_inWeight_ready</obj_property>
|
| 710 |
+
<obj_property name="ObjectShortName">MM_buffer_inWeight_ready</obj_property>
|
| 711 |
+
</wvobject>
|
| 712 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inWeight_last" type="logic">
|
| 713 |
+
<obj_property name="ElementShortName">MM_buffer_inWeight_last</obj_property>
|
| 714 |
+
<obj_property name="ObjectShortName">MM_buffer_inWeight_last</obj_property>
|
| 715 |
+
</wvobject>
|
| 716 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/weight_buffer_cnt" type="array">
|
| 717 |
+
<obj_property name="ElementShortName">weight_buffer_cnt[8:0]</obj_property>
|
| 718 |
+
<obj_property name="ObjectShortName">weight_buffer_cnt[8:0]</obj_property>
|
| 719 |
+
</wvobject>
|
| 720 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/weight_buffer_in_addr" type="array">
|
| 721 |
+
<obj_property name="ElementShortName">weight_buffer_in_addr[8:0]</obj_property>
|
| 722 |
+
<obj_property name="ObjectShortName">weight_buffer_in_addr[8:0]</obj_property>
|
| 723 |
+
</wvobject>
|
| 724 |
+
</wvobject>
|
| 725 |
+
<wvobject fp_name="group222" type="group">
|
| 726 |
+
<obj_property name="label">MM_buffer_in_feature</obj_property>
|
| 727 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 728 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inFeature_data" type="array">
|
| 729 |
+
<obj_property name="ElementShortName">MM_buffer_inFeature_data[127:0]</obj_property>
|
| 730 |
+
<obj_property name="ObjectShortName">MM_buffer_inFeature_data[127:0]</obj_property>
|
| 731 |
+
</wvobject>
|
| 732 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inFeature_valid" type="logic">
|
| 733 |
+
<obj_property name="ElementShortName">MM_buffer_inFeature_valid</obj_property>
|
| 734 |
+
<obj_property name="ObjectShortName">MM_buffer_inFeature_valid</obj_property>
|
| 735 |
+
</wvobject>
|
| 736 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inFeature_ready" type="logic">
|
| 737 |
+
<obj_property name="ElementShortName">MM_buffer_inFeature_ready</obj_property>
|
| 738 |
+
<obj_property name="ObjectShortName">MM_buffer_inFeature_ready</obj_property>
|
| 739 |
+
</wvobject>
|
| 740 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_inFeature_last" type="logic">
|
| 741 |
+
<obj_property name="ElementShortName">MM_buffer_inFeature_last</obj_property>
|
| 742 |
+
<obj_property name="ObjectShortName">MM_buffer_inFeature_last</obj_property>
|
| 743 |
+
</wvobject>
|
| 744 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/feature_buffer_cnt" type="array">
|
| 745 |
+
<obj_property name="ElementShortName">feature_buffer_cnt[9:0]</obj_property>
|
| 746 |
+
<obj_property name="ObjectShortName">feature_buffer_cnt[9:0]</obj_property>
|
| 747 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 748 |
+
</wvobject>
|
| 749 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/feature_buffer_in_addr" type="array">
|
| 750 |
+
<obj_property name="ElementShortName">feature_buffer_in_addr[9:0]</obj_property>
|
| 751 |
+
<obj_property name="ObjectShortName">feature_buffer_in_addr[9:0]</obj_property>
|
| 752 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 753 |
+
</wvobject>
|
| 754 |
+
</wvobject>
|
| 755 |
+
<wvobject fp_name="group223" type="group">
|
| 756 |
+
<obj_property name="label">MM_buffer_out</obj_property>
|
| 757 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 758 |
+
<obj_property name="isExpanded"></obj_property>
|
| 759 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_out_data" type="array">
|
| 760 |
+
<obj_property name="ElementShortName">MM_buffer_out_data[319:0]</obj_property>
|
| 761 |
+
<obj_property name="ObjectShortName">MM_buffer_out_data[319:0]</obj_property>
|
| 762 |
+
</wvobject>
|
| 763 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_out_valid" type="logic">
|
| 764 |
+
<obj_property name="ElementShortName">MM_buffer_out_valid</obj_property>
|
| 765 |
+
<obj_property name="ObjectShortName">MM_buffer_out_valid</obj_property>
|
| 766 |
+
</wvobject>
|
| 767 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_buffer_out_last" type="logic">
|
| 768 |
+
<obj_property name="ElementShortName">MM_buffer_out_last</obj_property>
|
| 769 |
+
<obj_property name="ObjectShortName">MM_buffer_out_last</obj_property>
|
| 770 |
+
</wvobject>
|
| 771 |
+
</wvobject>
|
| 772 |
+
<wvobject fp_name="group225" type="group">
|
| 773 |
+
<obj_property name="label">MM_in</obj_property>
|
| 774 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 775 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_in_data" type="array">
|
| 776 |
+
<obj_property name="ElementShortName">MM_in_data[127:0]</obj_property>
|
| 777 |
+
<obj_property name="ObjectShortName">MM_in_data[127:0]</obj_property>
|
| 778 |
+
</wvobject>
|
| 779 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_in_data_valid" type="logic">
|
| 780 |
+
<obj_property name="ElementShortName">MM_in_data_valid</obj_property>
|
| 781 |
+
<obj_property name="ObjectShortName">MM_in_data_valid</obj_property>
|
| 782 |
+
</wvobject>
|
| 783 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/MM_in_last" type="logic">
|
| 784 |
+
<obj_property name="ElementShortName">MM_in_last</obj_property>
|
| 785 |
+
<obj_property name="ObjectShortName">MM_in_last</obj_property>
|
| 786 |
+
</wvobject>
|
| 787 |
+
</wvobject>
|
| 788 |
+
<wvobject fp_name="group228" type="group">
|
| 789 |
+
<obj_property name="label">out_MM</obj_property>
|
| 790 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 791 |
+
<obj_property name="isExpanded"></obj_property>
|
| 792 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/output_feature_data" type="array">
|
| 793 |
+
<obj_property name="ElementShortName">output_feature_data[319:0]</obj_property>
|
| 794 |
+
<obj_property name="ObjectShortName">output_feature_data[319:0]</obj_property>
|
| 795 |
+
<obj_property name="CustomSignalColor">#FFD700</obj_property>
|
| 796 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 797 |
+
</wvobject>
|
| 798 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/output_feature_valid" type="logic">
|
| 799 |
+
<obj_property name="ElementShortName">output_feature_valid</obj_property>
|
| 800 |
+
<obj_property name="ObjectShortName">output_feature_valid</obj_property>
|
| 801 |
+
<obj_property name="CustomSignalColor">#FFD700</obj_property>
|
| 802 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 803 |
+
</wvobject>
|
| 804 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/output_feature_last" type="logic">
|
| 805 |
+
<obj_property name="ElementShortName">output_feature_last</obj_property>
|
| 806 |
+
<obj_property name="ObjectShortName">output_feature_last</obj_property>
|
| 807 |
+
<obj_property name="CustomSignalColor">#FFD700</obj_property>
|
| 808 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 809 |
+
</wvobject>
|
| 810 |
+
</wvobject>
|
| 811 |
+
<wvobject fp_name="group226" type="group">
|
| 812 |
+
<obj_property name="label">MM_in_weight</obj_property>
|
| 813 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 814 |
+
<obj_property name="isExpanded"></obj_property>
|
| 815 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_valid" type="logic">
|
| 816 |
+
<obj_property name="ElementShortName">input_weight_valid</obj_property>
|
| 817 |
+
<obj_property name="ObjectShortName">input_weight_valid</obj_property>
|
| 818 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 819 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 820 |
+
</wvobject>
|
| 821 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_last" type="logic">
|
| 822 |
+
<obj_property name="ElementShortName">input_weight_last</obj_property>
|
| 823 |
+
<obj_property name="ObjectShortName">input_weight_last</obj_property>
|
| 824 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 825 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 826 |
+
</wvobject>
|
| 827 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_data" type="array">
|
| 828 |
+
<obj_property name="ElementShortName">input_weight_data[127:0]</obj_property>
|
| 829 |
+
<obj_property name="ObjectShortName">input_weight_data[127:0]</obj_property>
|
| 830 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 831 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 832 |
+
</wvobject>
|
| 833 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_addr" type="array">
|
| 834 |
+
<obj_property name="ElementShortName">input_weight_addr[8:0]</obj_property>
|
| 835 |
+
<obj_property name="ObjectShortName">input_weight_addr[8:0]</obj_property>
|
| 836 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 837 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 838 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 839 |
+
</wvobject>
|
| 840 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_col" type="array">
|
| 841 |
+
<obj_property name="ElementShortName">input_weight_col[4:0]</obj_property>
|
| 842 |
+
<obj_property name="ObjectShortName">input_weight_col[4:0]</obj_property>
|
| 843 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 844 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 845 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 846 |
+
</wvobject>
|
| 847 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_weight_row" type="array">
|
| 848 |
+
<obj_property name="ElementShortName">input_weight_row[3:0]</obj_property>
|
| 849 |
+
<obj_property name="ObjectShortName">input_weight_row[3:0]</obj_property>
|
| 850 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 851 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 852 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 853 |
+
</wvobject>
|
| 854 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/weight_cnt" type="array">
|
| 855 |
+
<obj_property name="ElementShortName">weight_cnt[8:0]</obj_property>
|
| 856 |
+
<obj_property name="ObjectShortName">weight_cnt[8:0]</obj_property>
|
| 857 |
+
<obj_property name="CustomSignalColor">#F0E68C</obj_property>
|
| 858 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 859 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 860 |
+
</wvobject>
|
| 861 |
+
</wvobject>
|
| 862 |
+
<wvobject fp_name="group227" type="group">
|
| 863 |
+
<obj_property name="label">MM_in_feature</obj_property>
|
| 864 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 865 |
+
<obj_property name="isExpanded"></obj_property>
|
| 866 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_feature_valid" type="logic">
|
| 867 |
+
<obj_property name="ElementShortName">input_feature_valid</obj_property>
|
| 868 |
+
<obj_property name="ObjectShortName">input_feature_valid</obj_property>
|
| 869 |
+
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
|
| 870 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 871 |
+
</wvobject>
|
| 872 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_feature_last" type="logic">
|
| 873 |
+
<obj_property name="ElementShortName">input_feature_last</obj_property>
|
| 874 |
+
<obj_property name="ObjectShortName">input_feature_last</obj_property>
|
| 875 |
+
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
|
| 876 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 877 |
+
</wvobject>
|
| 878 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_feature_data" type="array">
|
| 879 |
+
<obj_property name="ElementShortName">input_feature_data[127:0]</obj_property>
|
| 880 |
+
<obj_property name="ObjectShortName">input_feature_data[127:0]</obj_property>
|
| 881 |
+
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
|
| 882 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 883 |
+
</wvobject>
|
| 884 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/input_feature_addr" type="array">
|
| 885 |
+
<obj_property name="ElementShortName">input_feature_addr[9:0]</obj_property>
|
| 886 |
+
<obj_property name="ObjectShortName">input_feature_addr[9:0]</obj_property>
|
| 887 |
+
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
|
| 888 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 889 |
+
</wvobject>
|
| 890 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/feature_cnt" type="array">
|
| 891 |
+
<obj_property name="ElementShortName">feature_cnt[9:0]</obj_property>
|
| 892 |
+
<obj_property name="ObjectShortName">feature_cnt[9:0]</obj_property>
|
| 893 |
+
<obj_property name="CustomSignalColor">#FFFF00</obj_property>
|
| 894 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 895 |
+
</wvobject>
|
| 896 |
+
</wvobject>
|
| 897 |
+
<wvobject fp_name="group229" type="group">
|
| 898 |
+
<obj_property name="label">parameters</obj_property>
|
| 899 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 900 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/array_m" type="array">
|
| 901 |
+
<obj_property name="ElementShortName">array_m[31:0]</obj_property>
|
| 902 |
+
<obj_property name="ObjectShortName">array_m[31:0]</obj_property>
|
| 903 |
+
</wvobject>
|
| 904 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/array_n" type="array">
|
| 905 |
+
<obj_property name="ElementShortName">array_n[31:0]</obj_property>
|
| 906 |
+
<obj_property name="ObjectShortName">array_n[31:0]</obj_property>
|
| 907 |
+
</wvobject>
|
| 908 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/data_width" type="array">
|
| 909 |
+
<obj_property name="ElementShortName">data_width[31:0]</obj_property>
|
| 910 |
+
<obj_property name="ObjectShortName">data_width[31:0]</obj_property>
|
| 911 |
+
</wvobject>
|
| 912 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/log2_array_m" type="array">
|
| 913 |
+
<obj_property name="ElementShortName">log2_array_m[31:0]</obj_property>
|
| 914 |
+
<obj_property name="ObjectShortName">log2_array_m[31:0]</obj_property>
|
| 915 |
+
</wvobject>
|
| 916 |
+
</wvobject>
|
| 917 |
+
</wvobject>
|
| 918 |
+
<wvobject fp_name="group814" type="group">
|
| 919 |
+
<obj_property name="label">MM</obj_property>
|
| 920 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 921 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/clk" type="logic">
|
| 922 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 923 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 924 |
+
</wvobject>
|
| 925 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/rst_n" type="logic">
|
| 926 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 927 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 928 |
+
</wvobject>
|
| 929 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/set_w_port" type="logic">
|
| 930 |
+
<obj_property name="ElementShortName">set_w_port</obj_property>
|
| 931 |
+
<obj_property name="ObjectShortName">set_w_port</obj_property>
|
| 932 |
+
</wvobject>
|
| 933 |
+
<wvobject fp_name="group813" type="group">
|
| 934 |
+
<obj_property name="label">Control</obj_property>
|
| 935 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 936 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/wdata_flag_up" type="logic">
|
| 937 |
+
<obj_property name="ElementShortName">wdata_flag_up</obj_property>
|
| 938 |
+
<obj_property name="ObjectShortName">wdata_flag_up</obj_property>
|
| 939 |
+
</wvobject>
|
| 940 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/wdata_flag" type="logic">
|
| 941 |
+
<obj_property name="ElementShortName">wdata_flag</obj_property>
|
| 942 |
+
<obj_property name="ObjectShortName">wdata_flag</obj_property>
|
| 943 |
+
</wvobject>
|
| 944 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/set_w" type="logic">
|
| 945 |
+
<obj_property name="ElementShortName">set_w</obj_property>
|
| 946 |
+
<obj_property name="ObjectShortName">set_w</obj_property>
|
| 947 |
+
</wvobject>
|
| 948 |
+
</wvobject>
|
| 949 |
+
<wvobject fp_name="group305" type="group">
|
| 950 |
+
<obj_property name="label">MM_in</obj_property>
|
| 951 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 952 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_in_data" type="array">
|
| 953 |
+
<obj_property name="ElementShortName">MM_in_data[127:0]</obj_property>
|
| 954 |
+
<obj_property name="ObjectShortName">MM_in_data[127:0]</obj_property>
|
| 955 |
+
</wvobject>
|
| 956 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_in_data_valid" type="logic">
|
| 957 |
+
<obj_property name="ElementShortName">MM_in_data_valid</obj_property>
|
| 958 |
+
<obj_property name="ObjectShortName">MM_in_data_valid</obj_property>
|
| 959 |
+
</wvobject>
|
| 960 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_in_last" type="logic">
|
| 961 |
+
<obj_property name="ElementShortName">MM_in_last</obj_property>
|
| 962 |
+
<obj_property name="ObjectShortName">MM_in_last</obj_property>
|
| 963 |
+
</wvobject>
|
| 964 |
+
</wvobject>
|
| 965 |
+
<wvobject fp_name="group306" type="group">
|
| 966 |
+
<obj_property name="label">MM_out</obj_property>
|
| 967 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 968 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_out_data" type="array">
|
| 969 |
+
<obj_property name="ElementShortName">MM_out_data[319:0]</obj_property>
|
| 970 |
+
<obj_property name="ObjectShortName">MM_out_data[319:0]</obj_property>
|
| 971 |
+
</wvobject>
|
| 972 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_out_data_valid" type="logic">
|
| 973 |
+
<obj_property name="ElementShortName">MM_out_data_valid</obj_property>
|
| 974 |
+
<obj_property name="ObjectShortName">MM_out_data_valid</obj_property>
|
| 975 |
+
</wvobject>
|
| 976 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_out_last" type="logic">
|
| 977 |
+
<obj_property name="ElementShortName">MM_out_last</obj_property>
|
| 978 |
+
<obj_property name="ObjectShortName">MM_out_last</obj_property>
|
| 979 |
+
</wvobject>
|
| 980 |
+
</wvobject>
|
| 981 |
+
<wvobject fp_name="group308" type="group">
|
| 982 |
+
<obj_property name="label">SA</obj_property>
|
| 983 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 984 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/w_packed" type="array">
|
| 985 |
+
<obj_property name="ElementShortName">w_packed[2047:0]</obj_property>
|
| 986 |
+
<obj_property name="ObjectShortName">w_packed[2047:0]</obj_property>
|
| 987 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 988 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 989 |
+
</wvobject>
|
| 990 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/weight_in" type="array">
|
| 991 |
+
<obj_property name="ElementShortName">weight_in[127:0]</obj_property>
|
| 992 |
+
<obj_property name="ObjectShortName">weight_in[127:0]</obj_property>
|
| 993 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 994 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 995 |
+
</wvobject>
|
| 996 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/feature_in" type="array">
|
| 997 |
+
<obj_property name="ElementShortName">feature_in[127:0]</obj_property>
|
| 998 |
+
<obj_property name="ObjectShortName">feature_in[127:0]</obj_property>
|
| 999 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 1000 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 1001 |
+
</wvobject>
|
| 1002 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/x_packed" type="array">
|
| 1003 |
+
<obj_property name="ElementShortName">x_packed[127:0]</obj_property>
|
| 1004 |
+
<obj_property name="ObjectShortName">x_packed[127:0]</obj_property>
|
| 1005 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 1006 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 1007 |
+
</wvobject>
|
| 1008 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/data_out" type="array">
|
| 1009 |
+
<obj_property name="ElementShortName">data_out[319:0]</obj_property>
|
| 1010 |
+
<obj_property name="ObjectShortName">data_out[319:0]</obj_property>
|
| 1011 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 1012 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 1013 |
+
</wvobject>
|
| 1014 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/PE_out_packed" type="array">
|
| 1015 |
+
<obj_property name="ElementShortName">PE_out_packed[319:0]</obj_property>
|
| 1016 |
+
<obj_property name="ObjectShortName">PE_out_packed[319:0]</obj_property>
|
| 1017 |
+
<obj_property name="CustomSignalColor">#800080</obj_property>
|
| 1018 |
+
<obj_property name="UseCustomSignalColor">true</obj_property>
|
| 1019 |
+
</wvobject>
|
| 1020 |
+
</wvobject>
|
| 1021 |
+
<wvobject fp_name="group307" type="group">
|
| 1022 |
+
<obj_property name="label">PARAMETERS</obj_property>
|
| 1023 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1024 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/array_m" type="array">
|
| 1025 |
+
<obj_property name="ElementShortName">array_m[31:0]</obj_property>
|
| 1026 |
+
<obj_property name="ObjectShortName">array_m[31:0]</obj_property>
|
| 1027 |
+
</wvobject>
|
| 1028 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/array_n" type="array">
|
| 1029 |
+
<obj_property name="ElementShortName">array_n[31:0]</obj_property>
|
| 1030 |
+
<obj_property name="ObjectShortName">array_n[31:0]</obj_property>
|
| 1031 |
+
</wvobject>
|
| 1032 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/data_width" type="array">
|
| 1033 |
+
<obj_property name="ElementShortName">data_width[31:0]</obj_property>
|
| 1034 |
+
<obj_property name="ObjectShortName">data_width[31:0]</obj_property>
|
| 1035 |
+
</wvobject>
|
| 1036 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/log2_array_m" type="array">
|
| 1037 |
+
<obj_property name="ElementShortName">log2_array_m[31:0]</obj_property>
|
| 1038 |
+
<obj_property name="ObjectShortName">log2_array_m[31:0]</obj_property>
|
| 1039 |
+
</wvobject>
|
| 1040 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/axis_data_width" type="array">
|
| 1041 |
+
<obj_property name="ElementShortName">axis_data_width[31:0]</obj_property>
|
| 1042 |
+
<obj_property name="ObjectShortName">axis_data_width[31:0]</obj_property>
|
| 1043 |
+
</wvobject>
|
| 1044 |
+
</wvobject>
|
| 1045 |
+
<wvobject fp_name="group557" type="group">
|
| 1046 |
+
<obj_property name="label">Buffer</obj_property>
|
| 1047 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1048 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/data_out_reg1" type="array">
|
| 1049 |
+
<obj_property name="ElementShortName">data_out_reg1[319:0]</obj_property>
|
| 1050 |
+
<obj_property name="ObjectShortName">data_out_reg1[319:0]</obj_property>
|
| 1051 |
+
</wvobject>
|
| 1052 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/feature_in_reg1" type="array">
|
| 1053 |
+
<obj_property name="ElementShortName">feature_in_reg1[127:0]</obj_property>
|
| 1054 |
+
<obj_property name="ObjectShortName">feature_in_reg1[127:0]</obj_property>
|
| 1055 |
+
</wvobject>
|
| 1056 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/weight_buffer" type="array">
|
| 1057 |
+
<obj_property name="ElementShortName">weight_buffer[15:0][127:0]</obj_property>
|
| 1058 |
+
<obj_property name="ObjectShortName">weight_buffer[15:0][127:0]</obj_property>
|
| 1059 |
+
</wvobject>
|
| 1060 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/weight_buffer_cnt" type="array">
|
| 1061 |
+
<obj_property name="ElementShortName">weight_buffer_cnt[5:0]</obj_property>
|
| 1062 |
+
<obj_property name="ObjectShortName">weight_buffer_cnt[5:0]</obj_property>
|
| 1063 |
+
</wvobject>
|
| 1064 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_out_data_valid_reg_array" type="array">
|
| 1065 |
+
<obj_property name="ElementShortName">MM_out_data_valid_reg_array[32:0]</obj_property>
|
| 1066 |
+
<obj_property name="ObjectShortName">MM_out_data_valid_reg_array[32:0]</obj_property>
|
| 1067 |
+
</wvobject>
|
| 1068 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_buffer/u_MM/MM_out_last_reg_array" type="array">
|
| 1069 |
+
<obj_property name="ElementShortName">MM_out_last_reg_array[32:0]</obj_property>
|
| 1070 |
+
<obj_property name="ObjectShortName">MM_out_last_reg_array[32:0]</obj_property>
|
| 1071 |
+
</wvobject>
|
| 1072 |
+
</wvobject>
|
| 1073 |
+
</wvobject>
|
| 1074 |
+
<wvobject fp_name="group1914" type="group">
|
| 1075 |
+
<obj_property name="label">MM_out_buffer_buffer</obj_property>
|
| 1076 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1077 |
+
<obj_property name="isExpanded"></obj_property>
|
| 1078 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/clk" type="logic">
|
| 1079 |
+
<obj_property name="ElementShortName">clk</obj_property>
|
| 1080 |
+
<obj_property name="ObjectShortName">clk</obj_property>
|
| 1081 |
+
</wvobject>
|
| 1082 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/rst_n" type="logic">
|
| 1083 |
+
<obj_property name="ElementShortName">rst_n</obj_property>
|
| 1084 |
+
<obj_property name="ObjectShortName">rst_n</obj_property>
|
| 1085 |
+
</wvobject>
|
| 1086 |
+
<wvobject fp_name="group1915" type="group">
|
| 1087 |
+
<obj_property name="label">registers</obj_property>
|
| 1088 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1089 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/shift" type="array">
|
| 1090 |
+
<obj_property name="ElementShortName">shift[9:0]</obj_property>
|
| 1091 |
+
<obj_property name="ObjectShortName">shift[9:0]</obj_property>
|
| 1092 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1093 |
+
</wvobject>
|
| 1094 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_length" type="array">
|
| 1095 |
+
<obj_property name="ElementShortName">F_length[9:0]</obj_property>
|
| 1096 |
+
<obj_property name="ObjectShortName">F_length[9:0]</obj_property>
|
| 1097 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1098 |
+
</wvobject>
|
| 1099 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_width_block_num" type="array">
|
| 1100 |
+
<obj_property name="ElementShortName">F_width_block_num[4:0]</obj_property>
|
| 1101 |
+
<obj_property name="ObjectShortName">F_width_block_num[4:0]</obj_property>
|
| 1102 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1103 |
+
</wvobject>
|
| 1104 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/W_width_block_num" type="array">
|
| 1105 |
+
<obj_property name="ElementShortName">W_width_block_num[4:0]</obj_property>
|
| 1106 |
+
<obj_property name="ObjectShortName">W_width_block_num[4:0]</obj_property>
|
| 1107 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1108 |
+
</wvobject>
|
| 1109 |
+
</wvobject>
|
| 1110 |
+
<wvobject fp_name="group1932" type="group">
|
| 1111 |
+
<obj_property name="label">control</obj_property>
|
| 1112 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1113 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/start_trans" type="logic">
|
| 1114 |
+
<obj_property name="ElementShortName">start_trans</obj_property>
|
| 1115 |
+
<obj_property name="ObjectShortName">start_trans</obj_property>
|
| 1116 |
+
</wvobject>
|
| 1117 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/last_cnt" type="array">
|
| 1118 |
+
<obj_property name="ElementShortName">last_cnt[4:0]</obj_property>
|
| 1119 |
+
<obj_property name="ObjectShortName">last_cnt[4:0]</obj_property>
|
| 1120 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1121 |
+
</wvobject>
|
| 1122 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_F_block_size" type="array">
|
| 1123 |
+
<obj_property name="ElementShortName">out_F_block_size[11:0]</obj_property>
|
| 1124 |
+
<obj_property name="ObjectShortName">out_F_block_size[11:0]</obj_property>
|
| 1125 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1126 |
+
</wvobject>
|
| 1127 |
+
</wvobject>
|
| 1128 |
+
<wvobject fp_name="group1916" type="group">
|
| 1129 |
+
<obj_property name="label">IN_D</obj_property>
|
| 1130 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1131 |
+
<obj_property name="isExpanded"></obj_property>
|
| 1132 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/in_data_valid" type="logic">
|
| 1133 |
+
<obj_property name="ElementShortName">in_data_valid</obj_property>
|
| 1134 |
+
<obj_property name="ObjectShortName">in_data_valid</obj_property>
|
| 1135 |
+
</wvobject>
|
| 1136 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/in_data_last" type="logic">
|
| 1137 |
+
<obj_property name="ElementShortName">in_data_last</obj_property>
|
| 1138 |
+
<obj_property name="ObjectShortName">in_data_last</obj_property>
|
| 1139 |
+
</wvobject>
|
| 1140 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/in_data" type="array">
|
| 1141 |
+
<obj_property name="ElementShortName">in_data[319:0]</obj_property>
|
| 1142 |
+
<obj_property name="ObjectShortName">in_data[319:0]</obj_property>
|
| 1143 |
+
</wvobject>
|
| 1144 |
+
</wvobject>
|
| 1145 |
+
<wvobject fp_name="group1917" type="group">
|
| 1146 |
+
<obj_property name="label">OUT_D</obj_property>
|
| 1147 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1148 |
+
<obj_property name="isExpanded"></obj_property>
|
| 1149 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_valid" type="logic">
|
| 1150 |
+
<obj_property name="ElementShortName">out_data_valid</obj_property>
|
| 1151 |
+
<obj_property name="ObjectShortName">out_data_valid</obj_property>
|
| 1152 |
+
</wvobject>
|
| 1153 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_cnt" type="array">
|
| 1154 |
+
<obj_property name="ElementShortName">out_data_cnt[11:0]</obj_property>
|
| 1155 |
+
<obj_property name="ObjectShortName">out_data_cnt[11:0]</obj_property>
|
| 1156 |
+
<obj_property name="Radix">SIGNEDDECRADIX</obj_property>
|
| 1157 |
+
</wvobject>
|
| 1158 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_last" type="logic">
|
| 1159 |
+
<obj_property name="ElementShortName">out_data_last</obj_property>
|
| 1160 |
+
<obj_property name="ObjectShortName">out_data_last</obj_property>
|
| 1161 |
+
</wvobject>
|
| 1162 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_ready" type="logic">
|
| 1163 |
+
<obj_property name="ElementShortName">out_data_ready</obj_property>
|
| 1164 |
+
<obj_property name="ObjectShortName">out_data_ready</obj_property>
|
| 1165 |
+
</wvobject>
|
| 1166 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data" type="array">
|
| 1167 |
+
<obj_property name="ElementShortName">out_data[127:0]</obj_property>
|
| 1168 |
+
<obj_property name="ObjectShortName">out_data[127:0]</obj_property>
|
| 1169 |
+
</wvobject>
|
| 1170 |
+
<wvobject fp_name="group1933" type="group">
|
| 1171 |
+
<obj_property name="label">out_data_addr</obj_property>
|
| 1172 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1173 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_col_addr" type="array">
|
| 1174 |
+
<obj_property name="ElementShortName">out_data_col_addr[4:0]</obj_property>
|
| 1175 |
+
<obj_property name="ObjectShortName">out_data_col_addr[4:0]</obj_property>
|
| 1176 |
+
</wvobject>
|
| 1177 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_row_addr" type="array">
|
| 1178 |
+
<obj_property name="ElementShortName">out_data_row_addr[9:0]</obj_property>
|
| 1179 |
+
<obj_property name="ObjectShortName">out_data_row_addr[9:0]</obj_property>
|
| 1180 |
+
</wvobject>
|
| 1181 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_data_addr" type="array">
|
| 1182 |
+
<obj_property name="ElementShortName">out_data_addr[11:0]</obj_property>
|
| 1183 |
+
<obj_property name="ObjectShortName">out_data_addr[11:0]</obj_property>
|
| 1184 |
+
</wvobject>
|
| 1185 |
+
</wvobject>
|
| 1186 |
+
</wvobject>
|
| 1187 |
+
<wvobject fp_name="group1934" type="group">
|
| 1188 |
+
<obj_property name="label">read port</obj_property>
|
| 1189 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1190 |
+
<obj_property name="isExpanded"></obj_property>
|
| 1191 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_F_array_addr" type="array">
|
| 1192 |
+
<obj_property name="ElementShortName">out_F_array_addr[11:0]</obj_property>
|
| 1193 |
+
<obj_property name="ObjectShortName">out_F_array_addr[11:0]</obj_property>
|
| 1194 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1195 |
+
</wvobject>
|
| 1196 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_F_array_data" type="array">
|
| 1197 |
+
<obj_property name="ElementShortName">out_F_array_data[335:0]</obj_property>
|
| 1198 |
+
<obj_property name="ObjectShortName">out_F_array_data[335:0]</obj_property>
|
| 1199 |
+
</wvobject>
|
| 1200 |
+
</wvobject>
|
| 1201 |
+
<wvobject fp_name="group3593" type="group">
|
| 1202 |
+
<obj_property name="label">write port</obj_property>
|
| 1203 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1204 |
+
<obj_property name="isExpanded"></obj_property>
|
| 1205 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/in_F_array_addr" type="array">
|
| 1206 |
+
<obj_property name="ElementShortName">in_F_array_addr[11:0]</obj_property>
|
| 1207 |
+
<obj_property name="ObjectShortName">in_F_array_addr[11:0]</obj_property>
|
| 1208 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1209 |
+
</wvobject>
|
| 1210 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/in_F_array_data" type="array">
|
| 1211 |
+
<obj_property name="ElementShortName">in_F_array_data[335:0]</obj_property>
|
| 1212 |
+
<obj_property name="ObjectShortName">in_F_array_data[335:0]</obj_property>
|
| 1213 |
+
</wvobject>
|
| 1214 |
+
</wvobject>
|
| 1215 |
+
<wvobject fp_name="group1931" type="group">
|
| 1216 |
+
<obj_property name="label">Adder</obj_property>
|
| 1217 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1218 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/A" type="array">
|
| 1219 |
+
<obj_property name="ElementShortName">A[319:0]</obj_property>
|
| 1220 |
+
<obj_property name="ObjectShortName">A[319:0]</obj_property>
|
| 1221 |
+
</wvobject>
|
| 1222 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/A_in_adder" type="array">
|
| 1223 |
+
<obj_property name="ElementShortName">A_in_adder[335:0]</obj_property>
|
| 1224 |
+
<obj_property name="ObjectShortName">A_in_adder[335:0]</obj_property>
|
| 1225 |
+
</wvobject>
|
| 1226 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/B" type="array">
|
| 1227 |
+
<obj_property name="ElementShortName">B[335:0]</obj_property>
|
| 1228 |
+
<obj_property name="ObjectShortName">B[335:0]</obj_property>
|
| 1229 |
+
</wvobject>
|
| 1230 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/C" type="array">
|
| 1231 |
+
<obj_property name="ElementShortName">C[335:0]</obj_property>
|
| 1232 |
+
<obj_property name="ObjectShortName">C[335:0]</obj_property>
|
| 1233 |
+
</wvobject>
|
| 1234 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/B_addr" type="array">
|
| 1235 |
+
<obj_property name="ElementShortName">B_addr[11:0]</obj_property>
|
| 1236 |
+
<obj_property name="ObjectShortName">B_addr[11:0]</obj_property>
|
| 1237 |
+
</wvobject>
|
| 1238 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/C_addr" type="array">
|
| 1239 |
+
<obj_property name="ElementShortName">C_addr[11:0]</obj_property>
|
| 1240 |
+
<obj_property name="ObjectShortName">C_addr[11:0]</obj_property>
|
| 1241 |
+
</wvobject>
|
| 1242 |
+
</wvobject>
|
| 1243 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_valid" type="logic">
|
| 1244 |
+
<obj_property name="ElementShortName">F_array_out_valid</obj_property>
|
| 1245 |
+
<obj_property name="ObjectShortName">F_array_out_valid</obj_property>
|
| 1246 |
+
</wvobject>
|
| 1247 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_cnt" type="array">
|
| 1248 |
+
<obj_property name="ElementShortName">F_array_out_cnt[11:0]</obj_property>
|
| 1249 |
+
<obj_property name="ObjectShortName">F_array_out_cnt[11:0]</obj_property>
|
| 1250 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1251 |
+
</wvobject>
|
| 1252 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_valid_delay1" type="logic">
|
| 1253 |
+
<obj_property name="ElementShortName">F_array_out_valid_delay1</obj_property>
|
| 1254 |
+
<obj_property name="ObjectShortName">F_array_out_valid_delay1</obj_property>
|
| 1255 |
+
</wvobject>
|
| 1256 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_cnt_delay1" type="array">
|
| 1257 |
+
<obj_property name="ElementShortName">F_array_out_cnt_delay1[11:0]</obj_property>
|
| 1258 |
+
<obj_property name="ObjectShortName">F_array_out_cnt_delay1[11:0]</obj_property>
|
| 1259 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1260 |
+
</wvobject>
|
| 1261 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_valid_delay2" type="logic">
|
| 1262 |
+
<obj_property name="ElementShortName">F_array_out_valid_delay2</obj_property>
|
| 1263 |
+
<obj_property name="ObjectShortName">F_array_out_valid_delay2</obj_property>
|
| 1264 |
+
</wvobject>
|
| 1265 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_array_out_last_delay2" type="logic">
|
| 1266 |
+
<obj_property name="ElementShortName">F_array_out_last_delay2</obj_property>
|
| 1267 |
+
<obj_property name="ObjectShortName">F_array_out_last_delay2</obj_property>
|
| 1268 |
+
</wvobject>
|
| 1269 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_F_data" type="array">
|
| 1270 |
+
<obj_property name="ElementShortName">out_F_data[335:0]</obj_property>
|
| 1271 |
+
<obj_property name="ObjectShortName">out_F_data[335:0]</obj_property>
|
| 1272 |
+
</wvobject>
|
| 1273 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/out_F_data_delay1" type="array">
|
| 1274 |
+
<obj_property name="ElementShortName">out_F_data_delay1[335:0]</obj_property>
|
| 1275 |
+
<obj_property name="ObjectShortName">out_F_data_delay1[335:0]</obj_property>
|
| 1276 |
+
</wvobject>
|
| 1277 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/shifted_data" type="array">
|
| 1278 |
+
<obj_property name="ElementShortName">shifted_data[127:0]</obj_property>
|
| 1279 |
+
<obj_property name="ObjectShortName">shifted_data[127:0]</obj_property>
|
| 1280 |
+
</wvobject>
|
| 1281 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/clear_addr" type="array">
|
| 1282 |
+
<obj_property name="ElementShortName">clear_addr[11:0]</obj_property>
|
| 1283 |
+
<obj_property name="ObjectShortName">clear_addr[11:0]</obj_property>
|
| 1284 |
+
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
| 1285 |
+
</wvobject>
|
| 1286 |
+
<wvobject fp_name="group1918" type="group">
|
| 1287 |
+
<obj_property name="label">parameters</obj_property>
|
| 1288 |
+
<obj_property name="DisplayName">label</obj_property>
|
| 1289 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/data_width" type="array">
|
| 1290 |
+
<obj_property name="ElementShortName">data_width[31:0]</obj_property>
|
| 1291 |
+
<obj_property name="ObjectShortName">data_width[31:0]</obj_property>
|
| 1292 |
+
</wvobject>
|
| 1293 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/OUT_Feature_Block_num" type="array">
|
| 1294 |
+
<obj_property name="ElementShortName">OUT_Feature_Block_num[31:0]</obj_property>
|
| 1295 |
+
<obj_property name="ObjectShortName">OUT_Feature_Block_num[31:0]</obj_property>
|
| 1296 |
+
</wvobject>
|
| 1297 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/OUT_MEM_WIDTH" type="array">
|
| 1298 |
+
<obj_property name="ElementShortName">OUT_MEM_WIDTH[31:0]</obj_property>
|
| 1299 |
+
<obj_property name="ObjectShortName">OUT_MEM_WIDTH[31:0]</obj_property>
|
| 1300 |
+
</wvobject>
|
| 1301 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/A_size" type="array">
|
| 1302 |
+
<obj_property name="ElementShortName">A_size[31:0]</obj_property>
|
| 1303 |
+
<obj_property name="ObjectShortName">A_size[31:0]</obj_property>
|
| 1304 |
+
</wvobject>
|
| 1305 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/shift_width" type="array">
|
| 1306 |
+
<obj_property name="ElementShortName">shift_width[31:0]</obj_property>
|
| 1307 |
+
<obj_property name="ObjectShortName">shift_width[31:0]</obj_property>
|
| 1308 |
+
</wvobject>
|
| 1309 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/log2_array_m" type="array">
|
| 1310 |
+
<obj_property name="ElementShortName">log2_array_m[31:0]</obj_property>
|
| 1311 |
+
<obj_property name="ObjectShortName">log2_array_m[31:0]</obj_property>
|
| 1312 |
+
</wvobject>
|
| 1313 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_length_width" type="array">
|
| 1314 |
+
<obj_property name="ElementShortName">F_length_width[31:0]</obj_property>
|
| 1315 |
+
<obj_property name="ObjectShortName">F_length_width[31:0]</obj_property>
|
| 1316 |
+
</wvobject>
|
| 1317 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_width_block_num_width" type="array">
|
| 1318 |
+
<obj_property name="ElementShortName">F_width_block_num_width[31:0]</obj_property>
|
| 1319 |
+
<obj_property name="ObjectShortName">F_width_block_num_width[31:0]</obj_property>
|
| 1320 |
+
</wvobject>
|
| 1321 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/W_width_block_num_width" type="array">
|
| 1322 |
+
<obj_property name="ElementShortName">W_width_block_num_width[31:0]</obj_property>
|
| 1323 |
+
<obj_property name="ObjectShortName">W_width_block_num_width[31:0]</obj_property>
|
| 1324 |
+
</wvobject>
|
| 1325 |
+
<wvobject fp_name="/MM_Ultra_tb/u_MM_ultra/u_MM_out_buffer/F_size_width" type="array">
|
| 1326 |
+
<obj_property name="ElementShortName">F_size_width[31:0]</obj_property>
|
| 1327 |
+
<obj_property name="ObjectShortName">F_size_width[31:0]</obj_property>
|
| 1328 |
+
</wvobject>
|
| 1329 |
+
</wvobject>
|
| 1330 |
+
</wvobject>
|
| 1331 |
+
</wave_config>
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/AdderS.v
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module AdderS
|
| 4 |
+
#(
|
| 5 |
+
parameter integer A_size = 4,
|
| 6 |
+
parameter integer data_width = 8
|
| 7 |
+
)(
|
| 8 |
+
input [A_size * data_width - 1 : 0] A,
|
| 9 |
+
input [A_size * data_width - 1 : 0] B,
|
| 10 |
+
output reg [A_size * data_width - 1 : 0] C
|
| 11 |
+
);
|
| 12 |
+
wire [(data_width + 1)-1:0] temp [A_size-1:0]; //Double sign bit to determine positive overflow or negative overflow
|
| 13 |
+
wire [data_width - 1:0] C_array_display [A_size-1:0];
|
| 14 |
+
genvar i;
|
| 15 |
+
|
| 16 |
+
generate
|
| 17 |
+
for(i=0;i<A_size;i=i+1)begin
|
| 18 |
+
assign C_array_display[i] = C[i*data_width +: data_width];
|
| 19 |
+
end
|
| 20 |
+
endgenerate
|
| 21 |
+
|
| 22 |
+
generate
|
| 23 |
+
for(i=0;i<A_size;i=i+1)begin
|
| 24 |
+
assign temp[i] = {A[(i+1)*data_width-1],A[i *data_width +: data_width]}
|
| 25 |
+
+ {B[(i+1)*data_width-1],B[i *data_width +: data_width]};
|
| 26 |
+
end
|
| 27 |
+
endgenerate
|
| 28 |
+
generate
|
| 29 |
+
for(i=0;i<A_size;i=i+1)begin
|
| 30 |
+
always @(*) begin
|
| 31 |
+
case (temp[i][data_width:data_width-1])
|
| 32 |
+
2'b01: C[i * data_width +: data_width] = {1'b0,{(data_width-1){1'b1}}};
|
| 33 |
+
2'b10: C[i * data_width +: data_width] = {1'b1,{(data_width-1){1'b0}}};
|
| 34 |
+
default: C[i * data_width +: data_width] = temp[i][data_width-1:0];
|
| 35 |
+
endcase
|
| 36 |
+
|
| 37 |
+
end
|
| 38 |
+
end
|
| 39 |
+
endgenerate
|
| 40 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM.v
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module MM
|
| 4 |
+
#(
|
| 5 |
+
parameter array_m = 6,
|
| 6 |
+
parameter array_n = 6,
|
| 7 |
+
parameter data_width = 8,
|
| 8 |
+
// parameter shift_width = 20,
|
| 9 |
+
parameter log2_array_m = 4,
|
| 10 |
+
localparam integer axis_data_width = array_m * data_width
|
| 11 |
+
)
|
| 12 |
+
(
|
| 13 |
+
clk,
|
| 14 |
+
rst_n,
|
| 15 |
+
|
| 16 |
+
set_w_port,
|
| 17 |
+
|
| 18 |
+
// shift,
|
| 19 |
+
wdata_flag_up,
|
| 20 |
+
|
| 21 |
+
MM_in_data,
|
| 22 |
+
MM_in_data_valid,
|
| 23 |
+
MM_in_last,
|
| 24 |
+
|
| 25 |
+
MM_out_data,
|
| 26 |
+
MM_out_data_valid,
|
| 27 |
+
MM_out_last
|
| 28 |
+
);
|
| 29 |
+
|
| 30 |
+
input wire clk;
|
| 31 |
+
input wire rst_n;
|
| 32 |
+
|
| 33 |
+
output wire set_w_port;
|
| 34 |
+
|
| 35 |
+
// input wire [shift_width-1:0] shift;
|
| 36 |
+
input wire wdata_flag_up;
|
| 37 |
+
|
| 38 |
+
input wire [axis_data_width-1:0] MM_in_data;
|
| 39 |
+
input wire MM_in_data_valid;
|
| 40 |
+
input wire MM_in_last;
|
| 41 |
+
|
| 42 |
+
output wire [array_n*(log2_array_m+data_width*2)-1:0] MM_out_data;
|
| 43 |
+
output wire MM_out_data_valid;
|
| 44 |
+
output wire MM_out_last;
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
reg [array_n*(log2_array_m+data_width*2)-1:0] data_out_reg1;
|
| 49 |
+
reg [axis_data_width-1:0] feature_in_reg1;
|
| 50 |
+
reg [axis_data_width-1:0] weight_buffer [array_m-1:0];
|
| 51 |
+
reg MM_out_data_valid_reg_array [2*array_m:0];
|
| 52 |
+
reg MM_out_last_reg_array [2*array_m:0];
|
| 53 |
+
reg [5:0] weight_buffer_cnt;
|
| 54 |
+
//reg weight_ready;
|
| 55 |
+
reg wdata_flag;
|
| 56 |
+
|
| 57 |
+
wire set_w;
|
| 58 |
+
wire [array_n*(log2_array_m+data_width*2)-1:0] data_out;
|
| 59 |
+
wire [array_m*array_n*data_width-1:0] w_packed;
|
| 60 |
+
wire [array_n*(log2_array_m+data_width*2)-1:0] PE_out_packed;
|
| 61 |
+
wire [axis_data_width-1:0] feature_in;
|
| 62 |
+
wire [axis_data_width-1:0] weight_in;
|
| 63 |
+
wire [data_width*array_m-1:0] x_packed;
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
genvar i;
|
| 67 |
+
generate
|
| 68 |
+
for(i=0;i<array_m;i=i+1)begin:array_to_packed
|
| 69 |
+
assign w_packed[(data_width*array_n)*i +: (data_width*array_n)] = weight_buffer[array_m-1-i];//ע���±������Ƿ���
|
| 70 |
+
end
|
| 71 |
+
endgenerate
|
| 72 |
+
|
| 73 |
+
assign set_w_port = set_w;
|
| 74 |
+
assign MM_out_data = data_out_reg1;
|
| 75 |
+
assign weight_in = (wdata_flag & MM_in_data_valid) ? MM_in_data : 0;
|
| 76 |
+
assign feature_in = ((~wdata_flag) & MM_in_data_valid)? MM_in_data : 0;
|
| 77 |
+
assign set_w = (weight_buffer_cnt==array_m) ? 1:0;
|
| 78 |
+
assign x_packed = feature_in_reg1;
|
| 79 |
+
assign MM_out_data_valid = MM_out_data_valid_reg_array[2*array_m];
|
| 80 |
+
assign MM_out_last = MM_out_last_reg_array[2*array_m];
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
always @(posedge clk or negedge rst_n) begin
|
| 85 |
+
if(~rst_n)
|
| 86 |
+
weight_buffer_cnt <= 0;
|
| 87 |
+
else if(weight_buffer_cnt == array_m)
|
| 88 |
+
weight_buffer_cnt<=0;
|
| 89 |
+
else if (wdata_flag & MM_in_data_valid)
|
| 90 |
+
weight_buffer_cnt<=weight_buffer_cnt+1;
|
| 91 |
+
else
|
| 92 |
+
weight_buffer_cnt<=weight_buffer_cnt;
|
| 93 |
+
end
|
| 94 |
+
|
| 95 |
+
always @(posedge clk or negedge rst_n) begin
|
| 96 |
+
if(~rst_n)
|
| 97 |
+
wdata_flag<=0;
|
| 98 |
+
else
|
| 99 |
+
case ({wdata_flag_up,MM_in_last})
|
| 100 |
+
2'b10 : wdata_flag <= 1;
|
| 101 |
+
2'b01 : wdata_flag <= 0;
|
| 102 |
+
default : wdata_flag <= wdata_flag;
|
| 103 |
+
endcase
|
| 104 |
+
end
|
| 105 |
+
|
| 106 |
+
always @(posedge clk)begin
|
| 107 |
+
data_out_reg1 <= data_out;
|
| 108 |
+
end
|
| 109 |
+
|
| 110 |
+
always @(posedge clk or negedge rst_n) begin
|
| 111 |
+
if(~rst_n)
|
| 112 |
+
feature_in_reg1 <= 0;
|
| 113 |
+
else
|
| 114 |
+
feature_in_reg1 <= feature_in;
|
| 115 |
+
end
|
| 116 |
+
|
| 117 |
+
//always @(posedge clk or negedge rst_n) begin
|
| 118 |
+
// if(~rst_n)
|
| 119 |
+
// weight_ready <= 0;
|
| 120 |
+
// else if (wdata_flag & MM_in_data_valid)
|
| 121 |
+
// weight_ready <= 0;
|
| 122 |
+
// else if (weight_buffer_cnt == array_m - 1)
|
| 123 |
+
// weight_ready <= 1;
|
| 124 |
+
// else
|
| 125 |
+
// weight_ready <= weight_ready;
|
| 126 |
+
//end
|
| 127 |
+
|
| 128 |
+
always @(posedge clk or negedge rst_n) begin
|
| 129 |
+
if(~rst_n)
|
| 130 |
+
weight_buffer[0]<=0;
|
| 131 |
+
else if(wdata_flag & MM_in_data_valid)
|
| 132 |
+
weight_buffer[0]<=weight_in;
|
| 133 |
+
else
|
| 134 |
+
weight_buffer[0]<=weight_buffer[0];
|
| 135 |
+
end
|
| 136 |
+
|
| 137 |
+
integer j;
|
| 138 |
+
always @(posedge clk or negedge rst_n) begin
|
| 139 |
+
for(j=1;j<array_m;j=j+1)begin
|
| 140 |
+
if(~rst_n)
|
| 141 |
+
weight_buffer[j]<=0;
|
| 142 |
+
else if (wdata_flag & MM_in_data_valid)
|
| 143 |
+
weight_buffer[j]<=weight_buffer[j-1];
|
| 144 |
+
else
|
| 145 |
+
weight_buffer[j]<=weight_buffer[j];
|
| 146 |
+
end
|
| 147 |
+
end
|
| 148 |
+
|
| 149 |
+
always @(posedge clk or negedge rst_n) begin
|
| 150 |
+
if(~rst_n)
|
| 151 |
+
MM_out_data_valid_reg_array[0]<=0;
|
| 152 |
+
else
|
| 153 |
+
MM_out_data_valid_reg_array[0]<=MM_in_data_valid & (~wdata_flag);
|
| 154 |
+
end
|
| 155 |
+
generate
|
| 156 |
+
for(i=1;i<=array_m*2;i=i+1)begin
|
| 157 |
+
always @(posedge clk or negedge rst_n) begin
|
| 158 |
+
if(~rst_n)
|
| 159 |
+
MM_out_data_valid_reg_array[i]<=0;
|
| 160 |
+
else
|
| 161 |
+
MM_out_data_valid_reg_array[i]<=MM_out_data_valid_reg_array[i-1];
|
| 162 |
+
end
|
| 163 |
+
end
|
| 164 |
+
endgenerate
|
| 165 |
+
|
| 166 |
+
always @(posedge clk or negedge rst_n) begin
|
| 167 |
+
if(~rst_n)
|
| 168 |
+
MM_out_last_reg_array[0]<=0;
|
| 169 |
+
else
|
| 170 |
+
MM_out_last_reg_array[0]<=MM_in_last & (~wdata_flag);
|
| 171 |
+
end
|
| 172 |
+
|
| 173 |
+
generate
|
| 174 |
+
for(i=1;i<=array_m*2;i=i+1) begin
|
| 175 |
+
always @(posedge clk or negedge rst_n) begin
|
| 176 |
+
if(~rst_n)
|
| 177 |
+
MM_out_last_reg_array[i]<=0;
|
| 178 |
+
else
|
| 179 |
+
MM_out_last_reg_array[i]<=MM_out_last_reg_array[i-1];
|
| 180 |
+
end
|
| 181 |
+
end
|
| 182 |
+
endgenerate
|
| 183 |
+
|
| 184 |
+
PE_array#
|
| 185 |
+
(
|
| 186 |
+
.data_width(data_width),
|
| 187 |
+
.array_m(array_m),
|
| 188 |
+
.array_n(array_n),
|
| 189 |
+
.log2_array_m(log2_array_m)
|
| 190 |
+
)
|
| 191 |
+
u_PE_array
|
| 192 |
+
(
|
| 193 |
+
.clk(clk),
|
| 194 |
+
.rst_n(rst_n),
|
| 195 |
+
.set_w(set_w),
|
| 196 |
+
.x_packed(x_packed),
|
| 197 |
+
.w_packed(w_packed),
|
| 198 |
+
.PE_out_packed(PE_out_packed)
|
| 199 |
+
);
|
| 200 |
+
|
| 201 |
+
// generate
|
| 202 |
+
// for(i=0;i<array_n;i=i+1)begin:right_shifter_u
|
| 203 |
+
// right_shifter
|
| 204 |
+
// #(
|
| 205 |
+
// .data_width(data_width),
|
| 206 |
+
// .array_m(array_m),
|
| 207 |
+
// .array_n(array_n),
|
| 208 |
+
// .log2_array_m(log2_array_m),
|
| 209 |
+
// .shift_width(shift_width)
|
| 210 |
+
// )u_right_shifter(
|
| 211 |
+
// .shift(shift),
|
| 212 |
+
// .data_in(PE_out_packed[i*(log2_array_m+data_width*2)+:(log2_array_m+data_width*2)]),
|
| 213 |
+
// .data_out(data_out[i*data_width+:data_width])
|
| 214 |
+
// );
|
| 215 |
+
// end
|
| 216 |
+
// endgenerate
|
| 217 |
+
|
| 218 |
+
assign data_out = PE_out_packed;
|
| 219 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_buffer.v
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
`define IDLE 2'b00
|
| 3 |
+
`define SET_WEIGHT 2'b01
|
| 4 |
+
`define SET_FEATURE 2'b11
|
| 5 |
+
|
| 6 |
+
module MM_buffer#
|
| 7 |
+
(
|
| 8 |
+
parameter integer array_m = 3,
|
| 9 |
+
parameter integer array_n = 3,
|
| 10 |
+
parameter integer data_width = 8,
|
| 11 |
+
parameter integer log2_array_m = 4,
|
| 12 |
+
parameter integer F_length_width = 10,
|
| 13 |
+
parameter integer W_width_block_num_width = 5
|
| 14 |
+
)(
|
| 15 |
+
input clk,
|
| 16 |
+
input rst_n,
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
input [F_length_width-1:0] FL,
|
| 20 |
+
input [W_width_block_num_width-1:0] num_blobk_W,
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
input [array_m * data_width - 1:0] MM_buffer_inWeight_data,
|
| 24 |
+
input MM_buffer_inWeight_valid,
|
| 25 |
+
output MM_buffer_inWeight_ready,
|
| 26 |
+
input MM_buffer_inWeight_last,
|
| 27 |
+
|
| 28 |
+
input [array_m * data_width - 1:0] MM_buffer_inFeature_data,
|
| 29 |
+
input MM_buffer_inFeature_valid,
|
| 30 |
+
output MM_buffer_inFeature_ready,
|
| 31 |
+
input MM_buffer_inFeature_last,
|
| 32 |
+
|
| 33 |
+
output [array_n*(log2_array_m+data_width*2)-1:0] MM_buffer_out_data,
|
| 34 |
+
output MM_buffer_out_valid,
|
| 35 |
+
output MM_buffer_out_last
|
| 36 |
+
);
|
| 37 |
+
localparam integer feature_buffer_depth = $pow(2, F_length_width);
|
| 38 |
+
localparam integer W_block_num_width = W_width_block_num_width + log2_array_m;
|
| 39 |
+
localparam integer weight_buffer_depth = $pow(2, W_width_block_num_width) * array_m;
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
reg [1:0] state;
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
reg start;
|
| 46 |
+
wire start_ahead1;
|
| 47 |
+
reg set_w_delay1;
|
| 48 |
+
reg w_end;
|
| 49 |
+
reg weight_flag_up;
|
| 50 |
+
|
| 51 |
+
reg [W_block_num_width-1:0] total_WL_reg;
|
| 52 |
+
reg [F_length_width-1:0] FL_reg;
|
| 53 |
+
|
| 54 |
+
reg [W_block_num_width-1:0] weight_buffer_cnt;
|
| 55 |
+
reg [W_block_num_width-1:0] weight_buffer_in_addr;
|
| 56 |
+
reg [array_m * data_width - 1:0] weight_buffer [weight_buffer_depth-1:0];
|
| 57 |
+
|
| 58 |
+
reg [F_length_width-1:0] feature_buffer_cnt;
|
| 59 |
+
reg [F_length_width-1:0] feature_buffer_in_addr;
|
| 60 |
+
reg [array_m * data_width - 1:0] feature_buffer [feature_buffer_depth-1:0];
|
| 61 |
+
|
| 62 |
+
wire both_full;
|
| 63 |
+
reg both_full_delay1;
|
| 64 |
+
|
| 65 |
+
reg [array_m * data_width - 1:0] MM_in_data;
|
| 66 |
+
reg MM_in_data_valid;
|
| 67 |
+
reg MM_in_last;
|
| 68 |
+
|
| 69 |
+
reg input_weight_valid;
|
| 70 |
+
wire input_weight_last;
|
| 71 |
+
reg [array_m * data_width - 1:0] input_weight_data;
|
| 72 |
+
wire [W_block_num_width-1:0] input_weight_addr;
|
| 73 |
+
reg [W_width_block_num_width-1:0] input_weight_col;
|
| 74 |
+
reg [log2_array_m-1:0] input_weight_row;
|
| 75 |
+
reg [W_block_num_width-1:0] weight_cnt;
|
| 76 |
+
|
| 77 |
+
reg input_feature_valid;
|
| 78 |
+
wire input_feature_last;
|
| 79 |
+
reg [array_m * data_width - 1:0] input_feature_data;
|
| 80 |
+
reg [F_length_width-1:0] input_feature_addr;
|
| 81 |
+
reg [F_length_width-1:0] feature_cnt;
|
| 82 |
+
|
| 83 |
+
wire set_w;
|
| 84 |
+
wire total_last;
|
| 85 |
+
wire wdata_flag_up;
|
| 86 |
+
|
| 87 |
+
wire [array_n*(log2_array_m+data_width*2)-1:0] output_feature_data;
|
| 88 |
+
wire output_feature_valid;
|
| 89 |
+
wire output_feature_last;
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
assign both_full = (weight_buffer_cnt == total_WL_reg) & (feature_buffer_cnt == FL_reg);
|
| 93 |
+
assign MM_buffer_out_valid = output_feature_valid;
|
| 94 |
+
assign MM_buffer_out_data = output_feature_data;
|
| 95 |
+
assign MM_buffer_out_last = total_last;
|
| 96 |
+
assign total_last = output_feature_last & w_end;
|
| 97 |
+
assign MM_buffer_inWeight_ready = (weight_buffer_cnt<=total_WL_reg-1);
|
| 98 |
+
assign MM_buffer_inFeature_ready = (feature_buffer_cnt<=FL_reg-1);
|
| 99 |
+
// assign wdata_flag_up = start | weight_flag_up;
|
| 100 |
+
assign wdata_flag_up = start | weight_flag_up & (state != 0);
|
| 101 |
+
assign input_weight_last = weight_cnt == array_m - 1;
|
| 102 |
+
assign input_feature_last = feature_cnt == FL_reg - 1;
|
| 103 |
+
assign input_weight_addr = input_weight_row * num_blobk_W + input_weight_col;
|
| 104 |
+
assign start_ahead1 = both_full & (~both_full_delay1);
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
always @(*) begin
|
| 108 |
+
case (state)
|
| 109 |
+
`IDLE : begin
|
| 110 |
+
MM_in_data_valid = 0;
|
| 111 |
+
MM_in_last = 0;
|
| 112 |
+
MM_in_data = 0;
|
| 113 |
+
end
|
| 114 |
+
`SET_WEIGHT : begin
|
| 115 |
+
MM_in_data_valid = input_weight_valid;
|
| 116 |
+
MM_in_last = input_weight_last;
|
| 117 |
+
MM_in_data = input_weight_data;
|
| 118 |
+
end
|
| 119 |
+
`SET_FEATURE: begin
|
| 120 |
+
MM_in_data_valid = input_feature_valid;
|
| 121 |
+
MM_in_last = input_feature_last;
|
| 122 |
+
MM_in_data = input_feature_data;
|
| 123 |
+
end
|
| 124 |
+
default: begin
|
| 125 |
+
MM_in_data_valid = 0;
|
| 126 |
+
MM_in_last = 0;
|
| 127 |
+
MM_in_data = 0;
|
| 128 |
+
end
|
| 129 |
+
endcase
|
| 130 |
+
end
|
| 131 |
+
|
| 132 |
+
initial both_full_delay1 =0;
|
| 133 |
+
always @(posedge clk ) begin
|
| 134 |
+
both_full_delay1 <= both_full;
|
| 135 |
+
end
|
| 136 |
+
|
| 137 |
+
initial start = 0;
|
| 138 |
+
always @(posedge clk ) begin
|
| 139 |
+
start <= start_ahead1;
|
| 140 |
+
end
|
| 141 |
+
initial set_w_delay1= 0;
|
| 142 |
+
always @(posedge clk ) begin
|
| 143 |
+
set_w_delay1 <= set_w;
|
| 144 |
+
end
|
| 145 |
+
initial total_WL_reg= 0;
|
| 146 |
+
always @(posedge clk ) begin
|
| 147 |
+
total_WL_reg <= num_blobk_W * array_m;
|
| 148 |
+
end
|
| 149 |
+
initial FL_reg= 0;
|
| 150 |
+
always @(posedge clk ) begin
|
| 151 |
+
FL_reg <= FL;
|
| 152 |
+
end
|
| 153 |
+
|
| 154 |
+
always @(posedge clk or negedge rst_n) begin
|
| 155 |
+
if(~rst_n)
|
| 156 |
+
weight_buffer_cnt <= 0;
|
| 157 |
+
else if ( MM_buffer_inWeight_valid & MM_buffer_inWeight_ready)
|
| 158 |
+
weight_buffer_cnt <= weight_buffer_cnt + 1;
|
| 159 |
+
else if (total_last)
|
| 160 |
+
weight_buffer_cnt <= 0;
|
| 161 |
+
else
|
| 162 |
+
weight_buffer_cnt <= weight_buffer_cnt;
|
| 163 |
+
end
|
| 164 |
+
|
| 165 |
+
always @(posedge clk or negedge rst_n) begin
|
| 166 |
+
if(~rst_n)
|
| 167 |
+
feature_buffer_cnt <= 0;
|
| 168 |
+
else if ( MM_buffer_inFeature_valid & MM_buffer_inFeature_ready)
|
| 169 |
+
feature_buffer_cnt <= feature_buffer_cnt + 1;
|
| 170 |
+
else if (total_last)
|
| 171 |
+
feature_buffer_cnt <= 0;
|
| 172 |
+
else
|
| 173 |
+
feature_buffer_cnt <= feature_buffer_cnt;
|
| 174 |
+
end
|
| 175 |
+
|
| 176 |
+
always @(posedge clk or negedge rst_n) begin
|
| 177 |
+
if(~rst_n)
|
| 178 |
+
w_end <= 1;
|
| 179 |
+
else if(start)
|
| 180 |
+
w_end <= 0;
|
| 181 |
+
else if (input_weight_addr == total_WL_reg -1)
|
| 182 |
+
w_end <= 1;
|
| 183 |
+
else
|
| 184 |
+
w_end <= w_end;
|
| 185 |
+
end
|
| 186 |
+
|
| 187 |
+
always @(posedge clk or negedge rst_n) begin
|
| 188 |
+
if(~rst_n)
|
| 189 |
+
weight_buffer_in_addr <= 0;
|
| 190 |
+
else if ( MM_buffer_inWeight_last)
|
| 191 |
+
weight_buffer_in_addr <= 0;
|
| 192 |
+
else if ( MM_buffer_inWeight_valid & MM_buffer_inWeight_ready)
|
| 193 |
+
weight_buffer_in_addr <= weight_buffer_in_addr + 1;
|
| 194 |
+
else
|
| 195 |
+
weight_buffer_in_addr <= weight_buffer_in_addr;
|
| 196 |
+
end
|
| 197 |
+
|
| 198 |
+
always @(posedge clk ) begin
|
| 199 |
+
if( MM_buffer_inWeight_valid & MM_buffer_inWeight_ready)
|
| 200 |
+
weight_buffer[weight_buffer_in_addr] <= MM_buffer_inWeight_data;
|
| 201 |
+
end
|
| 202 |
+
|
| 203 |
+
always @(posedge clk or negedge rst_n) begin
|
| 204 |
+
if(~rst_n)
|
| 205 |
+
feature_buffer_in_addr <= 0;
|
| 206 |
+
else if ( MM_buffer_inFeature_last)
|
| 207 |
+
feature_buffer_in_addr <= 0;
|
| 208 |
+
else if ( MM_buffer_inFeature_valid & MM_buffer_inFeature_ready)
|
| 209 |
+
feature_buffer_in_addr <= feature_buffer_in_addr + 1;
|
| 210 |
+
else
|
| 211 |
+
feature_buffer_in_addr <= feature_buffer_in_addr;
|
| 212 |
+
end
|
| 213 |
+
|
| 214 |
+
always @(posedge clk ) begin
|
| 215 |
+
if( MM_buffer_inFeature_valid & MM_buffer_inFeature_ready)
|
| 216 |
+
feature_buffer[feature_buffer_in_addr] <= MM_buffer_inFeature_data;
|
| 217 |
+
end
|
| 218 |
+
|
| 219 |
+
always @(posedge clk or negedge rst_n) begin
|
| 220 |
+
if(~rst_n)
|
| 221 |
+
state <= `IDLE;
|
| 222 |
+
else if (state == `IDLE) begin //only start can wake up state
|
| 223 |
+
if (start)
|
| 224 |
+
state <= `SET_WEIGHT;
|
| 225 |
+
else
|
| 226 |
+
state <= state;
|
| 227 |
+
end
|
| 228 |
+
else begin
|
| 229 |
+
case ({weight_flag_up, set_w_delay1,total_last})
|
| 230 |
+
3'b100: state <= `SET_WEIGHT;
|
| 231 |
+
3'b010: state <= `SET_FEATURE;
|
| 232 |
+
3'b001: state <= `IDLE;
|
| 233 |
+
default: state <= state;
|
| 234 |
+
endcase
|
| 235 |
+
end
|
| 236 |
+
end
|
| 237 |
+
|
| 238 |
+
always @(posedge clk or negedge rst_n) begin
|
| 239 |
+
if (~rst_n)
|
| 240 |
+
weight_flag_up <= 0;
|
| 241 |
+
else if(weight_flag_up)
|
| 242 |
+
weight_flag_up <= 0;
|
| 243 |
+
else if (output_feature_last)
|
| 244 |
+
weight_flag_up <= 1;
|
| 245 |
+
end
|
| 246 |
+
|
| 247 |
+
always @(posedge clk or negedge rst_n) begin
|
| 248 |
+
if(~rst_n)
|
| 249 |
+
input_weight_valid <= 0;
|
| 250 |
+
else if(wdata_flag_up)
|
| 251 |
+
input_weight_valid <= 1;
|
| 252 |
+
else if(input_weight_last)
|
| 253 |
+
input_weight_valid <= 0;
|
| 254 |
+
else
|
| 255 |
+
input_weight_valid <= input_weight_valid;
|
| 256 |
+
end
|
| 257 |
+
|
| 258 |
+
always @(posedge clk ) begin
|
| 259 |
+
input_weight_data <= weight_buffer[input_weight_addr];
|
| 260 |
+
end
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
always @(posedge clk or negedge rst_n) begin
|
| 264 |
+
if(~rst_n)
|
| 265 |
+
weight_cnt <= 0;
|
| 266 |
+
else if (weight_cnt == array_m)
|
| 267 |
+
weight_cnt <= 0;
|
| 268 |
+
else if (state == `SET_WEIGHT & input_weight_valid)
|
| 269 |
+
weight_cnt <= weight_cnt + 1;
|
| 270 |
+
else
|
| 271 |
+
weight_cnt <= weight_cnt;
|
| 272 |
+
end
|
| 273 |
+
|
| 274 |
+
always @(posedge clk or negedge rst_n) begin
|
| 275 |
+
if(~rst_n)
|
| 276 |
+
input_feature_valid <= 0;
|
| 277 |
+
else if (set_w_delay1)
|
| 278 |
+
input_feature_valid <= 1;
|
| 279 |
+
else if (input_feature_last)
|
| 280 |
+
input_feature_valid <= 0;
|
| 281 |
+
else
|
| 282 |
+
input_feature_valid <= input_feature_valid;
|
| 283 |
+
end
|
| 284 |
+
|
| 285 |
+
always @(posedge clk ) begin
|
| 286 |
+
input_feature_data <= feature_buffer[input_feature_addr];
|
| 287 |
+
end
|
| 288 |
+
|
| 289 |
+
always @(posedge clk or negedge rst_n) begin
|
| 290 |
+
if(~rst_n)
|
| 291 |
+
input_feature_addr <= 0;
|
| 292 |
+
else if (input_feature_addr == FL_reg - 1)
|
| 293 |
+
input_feature_addr <= 0;
|
| 294 |
+
else if (set_w_delay1)
|
| 295 |
+
input_feature_addr <= 1;
|
| 296 |
+
else if (state == `SET_FEATURE & input_feature_valid & input_feature_addr!=0)//make sure that only set_w_dealy1 can pull up the addr when it equal to zero
|
| 297 |
+
input_feature_addr <= input_feature_addr + 1;
|
| 298 |
+
else
|
| 299 |
+
input_feature_addr <= input_feature_addr;
|
| 300 |
+
end
|
| 301 |
+
|
| 302 |
+
always @(posedge clk or negedge rst_n) begin
|
| 303 |
+
if(~rst_n)
|
| 304 |
+
feature_cnt <= 0;
|
| 305 |
+
else if(feature_cnt == FL_reg)
|
| 306 |
+
feature_cnt <= 0;
|
| 307 |
+
else if(state == `SET_FEATURE & input_feature_valid)
|
| 308 |
+
feature_cnt <= feature_cnt + 1;
|
| 309 |
+
else
|
| 310 |
+
feature_cnt <= feature_cnt;
|
| 311 |
+
end
|
| 312 |
+
|
| 313 |
+
always @(posedge clk or negedge rst_n) begin
|
| 314 |
+
if(~rst_n)
|
| 315 |
+
input_weight_col <= 0;
|
| 316 |
+
else if(input_weight_col == num_blobk_W)
|
| 317 |
+
input_weight_col <= 0;
|
| 318 |
+
else if(input_weight_last)
|
| 319 |
+
input_weight_col <= input_weight_col + 1;
|
| 320 |
+
else
|
| 321 |
+
input_weight_col <= input_weight_col;
|
| 322 |
+
end
|
| 323 |
+
|
| 324 |
+
always @(posedge clk or negedge rst_n) begin
|
| 325 |
+
if(~rst_n)
|
| 326 |
+
input_weight_row <= 0;
|
| 327 |
+
else if (input_weight_row == array_m - 1)
|
| 328 |
+
input_weight_row <= 0;
|
| 329 |
+
else if (wdata_flag_up)
|
| 330 |
+
input_weight_row <= 1;
|
| 331 |
+
else if (input_weight_row != 0)
|
| 332 |
+
input_weight_row <= input_weight_row + 1;
|
| 333 |
+
end
|
| 334 |
+
|
| 335 |
+
MM
|
| 336 |
+
#(
|
| 337 |
+
.array_m(array_m), //Array 行数
|
| 338 |
+
.array_n(array_n), //Array 列数
|
| 339 |
+
.data_width(data_width), //数据宽度
|
| 340 |
+
.log2_array_m(log2_array_m)
|
| 341 |
+
) u_MM
|
| 342 |
+
(
|
| 343 |
+
.clk(clk),
|
| 344 |
+
.rst_n(rst_n),
|
| 345 |
+
|
| 346 |
+
.set_w_port(set_w),
|
| 347 |
+
|
| 348 |
+
.wdata_flag_up(wdata_flag_up),
|
| 349 |
+
|
| 350 |
+
.MM_in_data(MM_in_data),
|
| 351 |
+
.MM_in_data_valid(MM_in_data_valid),
|
| 352 |
+
.MM_in_last(MM_in_last),
|
| 353 |
+
|
| 354 |
+
.MM_out_data(output_feature_data),
|
| 355 |
+
.MM_out_data_valid(output_feature_valid),
|
| 356 |
+
.MM_out_last(output_feature_last)
|
| 357 |
+
);
|
| 358 |
+
|
| 359 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_in_buffer.v
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
`define IDLE 2'b00
|
| 3 |
+
`define IN_DATA 2'b01
|
| 4 |
+
`define CAL 2'b11
|
| 5 |
+
// reg [A_size * data_width - 1:0] in_F_array [Feature_Width_Block_num * Feature_Length : 0];
|
| 6 |
+
// reg [A_size * data_width - 1:0] in_W_array [A_size * Weight_Width_Block_num * Feature_Width_Block_num : 0];
|
| 7 |
+
module MM_in_buffer
|
| 8 |
+
#(
|
| 9 |
+
parameter integer A_size = 24,
|
| 10 |
+
parameter integer data_width = 8,
|
| 11 |
+
parameter integer Weight_Block_num = 2400,
|
| 12 |
+
parameter integer IN_Feature_Block_num = 2400,
|
| 13 |
+
parameter integer F_length_width = 10,
|
| 14 |
+
parameter integer F_width_block_num_width = 5,
|
| 15 |
+
parameter integer W_width_block_num_width = 5
|
| 16 |
+
)(
|
| 17 |
+
input clk,
|
| 18 |
+
input rst_n,
|
| 19 |
+
|
| 20 |
+
input [W_width_block_num_width-1:0] W_width_block_num, //1 ~ block_num
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
input [F_width_block_num_width-1:0] F_width_block_num, //1 ~ block_num
|
| 24 |
+
input [F_length_width-1:0] F_length, //1 ~ block_num *A_size
|
| 25 |
+
|
| 26 |
+
input MM_buffer_out_last,
|
| 27 |
+
|
| 28 |
+
input in_F_valid,
|
| 29 |
+
input in_F_last,
|
| 30 |
+
output in_F_ready,
|
| 31 |
+
input [A_size * data_width - 1:0] in_F_data,
|
| 32 |
+
|
| 33 |
+
input in_W_valid,
|
| 34 |
+
input in_W_last,
|
| 35 |
+
output in_W_ready,
|
| 36 |
+
input [A_size * data_width - 1:0] in_W_data,
|
| 37 |
+
|
| 38 |
+
output reg in_MM_buffer_F_valid,
|
| 39 |
+
output in_MM_buffer_F_last,
|
| 40 |
+
input in_MM_buffer_F_ready,
|
| 41 |
+
output reg [A_size * data_width - 1:0] in_MM_buffer_F_data,
|
| 42 |
+
|
| 43 |
+
output reg in_MM_buffer_W_valid,
|
| 44 |
+
output in_MM_buffer_W_last,
|
| 45 |
+
input in_MM_buffer_W_ready,
|
| 46 |
+
output reg [A_size * data_width - 1:0] in_MM_buffer_W_data
|
| 47 |
+
|
| 48 |
+
);
|
| 49 |
+
function integer clogb2 (input integer bit_depth);
|
| 50 |
+
begin:log
|
| 51 |
+
automatic integer temp;
|
| 52 |
+
temp = 0;
|
| 53 |
+
for(clogb2=0; bit_depth>0; clogb2=clogb2+1)begin
|
| 54 |
+
if(bit_depth[0] & bit_depth!=1)
|
| 55 |
+
temp = 1;
|
| 56 |
+
bit_depth = bit_depth >> 1;
|
| 57 |
+
end
|
| 58 |
+
clogb2 = clogb2 + temp - 1;
|
| 59 |
+
end
|
| 60 |
+
endfunction
|
| 61 |
+
|
| 62 |
+
localparam integer F_size_width = clogb2(IN_Feature_Block_num);
|
| 63 |
+
localparam integer W_size_width = clogb2(Weight_Block_num);
|
| 64 |
+
localparam integer log_A_size = clogb2(A_size);
|
| 65 |
+
wire start;
|
| 66 |
+
|
| 67 |
+
reg [A_size * data_width - 1:0] in_F_array [IN_Feature_Block_num - 1 : 0];
|
| 68 |
+
reg [A_size * data_width - 1:0] in_W_array [Weight_Block_num - 1 : 0];
|
| 69 |
+
|
| 70 |
+
reg [1:0] state;
|
| 71 |
+
reg [W_size_width-1:0] W_block_size;
|
| 72 |
+
reg [F_size_width-1:0] F_block_size;
|
| 73 |
+
|
| 74 |
+
reg [F_size_width-1:0] in_F_cnt;
|
| 75 |
+
reg [F_size_width-1:0] in_F_addr;
|
| 76 |
+
|
| 77 |
+
reg [W_size_width-1:0] in_W_cnt;
|
| 78 |
+
reg [W_size_width-1:0] in_W_addr;
|
| 79 |
+
|
| 80 |
+
reg [F_size_width-1:0] in_MM_buffer_F_cnt;
|
| 81 |
+
reg [F_length_width-1:0] out_F_row_addr;
|
| 82 |
+
reg [F_width_block_num_width-1:0] out_F_col_addr;
|
| 83 |
+
wire [F_size_width-1:0] out_F_addr;
|
| 84 |
+
|
| 85 |
+
reg [W_size_width-1:0] in_MM_buffer_W_cnt;
|
| 86 |
+
reg [W_size_width-1:0] out_W_addr;
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
assign in_F_ready = (in_F_cnt < F_block_size) & (state != `CAL);
|
| 90 |
+
assign in_W_ready = (in_W_cnt < W_block_size) & (state != `CAL);
|
| 91 |
+
assign out_F_addr = out_F_row_addr * F_width_block_num + out_F_col_addr;
|
| 92 |
+
assign start = ((in_F_cnt == F_block_size & in_W_cnt == W_block_size)
|
| 93 |
+
| MM_buffer_out_last)
|
| 94 |
+
& (out_F_col_addr!=F_width_block_num);
|
| 95 |
+
assign in_MM_buffer_F_last = in_MM_buffer_F_cnt == F_length - 1;
|
| 96 |
+
assign in_MM_buffer_W_last = in_MM_buffer_W_cnt == W_width_block_num * A_size - 1;
|
| 97 |
+
|
| 98 |
+
initial F_block_size=0;
|
| 99 |
+
always @(posedge clk ) begin
|
| 100 |
+
F_block_size <= F_length * F_width_block_num;
|
| 101 |
+
end
|
| 102 |
+
|
| 103 |
+
reg [log_A_size + F_width_block_num_width-1:0] temp_m;
|
| 104 |
+
initial temp_m = 0;
|
| 105 |
+
initial W_block_size=0;
|
| 106 |
+
always @(posedge clk ) begin
|
| 107 |
+
temp_m <= F_width_block_num *A_size;
|
| 108 |
+
W_block_size <= W_width_block_num * temp_m;
|
| 109 |
+
end
|
| 110 |
+
|
| 111 |
+
always @(posedge clk ) begin
|
| 112 |
+
if(in_F_valid & in_F_ready)
|
| 113 |
+
in_F_array[in_F_addr] <= in_F_data;
|
| 114 |
+
end
|
| 115 |
+
|
| 116 |
+
always @(posedge clk ) begin
|
| 117 |
+
if(in_W_valid & in_W_ready)
|
| 118 |
+
in_W_array[in_W_addr] <= in_W_data;
|
| 119 |
+
end
|
| 120 |
+
|
| 121 |
+
always @(posedge clk) begin
|
| 122 |
+
in_MM_buffer_F_data <= in_F_array[out_F_addr];
|
| 123 |
+
end
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
always @(posedge clk) begin
|
| 127 |
+
in_MM_buffer_W_data <= in_W_array[out_W_addr];
|
| 128 |
+
end
|
| 129 |
+
|
| 130 |
+
always @(posedge clk or negedge rst_n) begin
|
| 131 |
+
if(~rst_n)
|
| 132 |
+
state <= `IDLE;
|
| 133 |
+
else if (state == `IDLE & (in_F_valid | in_W_valid))
|
| 134 |
+
state <= `IN_DATA;
|
| 135 |
+
else if (state == `IN_DATA & start)
|
| 136 |
+
state <= `CAL;
|
| 137 |
+
else if (state == `CAL & MM_buffer_out_last
|
| 138 |
+
& ( out_F_col_addr == F_width_block_num))
|
| 139 |
+
state <= `IDLE;
|
| 140 |
+
else
|
| 141 |
+
state <= state;
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
always @(posedge clk or negedge rst_n) begin
|
| 145 |
+
if(~rst_n)
|
| 146 |
+
in_F_cnt<=0;
|
| 147 |
+
else if (start)
|
| 148 |
+
in_F_cnt <= 0;
|
| 149 |
+
else if (in_F_valid & in_F_ready)
|
| 150 |
+
in_F_cnt <= in_F_cnt + 1;
|
| 151 |
+
else
|
| 152 |
+
in_F_cnt <= in_F_cnt;
|
| 153 |
+
end
|
| 154 |
+
|
| 155 |
+
always @(posedge clk or negedge rst_n) begin
|
| 156 |
+
if(~rst_n)
|
| 157 |
+
in_F_addr<=0;
|
| 158 |
+
else if (in_F_last)
|
| 159 |
+
in_F_addr <= 0;
|
| 160 |
+
else if (in_F_valid & in_F_ready)
|
| 161 |
+
in_F_addr <= in_F_addr + 1;
|
| 162 |
+
else
|
| 163 |
+
in_F_addr <= in_F_addr;
|
| 164 |
+
end
|
| 165 |
+
|
| 166 |
+
always @(posedge clk or negedge rst_n) begin
|
| 167 |
+
if(~rst_n)
|
| 168 |
+
in_W_cnt<=0;
|
| 169 |
+
else if (start)
|
| 170 |
+
in_W_cnt <= 0;
|
| 171 |
+
else if (in_W_valid & in_W_ready)
|
| 172 |
+
in_W_cnt <= in_W_cnt + 1;
|
| 173 |
+
else
|
| 174 |
+
in_W_cnt <= in_W_cnt;
|
| 175 |
+
end
|
| 176 |
+
|
| 177 |
+
always @(posedge clk or negedge rst_n) begin
|
| 178 |
+
if(~rst_n)
|
| 179 |
+
in_W_addr<=0;
|
| 180 |
+
else if (in_W_last)
|
| 181 |
+
in_W_addr <= 0;
|
| 182 |
+
else if (in_W_valid & in_W_ready)
|
| 183 |
+
in_W_addr <= in_W_addr + 1;
|
| 184 |
+
else
|
| 185 |
+
in_W_addr <= in_W_addr;
|
| 186 |
+
end
|
| 187 |
+
|
| 188 |
+
always @(posedge clk or negedge rst_n) begin
|
| 189 |
+
if(~rst_n)
|
| 190 |
+
in_MM_buffer_F_valid <= 0;
|
| 191 |
+
else if(start)
|
| 192 |
+
in_MM_buffer_F_valid <= 1;
|
| 193 |
+
else if (in_MM_buffer_F_last)
|
| 194 |
+
in_MM_buffer_F_valid <= 0;
|
| 195 |
+
else
|
| 196 |
+
in_MM_buffer_F_valid<=in_MM_buffer_F_valid;
|
| 197 |
+
end
|
| 198 |
+
|
| 199 |
+
always @(posedge clk or negedge rst_n) begin
|
| 200 |
+
if(~rst_n)
|
| 201 |
+
in_MM_buffer_F_cnt<=0;
|
| 202 |
+
else if (in_MM_buffer_F_cnt == F_length)
|
| 203 |
+
in_MM_buffer_F_cnt<=0;
|
| 204 |
+
else if (in_MM_buffer_F_valid & in_MM_buffer_F_ready)
|
| 205 |
+
in_MM_buffer_F_cnt<=in_MM_buffer_F_cnt+1;
|
| 206 |
+
else
|
| 207 |
+
in_MM_buffer_F_cnt <= in_MM_buffer_F_cnt;
|
| 208 |
+
end
|
| 209 |
+
|
| 210 |
+
always @(posedge clk or negedge rst_n) begin
|
| 211 |
+
if(~rst_n)
|
| 212 |
+
out_F_row_addr <= 0;
|
| 213 |
+
else if (start)
|
| 214 |
+
out_F_row_addr <= 1;
|
| 215 |
+
else if (out_F_row_addr == F_length - 1)
|
| 216 |
+
out_F_row_addr <= 0;
|
| 217 |
+
else if (out_F_row_addr != 0 & in_MM_buffer_F_valid & in_MM_buffer_F_ready)
|
| 218 |
+
out_F_row_addr <= out_F_row_addr + 1;
|
| 219 |
+
else
|
| 220 |
+
out_F_row_addr <= out_F_row_addr;
|
| 221 |
+
end
|
| 222 |
+
|
| 223 |
+
always @(posedge clk or negedge rst_n) begin
|
| 224 |
+
if(~rst_n)
|
| 225 |
+
out_F_col_addr <= 0;
|
| 226 |
+
else if (MM_buffer_out_last & out_F_col_addr == F_width_block_num)
|
| 227 |
+
out_F_col_addr <= 0;
|
| 228 |
+
else if(in_MM_buffer_F_last)
|
| 229 |
+
out_F_col_addr <= out_F_col_addr + 1;
|
| 230 |
+
else
|
| 231 |
+
out_F_col_addr <= out_F_col_addr;
|
| 232 |
+
end
|
| 233 |
+
|
| 234 |
+
always @(posedge clk or negedge rst_n) begin
|
| 235 |
+
if(~rst_n)
|
| 236 |
+
in_MM_buffer_W_valid <= 0;
|
| 237 |
+
else if(start)
|
| 238 |
+
in_MM_buffer_W_valid <= 1;
|
| 239 |
+
else if (in_MM_buffer_W_last)
|
| 240 |
+
in_MM_buffer_W_valid <= 0;
|
| 241 |
+
else
|
| 242 |
+
in_MM_buffer_W_valid<=in_MM_buffer_W_valid;
|
| 243 |
+
end
|
| 244 |
+
|
| 245 |
+
always @(posedge clk or negedge rst_n) begin
|
| 246 |
+
if(~rst_n)
|
| 247 |
+
in_MM_buffer_W_cnt <= 0;
|
| 248 |
+
else if (in_MM_buffer_W_cnt == W_width_block_num * A_size)
|
| 249 |
+
in_MM_buffer_W_cnt <= 0;
|
| 250 |
+
else if (in_MM_buffer_W_valid & in_MM_buffer_W_ready)
|
| 251 |
+
in_MM_buffer_W_cnt<=in_MM_buffer_W_cnt+1;
|
| 252 |
+
else
|
| 253 |
+
in_MM_buffer_W_cnt<=in_MM_buffer_W_cnt;
|
| 254 |
+
end
|
| 255 |
+
|
| 256 |
+
always @(posedge clk or negedge rst_n ) begin
|
| 257 |
+
if(~rst_n)
|
| 258 |
+
out_W_addr <= 0;
|
| 259 |
+
else if (out_W_addr== W_block_size -1)
|
| 260 |
+
out_W_addr <= 0;
|
| 261 |
+
else if ((start
|
| 262 |
+
| (in_MM_buffer_W_valid & in_MM_buffer_W_ready))
|
| 263 |
+
& (~in_MM_buffer_W_last))
|
| 264 |
+
out_W_addr<=out_W_addr+1;
|
| 265 |
+
else
|
| 266 |
+
out_W_addr<=out_W_addr;
|
| 267 |
+
end
|
| 268 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_out_buffer.v
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module MM_out_buffer
|
| 4 |
+
#(
|
| 5 |
+
parameter integer data_width = 8,
|
| 6 |
+
parameter integer OUT_Feature_Block_num = 2400,
|
| 7 |
+
parameter integer OUT_MEM_WIDTH = 32,
|
| 8 |
+
parameter integer A_size = 2,
|
| 9 |
+
parameter integer shift_width = 20,
|
| 10 |
+
parameter integer log2_array_m = 4,
|
| 11 |
+
parameter integer F_length_width = 10,
|
| 12 |
+
parameter integer F_width_block_num_width = 5,
|
| 13 |
+
parameter integer W_width_block_num_width = 5
|
| 14 |
+
)(
|
| 15 |
+
input clk,
|
| 16 |
+
input rst_n,
|
| 17 |
+
|
| 18 |
+
input [shift_width - 1:0] shift,
|
| 19 |
+
input [F_length_width-1:0] F_length, //1 ~ block_num *A_size
|
| 20 |
+
input [F_width_block_num_width-1:0] F_width_block_num, //1 ~ block_num
|
| 21 |
+
input [W_width_block_num_width-1:0] W_width_block_num, //1 ~ block_num
|
| 22 |
+
|
| 23 |
+
input in_data_valid,
|
| 24 |
+
input in_data_last,
|
| 25 |
+
input [A_size*(log2_array_m+data_width*2)-1:0] in_data,
|
| 26 |
+
|
| 27 |
+
output reg out_data_valid,
|
| 28 |
+
output out_data_last,
|
| 29 |
+
input out_data_ready,
|
| 30 |
+
output reg [A_size * data_width -1:0] out_data
|
| 31 |
+
);
|
| 32 |
+
|
| 33 |
+
function integer clogb2 (input integer bit_depth);
|
| 34 |
+
begin:log
|
| 35 |
+
automatic integer temp;
|
| 36 |
+
temp = 0;
|
| 37 |
+
for(clogb2=0; bit_depth>0; clogb2=clogb2+1)begin
|
| 38 |
+
if(bit_depth[0] & bit_depth!=1)
|
| 39 |
+
temp = 1;
|
| 40 |
+
bit_depth = bit_depth >> 1;
|
| 41 |
+
end
|
| 42 |
+
clogb2 = clogb2 + temp - 1;
|
| 43 |
+
end
|
| 44 |
+
endfunction
|
| 45 |
+
localparam integer F_size_width = clogb2(OUT_Feature_Block_num);
|
| 46 |
+
|
| 47 |
+
(*ram_style="block"*) reg [A_size*OUT_MEM_WIDTH-1:0] F_array [OUT_Feature_Block_num-1 : 0];
|
| 48 |
+
|
| 49 |
+
reg [F_size_width-1:0] out_F_block_size;
|
| 50 |
+
reg [F_size_width-1:0] B_addr;
|
| 51 |
+
reg [F_size_width-1:0] C_addr;
|
| 52 |
+
wire [A_size*(log2_array_m+data_width*2)-1:0] A;
|
| 53 |
+
wire [A_size*OUT_MEM_WIDTH-1:0] A_in_adder; //bit width extension
|
| 54 |
+
wire [A_size*OUT_MEM_WIDTH-1:0] B;
|
| 55 |
+
wire [A_size*OUT_MEM_WIDTH-1:0] C;
|
| 56 |
+
reg [F_width_block_num_width-1:0] last_cnt;
|
| 57 |
+
|
| 58 |
+
reg start_trans;
|
| 59 |
+
|
| 60 |
+
reg F_array_out_valid;
|
| 61 |
+
reg F_array_out_valid_delay1;
|
| 62 |
+
reg F_array_out_valid_delay2;
|
| 63 |
+
wire F_array_out_last_delay2;
|
| 64 |
+
reg [F_size_width-1:0] F_array_out_cnt;
|
| 65 |
+
reg [F_size_width-1:0] F_array_out_cnt_delay1;
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
wire [A_size*OUT_MEM_WIDTH-1:0] out_F_data;
|
| 69 |
+
reg [A_size*OUT_MEM_WIDTH-1:0] out_F_data_delay1;
|
| 70 |
+
wire [A_size * data_width -1:0] shifted_data;
|
| 71 |
+
reg [F_size_width-1:0] out_data_cnt;
|
| 72 |
+
|
| 73 |
+
reg [F_size_width-1:0] in_F_array_addr;
|
| 74 |
+
reg [A_size*OUT_MEM_WIDTH-1:0] in_F_array_data;
|
| 75 |
+
|
| 76 |
+
reg [W_width_block_num_width-1:0] out_data_col_addr;
|
| 77 |
+
reg [F_length_width-1:0] out_data_row_addr;
|
| 78 |
+
wire [F_size_width-1:0] out_data_addr;
|
| 79 |
+
reg [F_size_width-1:0] clear_addr;
|
| 80 |
+
|
| 81 |
+
wire [F_size_width-1:0] out_F_array_addr;
|
| 82 |
+
reg [A_size*OUT_MEM_WIDTH-1:0] out_F_array_data;
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
assign A = in_data;
|
| 86 |
+
// assign start_trans = last_cnt == F_width_block_num;
|
| 87 |
+
assign F_array_out_last_delay2 = F_array_out_cnt_delay1 == out_F_block_size;
|
| 88 |
+
assign out_data_addr = out_data_col_addr * F_length + out_data_row_addr;
|
| 89 |
+
assign out_data_last = (out_data_cnt == out_F_block_size-1) & out_data_ready;
|
| 90 |
+
|
| 91 |
+
genvar i;
|
| 92 |
+
generate
|
| 93 |
+
for(i=0; i<OUT_Feature_Block_num; i=i+1 )begin
|
| 94 |
+
initial begin F_array[i]<=0;end
|
| 95 |
+
end
|
| 96 |
+
endgenerate
|
| 97 |
+
|
| 98 |
+
always @(posedge clk or negedge rst_n) begin
|
| 99 |
+
if(~rst_n)
|
| 100 |
+
start_trans <= 0;
|
| 101 |
+
else if (F_array_out_valid)
|
| 102 |
+
start_trans <= 0;
|
| 103 |
+
else if (last_cnt == F_width_block_num)
|
| 104 |
+
start_trans <= 1;
|
| 105 |
+
end
|
| 106 |
+
|
| 107 |
+
always @(posedge clk or negedge rst_n) begin
|
| 108 |
+
if(~rst_n)
|
| 109 |
+
F_array_out_valid <= 0;
|
| 110 |
+
else if(start_trans & out_data_ready)
|
| 111 |
+
F_array_out_valid <= 1;
|
| 112 |
+
else if(F_array_out_cnt == out_F_block_size - 1 & (F_array_out_valid&out_data_ready))
|
| 113 |
+
F_array_out_valid <= 0;
|
| 114 |
+
else
|
| 115 |
+
F_array_out_valid <= F_array_out_valid;
|
| 116 |
+
end
|
| 117 |
+
|
| 118 |
+
always @(posedge clk or negedge rst_n) begin
|
| 119 |
+
if(~rst_n)
|
| 120 |
+
F_array_out_valid_delay1 <= 0;
|
| 121 |
+
else if (F_array_out_cnt_delay1 ==out_F_block_size-1 &(F_array_out_valid_delay1&out_data_ready))
|
| 122 |
+
F_array_out_valid_delay1<=0;
|
| 123 |
+
else if (F_array_out_valid & out_data_ready)
|
| 124 |
+
F_array_out_valid_delay1 <= 1;
|
| 125 |
+
else
|
| 126 |
+
F_array_out_valid_delay1<=F_array_out_valid_delay1;
|
| 127 |
+
end
|
| 128 |
+
|
| 129 |
+
initial F_array_out_valid_delay2 =0;
|
| 130 |
+
always @(posedge clk ) begin
|
| 131 |
+
if(out_data_ready)
|
| 132 |
+
F_array_out_valid_delay2<=F_array_out_valid_delay1;
|
| 133 |
+
end
|
| 134 |
+
|
| 135 |
+
always @(posedge clk or negedge rst_n) begin
|
| 136 |
+
if(~rst_n)
|
| 137 |
+
F_array_out_cnt <= 0;
|
| 138 |
+
else if (F_array_out_cnt == out_F_block_size)
|
| 139 |
+
F_array_out_cnt <= 0;
|
| 140 |
+
else if (F_array_out_valid & out_data_ready)
|
| 141 |
+
F_array_out_cnt <= F_array_out_cnt + 1;
|
| 142 |
+
else
|
| 143 |
+
F_array_out_cnt <= F_array_out_cnt;
|
| 144 |
+
end
|
| 145 |
+
|
| 146 |
+
always @(posedge clk or negedge rst_n) begin
|
| 147 |
+
if(~rst_n)
|
| 148 |
+
out_data_cnt <= 0;
|
| 149 |
+
else if (out_data_cnt == out_F_block_size)
|
| 150 |
+
out_data_cnt <= 0;
|
| 151 |
+
else if (out_data_valid & out_data_ready)
|
| 152 |
+
out_data_cnt <= out_data_cnt + 1;
|
| 153 |
+
else
|
| 154 |
+
out_data_cnt <= out_data_cnt;
|
| 155 |
+
end
|
| 156 |
+
|
| 157 |
+
always @(posedge clk or negedge rst_n) begin
|
| 158 |
+
if(~rst_n)
|
| 159 |
+
F_array_out_cnt_delay1 <= 0;
|
| 160 |
+
else if (F_array_out_cnt_delay1 == out_F_block_size)
|
| 161 |
+
F_array_out_cnt_delay1 <= 0;
|
| 162 |
+
else if (F_array_out_valid_delay1 & out_data_ready)
|
| 163 |
+
F_array_out_cnt_delay1 <= F_array_out_cnt_delay1 + 1;
|
| 164 |
+
else
|
| 165 |
+
F_array_out_cnt_delay1 <= F_array_out_cnt_delay1;
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
always @(posedge clk ) begin
|
| 169 |
+
if(F_array_out_valid_delay1 & out_data_ready)
|
| 170 |
+
out_F_data_delay1 <= out_F_data;
|
| 171 |
+
else
|
| 172 |
+
out_F_data_delay1 <= out_F_data_delay1;
|
| 173 |
+
end
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
always @(posedge clk ) begin
|
| 177 |
+
if(F_array_out_valid_delay2 & out_data_ready)
|
| 178 |
+
out_data <= shifted_data;
|
| 179 |
+
else
|
| 180 |
+
out_data <= out_data;
|
| 181 |
+
end
|
| 182 |
+
|
| 183 |
+
initial out_data_valid = 0;
|
| 184 |
+
always @(posedge clk ) begin
|
| 185 |
+
if(out_data_ready)
|
| 186 |
+
out_data_valid <= F_array_out_valid_delay2;
|
| 187 |
+
end
|
| 188 |
+
|
| 189 |
+
always @(posedge clk or negedge rst_n) begin
|
| 190 |
+
if(~rst_n)
|
| 191 |
+
out_data_col_addr <= 0;
|
| 192 |
+
else if (F_array_out_last_delay2)
|
| 193 |
+
out_data_col_addr <= 0;
|
| 194 |
+
else if (out_data_col_addr == W_width_block_num-1 & out_data_row_addr == F_length - 1 )
|
| 195 |
+
out_data_col_addr <= out_data_col_addr;
|
| 196 |
+
else if (out_data_col_addr == W_width_block_num-1 & (F_array_out_valid & out_data_ready))
|
| 197 |
+
out_data_col_addr <= 0;
|
| 198 |
+
else if (F_array_out_valid & out_data_ready)
|
| 199 |
+
out_data_col_addr <= out_data_col_addr+1;
|
| 200 |
+
end
|
| 201 |
+
|
| 202 |
+
always @(posedge clk or negedge rst_n) begin
|
| 203 |
+
if(~rst_n)
|
| 204 |
+
out_data_row_addr <= 0;
|
| 205 |
+
else if (F_array_out_last_delay2)
|
| 206 |
+
out_data_row_addr <= 0;
|
| 207 |
+
else if (out_data_row_addr == F_length - 1)
|
| 208 |
+
out_data_row_addr<=out_data_row_addr;
|
| 209 |
+
else if ((F_array_out_valid & out_data_ready)&
|
| 210 |
+
((out_data_col_addr == W_width_block_num-1 ) | ( W_width_block_num == 1 ))
|
| 211 |
+
)
|
| 212 |
+
out_data_row_addr <= out_data_row_addr + 1;
|
| 213 |
+
else
|
| 214 |
+
out_data_row_addr <= out_data_row_addr;
|
| 215 |
+
end
|
| 216 |
+
|
| 217 |
+
always @(*) begin
|
| 218 |
+
if(in_data_valid)
|
| 219 |
+
B_addr = C_addr + 1;
|
| 220 |
+
else
|
| 221 |
+
B_addr = C_addr;
|
| 222 |
+
end
|
| 223 |
+
|
| 224 |
+
always @(posedge clk or negedge rst_n) begin
|
| 225 |
+
if(~rst_n)
|
| 226 |
+
clear_addr <= 0;
|
| 227 |
+
// else if (out_data_last)
|
| 228 |
+
// clear_addr <= 0;
|
| 229 |
+
else if (F_array_out_last_delay2)
|
| 230 |
+
clear_addr <= out_F_block_size - 1;
|
| 231 |
+
// else if (out_data_addr == out_F_block_size - 1)
|
| 232 |
+
else if(out_data_col_addr == W_width_block_num-1 & out_data_row_addr == F_length - 1)
|
| 233 |
+
clear_addr <= clear_addr;
|
| 234 |
+
else if (F_array_out_valid & out_data_ready)
|
| 235 |
+
clear_addr <= out_data_addr;
|
| 236 |
+
end
|
| 237 |
+
|
| 238 |
+
always @(*) begin
|
| 239 |
+
case (in_data_valid)
|
| 240 |
+
1'b1: in_F_array_addr = C_addr;
|
| 241 |
+
1'b0: in_F_array_addr = clear_addr;
|
| 242 |
+
default: in_F_array_addr = 0;
|
| 243 |
+
endcase
|
| 244 |
+
end
|
| 245 |
+
|
| 246 |
+
always @(posedge clk ) begin //write port
|
| 247 |
+
if(in_data_valid)
|
| 248 |
+
F_array[in_F_array_addr] <= in_F_array_data;
|
| 249 |
+
else if (F_array_out_valid_delay1 | out_data_valid & out_data_ready)
|
| 250 |
+
F_array[in_F_array_addr] <=in_F_array_data;
|
| 251 |
+
end
|
| 252 |
+
|
| 253 |
+
always @(*) begin
|
| 254 |
+
if(in_data_valid)
|
| 255 |
+
in_F_array_data = C;
|
| 256 |
+
else
|
| 257 |
+
in_F_array_data = 0;
|
| 258 |
+
end
|
| 259 |
+
|
| 260 |
+
assign out_F_array_addr = (F_array_out_valid_delay2 | F_array_out_valid)? out_data_addr : B_addr;
|
| 261 |
+
|
| 262 |
+
always @(posedge clk) begin //read port
|
| 263 |
+
if (F_array_out_valid & ~out_data_ready)
|
| 264 |
+
out_F_array_data <= out_F_array_data;
|
| 265 |
+
else
|
| 266 |
+
out_F_array_data<=F_array[out_F_array_addr];
|
| 267 |
+
end
|
| 268 |
+
|
| 269 |
+
assign B = out_F_array_data;
|
| 270 |
+
assign out_F_data = out_F_array_data;
|
| 271 |
+
|
| 272 |
+
initial out_F_block_size =0;
|
| 273 |
+
always @(posedge clk ) begin
|
| 274 |
+
out_F_block_size <= F_length * W_width_block_num;
|
| 275 |
+
end
|
| 276 |
+
|
| 277 |
+
always @(posedge clk or negedge rst_n) begin
|
| 278 |
+
if(~rst_n)
|
| 279 |
+
C_addr <= 0;
|
| 280 |
+
else if (in_data_last)
|
| 281 |
+
C_addr <= 0;
|
| 282 |
+
else if(in_data_valid)
|
| 283 |
+
C_addr <= C_addr + 1;
|
| 284 |
+
else
|
| 285 |
+
C_addr <= C_addr;
|
| 286 |
+
end
|
| 287 |
+
|
| 288 |
+
always @(posedge clk or negedge rst_n) begin
|
| 289 |
+
if(~rst_n)
|
| 290 |
+
last_cnt <= 0;
|
| 291 |
+
else if (last_cnt == F_width_block_num)
|
| 292 |
+
last_cnt <= 0;
|
| 293 |
+
else if (in_data_last)
|
| 294 |
+
last_cnt <= last_cnt + 1;
|
| 295 |
+
else
|
| 296 |
+
last_cnt <= last_cnt;
|
| 297 |
+
end
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
AdderS
|
| 301 |
+
#(
|
| 302 |
+
.data_width(OUT_MEM_WIDTH),
|
| 303 |
+
.A_size(A_size)
|
| 304 |
+
)U_Adders
|
| 305 |
+
(
|
| 306 |
+
.A(A_in_adder),
|
| 307 |
+
.B(B),
|
| 308 |
+
.C(C)
|
| 309 |
+
);
|
| 310 |
+
|
| 311 |
+
generate
|
| 312 |
+
for(i=0;i<A_size;i=i+1)begin
|
| 313 |
+
assign A_in_adder[i*OUT_MEM_WIDTH +: OUT_MEM_WIDTH] = $signed(A[i*(log2_array_m+data_width*2) +: (log2_array_m+data_width*2)]);
|
| 314 |
+
end
|
| 315 |
+
endgenerate
|
| 316 |
+
|
| 317 |
+
generate
|
| 318 |
+
for(i=0;i<A_size;i=i+1)begin:right_shifter_u
|
| 319 |
+
right_shifter
|
| 320 |
+
#(
|
| 321 |
+
.before_data_width(OUT_MEM_WIDTH),
|
| 322 |
+
.after_data_width(data_width),
|
| 323 |
+
.shift_width(shift_width)
|
| 324 |
+
)u_right_shifter(
|
| 325 |
+
.shift(shift),
|
| 326 |
+
.data_in(out_F_data_delay1[i*OUT_MEM_WIDTH +: OUT_MEM_WIDTH]),
|
| 327 |
+
.data_out(shifted_data[i*data_width+:data_width])
|
| 328 |
+
);
|
| 329 |
+
end
|
| 330 |
+
endgenerate
|
| 331 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra.v
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
module MM_ultra
|
| 5 |
+
#(
|
| 6 |
+
parameter integer A_size = 16,
|
| 7 |
+
parameter integer data_width = 8,
|
| 8 |
+
parameter integer shift_width = 10,
|
| 9 |
+
parameter integer Weight_Block_num = 2400,
|
| 10 |
+
parameter integer IN_Feature_Block_num = 2400,
|
| 11 |
+
parameter integer OUT_Feature_Block_num = 2400,
|
| 12 |
+
parameter integer OUT_MEM_WIDTH = 32,
|
| 13 |
+
parameter integer F_length_width = 9,
|
| 14 |
+
parameter integer F_width_block_num_width = 5,
|
| 15 |
+
parameter integer W_width_block_num_width = 5
|
| 16 |
+
)(
|
| 17 |
+
input clk,
|
| 18 |
+
input rst_n,
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
input [shift_width-1:0] shift_in,
|
| 22 |
+
input [F_length_width-1:0] F_length_in,
|
| 23 |
+
input [F_width_block_num_width-1:0] F_width_block_num_in,
|
| 24 |
+
input [W_width_block_num_width-1:0] W_width_block_num_in,
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
input in_F_valid,
|
| 28 |
+
input in_F_last,
|
| 29 |
+
output in_F_ready,
|
| 30 |
+
input [A_size * data_width - 1:0] in_F_data,
|
| 31 |
+
|
| 32 |
+
input in_W_valid,
|
| 33 |
+
input in_W_last,
|
| 34 |
+
output in_W_ready,
|
| 35 |
+
input [A_size * data_width - 1:0] in_W_data,
|
| 36 |
+
|
| 37 |
+
output out_data_valid,
|
| 38 |
+
input out_data_ready,
|
| 39 |
+
output out_data_last,
|
| 40 |
+
output [A_size * data_width -1:0] out_data
|
| 41 |
+
|
| 42 |
+
);
|
| 43 |
+
function integer clogb2 (input integer bit_depth);
|
| 44 |
+
begin:log
|
| 45 |
+
automatic integer temp;
|
| 46 |
+
temp = 0;
|
| 47 |
+
for(clogb2=0; bit_depth>0; clogb2=clogb2+1)begin
|
| 48 |
+
if(bit_depth[0] & bit_depth!=1)
|
| 49 |
+
temp = 1;
|
| 50 |
+
bit_depth = bit_depth >> 1;
|
| 51 |
+
end
|
| 52 |
+
clogb2 = clogb2 + temp - 1;
|
| 53 |
+
end
|
| 54 |
+
endfunction
|
| 55 |
+
localparam integer log2_array_m = clogb2(A_size);
|
| 56 |
+
|
| 57 |
+
reg [shift_width-1:0] shift;
|
| 58 |
+
reg [F_length_width-1:0] F_length;
|
| 59 |
+
reg [F_width_block_num_width-1:0] F_width_block_num;
|
| 60 |
+
reg [W_width_block_num_width-1:0] W_width_block_num;
|
| 61 |
+
reg [shift_width-1:0] shift_in_delay1;
|
| 62 |
+
reg [F_length_width-1:0] F_length_in_delay1;
|
| 63 |
+
reg [F_width_block_num_width-1:0] F_width_block_num_in_delay1;
|
| 64 |
+
reg [W_width_block_num_width-1:0] W_width_block_num_in_delay1;
|
| 65 |
+
|
| 66 |
+
initial begin
|
| 67 |
+
shift = {(shift_width){1'b1}};
|
| 68 |
+
F_length = {(F_length_width){1'b1}};
|
| 69 |
+
F_width_block_num = {(F_width_block_num_width){1'b1}};
|
| 70 |
+
W_width_block_num = {(W_width_block_num_width){1'b1}};
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
always @(posedge clk ) begin
|
| 74 |
+
if(shift_in_delay1 != shift_in)
|
| 75 |
+
shift <= shift_in;
|
| 76 |
+
end
|
| 77 |
+
|
| 78 |
+
always @(posedge clk ) begin
|
| 79 |
+
if(F_length_in_delay1 != F_length_in)
|
| 80 |
+
F_length <=F_length_in;
|
| 81 |
+
end
|
| 82 |
+
|
| 83 |
+
always @(posedge clk ) begin
|
| 84 |
+
if(F_width_block_num_in_delay1 != F_width_block_num_in)
|
| 85 |
+
F_width_block_num <= F_width_block_num_in;
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
always @(posedge clk ) begin
|
| 89 |
+
if(W_width_block_num_in_delay1 != W_width_block_num_in)
|
| 90 |
+
W_width_block_num <= W_width_block_num_in;
|
| 91 |
+
end
|
| 92 |
+
|
| 93 |
+
always @(posedge clk ) begin
|
| 94 |
+
shift_in_delay1 <= shift_in;
|
| 95 |
+
F_length_in_delay1 <= F_length_in;
|
| 96 |
+
F_width_block_num_in_delay1 <= F_width_block_num_in;
|
| 97 |
+
W_width_block_num_in_delay1 <= W_width_block_num_in;
|
| 98 |
+
end
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
wire [A_size*(log2_array_m+data_width*2)-1:0] MM_buffer_out_data;
|
| 102 |
+
wire MM_buffer_out_valid;
|
| 103 |
+
wire MM_buffer_out_last;
|
| 104 |
+
|
| 105 |
+
wire in_MM_buffer_F_valid;
|
| 106 |
+
wire in_MM_buffer_F_last;
|
| 107 |
+
wire in_MM_buffer_F_ready;
|
| 108 |
+
wire [A_size * data_width - 1:0] in_MM_buffer_F_data;
|
| 109 |
+
|
| 110 |
+
wire in_MM_buffer_W_valid;
|
| 111 |
+
wire in_MM_buffer_W_last;
|
| 112 |
+
wire in_MM_buffer_W_ready;
|
| 113 |
+
wire [A_size * data_width - 1:0] in_MM_buffer_W_data;
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
MM_in_buffer
|
| 119 |
+
#(
|
| 120 |
+
.A_size(A_size),
|
| 121 |
+
.data_width(data_width),
|
| 122 |
+
.Weight_Block_num(Weight_Block_num),
|
| 123 |
+
.IN_Feature_Block_num(IN_Feature_Block_num),
|
| 124 |
+
.F_length_width(F_length_width),
|
| 125 |
+
.F_width_block_num_width(F_width_block_num_width),
|
| 126 |
+
.W_width_block_num_width(W_width_block_num_width)
|
| 127 |
+
)u_MM_in_buffer(
|
| 128 |
+
.clk(clk),
|
| 129 |
+
.rst_n(rst_n),
|
| 130 |
+
|
| 131 |
+
.W_width_block_num(W_width_block_num), //1 ~ block_num
|
| 132 |
+
.F_width_block_num(F_width_block_num), //1 ~ block_num
|
| 133 |
+
.F_length(F_length), //1 ~ block_num *A_size
|
| 134 |
+
|
| 135 |
+
.MM_buffer_out_last(MM_buffer_out_last),
|
| 136 |
+
|
| 137 |
+
.in_F_valid(in_F_valid),
|
| 138 |
+
.in_F_last(in_F_last),
|
| 139 |
+
.in_F_ready(in_F_ready),
|
| 140 |
+
.in_F_data(in_F_data),
|
| 141 |
+
|
| 142 |
+
.in_W_valid(in_W_valid),
|
| 143 |
+
.in_W_last(in_W_last),
|
| 144 |
+
.in_W_ready(in_W_ready),
|
| 145 |
+
.in_W_data(in_W_data),
|
| 146 |
+
|
| 147 |
+
.in_MM_buffer_F_valid(in_MM_buffer_F_valid),
|
| 148 |
+
.in_MM_buffer_F_last(in_MM_buffer_F_last),
|
| 149 |
+
.in_MM_buffer_F_ready(in_MM_buffer_F_ready),
|
| 150 |
+
.in_MM_buffer_F_data(in_MM_buffer_F_data),
|
| 151 |
+
|
| 152 |
+
.in_MM_buffer_W_valid(in_MM_buffer_W_valid),
|
| 153 |
+
.in_MM_buffer_W_last(in_MM_buffer_W_last),
|
| 154 |
+
.in_MM_buffer_W_ready(in_MM_buffer_W_ready),
|
| 155 |
+
.in_MM_buffer_W_data(in_MM_buffer_W_data)
|
| 156 |
+
|
| 157 |
+
);
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
MM_buffer
|
| 161 |
+
#(
|
| 162 |
+
.array_m(A_size),
|
| 163 |
+
.array_n(A_size),
|
| 164 |
+
.data_width(data_width),
|
| 165 |
+
.log2_array_m(log2_array_m),
|
| 166 |
+
.F_length_width(F_length_width),
|
| 167 |
+
.W_width_block_num_width(W_width_block_num_width)
|
| 168 |
+
)u_MM_buffer(
|
| 169 |
+
.clk(clk),
|
| 170 |
+
.rst_n(rst_n),
|
| 171 |
+
|
| 172 |
+
// .shift(shift),
|
| 173 |
+
.FL(F_length), //feature length
|
| 174 |
+
.num_blobk_W(W_width_block_num),
|
| 175 |
+
|
| 176 |
+
.MM_buffer_inWeight_data(in_MM_buffer_W_data),
|
| 177 |
+
.MM_buffer_inWeight_valid(in_MM_buffer_W_valid),
|
| 178 |
+
.MM_buffer_inWeight_ready(in_MM_buffer_W_ready),
|
| 179 |
+
.MM_buffer_inWeight_last(in_MM_buffer_W_last),
|
| 180 |
+
|
| 181 |
+
.MM_buffer_inFeature_data(in_MM_buffer_F_data),
|
| 182 |
+
.MM_buffer_inFeature_valid(in_MM_buffer_F_valid),
|
| 183 |
+
.MM_buffer_inFeature_ready(in_MM_buffer_F_ready),
|
| 184 |
+
.MM_buffer_inFeature_last(in_MM_buffer_F_last),
|
| 185 |
+
|
| 186 |
+
.MM_buffer_out_data(MM_buffer_out_data),
|
| 187 |
+
.MM_buffer_out_valid(MM_buffer_out_valid),
|
| 188 |
+
.MM_buffer_out_last(MM_buffer_out_last)
|
| 189 |
+
);
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
MM_out_buffer
|
| 193 |
+
#(
|
| 194 |
+
.data_width(data_width),
|
| 195 |
+
.OUT_Feature_Block_num(OUT_Feature_Block_num),
|
| 196 |
+
.A_size(A_size),
|
| 197 |
+
.shift_width(shift_width),
|
| 198 |
+
.log2_array_m(log2_array_m),
|
| 199 |
+
.OUT_MEM_WIDTH(OUT_MEM_WIDTH),
|
| 200 |
+
.F_length_width(F_length_width),
|
| 201 |
+
.F_width_block_num_width(F_width_block_num_width),
|
| 202 |
+
.W_width_block_num_width(W_width_block_num_width)
|
| 203 |
+
)u_MM_out_buffer(
|
| 204 |
+
.clk(clk),
|
| 205 |
+
.rst_n(rst_n),
|
| 206 |
+
|
| 207 |
+
.shift(shift),
|
| 208 |
+
.F_length(F_length), //1 ~ block_num *A_size
|
| 209 |
+
.F_width_block_num(F_width_block_num), //1 ~ block_num
|
| 210 |
+
.W_width_block_num(W_width_block_num), //1 ~ block_num
|
| 211 |
+
|
| 212 |
+
.in_data_valid(MM_buffer_out_valid),
|
| 213 |
+
.in_data_last(MM_buffer_out_last),
|
| 214 |
+
.in_data(MM_buffer_out_data),
|
| 215 |
+
|
| 216 |
+
.out_data_valid(out_data_valid),
|
| 217 |
+
.out_data_ready(out_data_ready),
|
| 218 |
+
.out_data_last(out_data_last),
|
| 219 |
+
.out_data(out_data)
|
| 220 |
+
);
|
| 221 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra_axi.v
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
`timescale 1 ns / 1 ps
|
| 3 |
+
|
| 4 |
+
module MM_ultra_axi #
|
| 5 |
+
(
|
| 6 |
+
// Users to add parameters here
|
| 7 |
+
parameter integer array_size=24,
|
| 8 |
+
parameter integer data_width=8,
|
| 9 |
+
parameter integer shift_width=5,
|
| 10 |
+
parameter integer Weight_block_num=2500,
|
| 11 |
+
parameter integer in_feature_Block_num=2500,
|
| 12 |
+
parameter integer out_feature_block_num=2500,
|
| 13 |
+
parameter integer out_mem_width=32,
|
| 14 |
+
parameter integer feature_length_width=10,
|
| 15 |
+
parameter integer feature_width_block_num_width=5,
|
| 16 |
+
parameter integer weight_width_block_num_width=5,
|
| 17 |
+
|
| 18 |
+
// User parameters ends
|
| 19 |
+
// Do not modify the parameters beyond this line
|
| 20 |
+
|
| 21 |
+
// Width of S_AXI data bus
|
| 22 |
+
parameter integer C_S_AXI_DATA_WIDTH = 32,
|
| 23 |
+
// Width of S_AXI address bus
|
| 24 |
+
parameter integer C_S_AXI_ADDR_WIDTH = 4
|
| 25 |
+
)
|
| 26 |
+
(
|
| 27 |
+
// Users to add ports here
|
| 28 |
+
input axis_aclk,
|
| 29 |
+
input aresetn,
|
| 30 |
+
|
| 31 |
+
input [array_size*data_width-1:0] s0_axis_tdata,
|
| 32 |
+
input s0_axis_tvalid,
|
| 33 |
+
output s0_axis_tready,
|
| 34 |
+
input s0_axis_tlast,
|
| 35 |
+
|
| 36 |
+
input [array_size*data_width-1:0] s1_axis_tdata,
|
| 37 |
+
input s1_axis_tvalid,
|
| 38 |
+
output s1_axis_tready,
|
| 39 |
+
input s1_axis_tlast,
|
| 40 |
+
|
| 41 |
+
output [array_size*data_width-1:0] m0_axis_tdata,
|
| 42 |
+
output m0_axis_tvalid,
|
| 43 |
+
input m0_axis_tready,
|
| 44 |
+
output m0_axis_tlast,
|
| 45 |
+
// User ports ends
|
| 46 |
+
// Do not modify the ports beyond this line
|
| 47 |
+
|
| 48 |
+
// Global Clock Signal
|
| 49 |
+
input wire S_AXI_ACLK,
|
| 50 |
+
// Global Reset Signal. This Signal is Active LOW
|
| 51 |
+
input wire S_AXI_ARESETN,
|
| 52 |
+
// Write address (issued by master, acceped by Slave)
|
| 53 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_AWADDR,
|
| 54 |
+
// Write channel Protection type. This signal indicates the
|
| 55 |
+
// privilege and security level of the transaction, and whether
|
| 56 |
+
// the transaction is a data access or an instruction access.
|
| 57 |
+
input wire [2 : 0] S_AXI_AWPROT,
|
| 58 |
+
// Write address valid. This signal indicates that the master signaling
|
| 59 |
+
// valid write address and control information.
|
| 60 |
+
input wire S_AXI_AWVALID,
|
| 61 |
+
// Write address ready. This signal indicates that the slave is ready
|
| 62 |
+
// to accept an address and associated control signals.
|
| 63 |
+
output wire S_AXI_AWREADY,
|
| 64 |
+
// Write data (issued by master, acceped by Slave)
|
| 65 |
+
input wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_WDATA,
|
| 66 |
+
// Write strobes. This signal indicates which byte lanes hold
|
| 67 |
+
// valid data. There is one write strobe bit for each eight
|
| 68 |
+
// bits of the write data bus.
|
| 69 |
+
input wire [(C_S_AXI_DATA_WIDTH/8)-1 : 0] S_AXI_WSTRB,
|
| 70 |
+
// Write valid. This signal indicates that valid write
|
| 71 |
+
// data and strobes are available.
|
| 72 |
+
input wire S_AXI_WVALID,
|
| 73 |
+
// Write ready. This signal indicates that the slave
|
| 74 |
+
// can accept the write data.
|
| 75 |
+
output wire S_AXI_WREADY,
|
| 76 |
+
// Write response. This signal indicates the status
|
| 77 |
+
// of the write transaction.
|
| 78 |
+
output wire [1 : 0] S_AXI_BRESP,
|
| 79 |
+
// Write response valid. This signal indicates that the channel
|
| 80 |
+
// is signaling a valid write response.
|
| 81 |
+
output wire S_AXI_BVALID,
|
| 82 |
+
// Response ready. This signal indicates that the master
|
| 83 |
+
// can accept a write response.
|
| 84 |
+
input wire S_AXI_BREADY,
|
| 85 |
+
// Read address (issued by master, acceped by Slave)
|
| 86 |
+
input wire [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_ARADDR,
|
| 87 |
+
// Protection type. This signal indicates the privilege
|
| 88 |
+
// and security level of the transaction, and whether the
|
| 89 |
+
// transaction is a data access or an instruction access.
|
| 90 |
+
input wire [2 : 0] S_AXI_ARPROT,
|
| 91 |
+
// Read address valid. This signal indicates that the channel
|
| 92 |
+
// is signaling valid read address and control information.
|
| 93 |
+
input wire S_AXI_ARVALID,
|
| 94 |
+
// Read address ready. This signal indicates that the slave is
|
| 95 |
+
// ready to accept an address and associated control signals.
|
| 96 |
+
output wire S_AXI_ARREADY,
|
| 97 |
+
// Read data (issued by slave)
|
| 98 |
+
output wire [C_S_AXI_DATA_WIDTH-1 : 0] S_AXI_RDATA,
|
| 99 |
+
// Read response. This signal indicates the status of the
|
| 100 |
+
// read transfer.
|
| 101 |
+
output wire [1 : 0] S_AXI_RRESP,
|
| 102 |
+
// Read valid. This signal indicates that the channel is
|
| 103 |
+
// signaling the required read data.
|
| 104 |
+
output wire S_AXI_RVALID,
|
| 105 |
+
// Read ready. This signal indicates that the master can
|
| 106 |
+
// accept the read data and response information.
|
| 107 |
+
input wire S_AXI_RREADY
|
| 108 |
+
);
|
| 109 |
+
|
| 110 |
+
// AXI4LITE signals
|
| 111 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_awaddr;
|
| 112 |
+
reg axi_awready;
|
| 113 |
+
reg axi_wready;
|
| 114 |
+
reg [1 : 0] axi_bresp;
|
| 115 |
+
reg axi_bvalid;
|
| 116 |
+
reg [C_S_AXI_ADDR_WIDTH-1 : 0] axi_araddr;
|
| 117 |
+
reg axi_arready;
|
| 118 |
+
reg [C_S_AXI_DATA_WIDTH-1 : 0] axi_rdata;
|
| 119 |
+
reg [1 : 0] axi_rresp;
|
| 120 |
+
reg axi_rvalid;
|
| 121 |
+
|
| 122 |
+
// Example-specific design signals
|
| 123 |
+
// local parameter for addressing 32 bit / 64 bit C_S_AXI_DATA_WIDTH
|
| 124 |
+
// ADDR_LSB is used for addressing 32/64 bit registers/memories
|
| 125 |
+
// ADDR_LSB = 2 for 32 bits (n downto 2)
|
| 126 |
+
// ADDR_LSB = 3 for 64 bits (n downto 3)
|
| 127 |
+
localparam integer ADDR_LSB = (C_S_AXI_DATA_WIDTH/32) + 1;
|
| 128 |
+
localparam integer OPT_MEM_ADDR_BITS = 1;
|
| 129 |
+
//----------------------------------------------
|
| 130 |
+
//-- Signals for user logic register space example
|
| 131 |
+
//------------------------------------------------
|
| 132 |
+
//-- Number of Slave Registers 4
|
| 133 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg0;
|
| 134 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg1;
|
| 135 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg2;
|
| 136 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] slv_reg3;
|
| 137 |
+
wire slv_reg_rden;
|
| 138 |
+
wire slv_reg_wren;
|
| 139 |
+
reg [C_S_AXI_DATA_WIDTH-1:0] reg_data_out;
|
| 140 |
+
integer byte_index;
|
| 141 |
+
reg aw_en;
|
| 142 |
+
|
| 143 |
+
// I/O Connections assignments
|
| 144 |
+
|
| 145 |
+
assign S_AXI_AWREADY = axi_awready;
|
| 146 |
+
assign S_AXI_WREADY = axi_wready;
|
| 147 |
+
assign S_AXI_BRESP = axi_bresp;
|
| 148 |
+
assign S_AXI_BVALID = axi_bvalid;
|
| 149 |
+
assign S_AXI_ARREADY = axi_arready;
|
| 150 |
+
assign S_AXI_RDATA = axi_rdata;
|
| 151 |
+
assign S_AXI_RRESP = axi_rresp;
|
| 152 |
+
assign S_AXI_RVALID = axi_rvalid;
|
| 153 |
+
// Implement axi_awready generation
|
| 154 |
+
// axi_awready is asserted for one S_AXI_ACLK clock cycle when both
|
| 155 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_awready is
|
| 156 |
+
// de-asserted when reset is low.
|
| 157 |
+
|
| 158 |
+
always @( posedge S_AXI_ACLK )
|
| 159 |
+
begin
|
| 160 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 161 |
+
begin
|
| 162 |
+
axi_awready <= 1'b0;
|
| 163 |
+
aw_en <= 1'b1;
|
| 164 |
+
end
|
| 165 |
+
else
|
| 166 |
+
begin
|
| 167 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 168 |
+
begin
|
| 169 |
+
// slave is ready to accept write address when
|
| 170 |
+
// there is a valid write address and write data
|
| 171 |
+
// on the write address and data bus. This design
|
| 172 |
+
// expects no outstanding transactions.
|
| 173 |
+
axi_awready <= 1'b1;
|
| 174 |
+
aw_en <= 1'b0;
|
| 175 |
+
end
|
| 176 |
+
else if (S_AXI_BREADY && axi_bvalid)
|
| 177 |
+
begin
|
| 178 |
+
aw_en <= 1'b1;
|
| 179 |
+
axi_awready <= 1'b0;
|
| 180 |
+
end
|
| 181 |
+
else
|
| 182 |
+
begin
|
| 183 |
+
axi_awready <= 1'b0;
|
| 184 |
+
end
|
| 185 |
+
end
|
| 186 |
+
end
|
| 187 |
+
|
| 188 |
+
// Implement axi_awaddr latching
|
| 189 |
+
// This process is used to latch the address when both
|
| 190 |
+
// S_AXI_AWVALID and S_AXI_WVALID are valid.
|
| 191 |
+
|
| 192 |
+
always @( posedge S_AXI_ACLK )
|
| 193 |
+
begin
|
| 194 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 195 |
+
begin
|
| 196 |
+
axi_awaddr <= 0;
|
| 197 |
+
end
|
| 198 |
+
else
|
| 199 |
+
begin
|
| 200 |
+
if (~axi_awready && S_AXI_AWVALID && S_AXI_WVALID && aw_en)
|
| 201 |
+
begin
|
| 202 |
+
// Write Address latching
|
| 203 |
+
axi_awaddr <= S_AXI_AWADDR;
|
| 204 |
+
end
|
| 205 |
+
end
|
| 206 |
+
end
|
| 207 |
+
|
| 208 |
+
// Implement axi_wready generation
|
| 209 |
+
// axi_wready is asserted for one S_AXI_ACLK clock cycle when both
|
| 210 |
+
// S_AXI_AWVALID and S_AXI_WVALID are asserted. axi_wready is
|
| 211 |
+
// de-asserted when reset is low.
|
| 212 |
+
|
| 213 |
+
always @( posedge S_AXI_ACLK )
|
| 214 |
+
begin
|
| 215 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 216 |
+
begin
|
| 217 |
+
axi_wready <= 1'b0;
|
| 218 |
+
end
|
| 219 |
+
else
|
| 220 |
+
begin
|
| 221 |
+
if (~axi_wready && S_AXI_WVALID && S_AXI_AWVALID && aw_en )
|
| 222 |
+
begin
|
| 223 |
+
// slave is ready to accept write data when
|
| 224 |
+
// there is a valid write address and write data
|
| 225 |
+
// on the write address and data bus. This design
|
| 226 |
+
// expects no outstanding transactions.
|
| 227 |
+
axi_wready <= 1'b1;
|
| 228 |
+
end
|
| 229 |
+
else
|
| 230 |
+
begin
|
| 231 |
+
axi_wready <= 1'b0;
|
| 232 |
+
end
|
| 233 |
+
end
|
| 234 |
+
end
|
| 235 |
+
|
| 236 |
+
// Implement memory mapped register select and write logic generation
|
| 237 |
+
// The write data is accepted and written to memory mapped registers when
|
| 238 |
+
// axi_awready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted. Write strobes are used to
|
| 239 |
+
// select byte enables of slave registers while writing.
|
| 240 |
+
// These registers are cleared when reset (active low) is applied.
|
| 241 |
+
// Slave register write enable is asserted when valid address and data are available
|
| 242 |
+
// and the slave is ready to accept the write address and write data.
|
| 243 |
+
assign slv_reg_wren = axi_wready && S_AXI_WVALID && axi_awready && S_AXI_AWVALID;
|
| 244 |
+
|
| 245 |
+
always @( posedge S_AXI_ACLK )
|
| 246 |
+
begin
|
| 247 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 248 |
+
begin
|
| 249 |
+
slv_reg0 <= 0;
|
| 250 |
+
slv_reg1 <= 0;
|
| 251 |
+
slv_reg2 <= 0;
|
| 252 |
+
slv_reg3 <= 0;
|
| 253 |
+
end
|
| 254 |
+
else begin
|
| 255 |
+
if (slv_reg_wren)
|
| 256 |
+
begin
|
| 257 |
+
case ( axi_awaddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 258 |
+
2'h0:
|
| 259 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 260 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 261 |
+
// Respective byte enables are asserted as per write strobes
|
| 262 |
+
// Slave register 0
|
| 263 |
+
slv_reg0[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 264 |
+
end
|
| 265 |
+
2'h1:
|
| 266 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 267 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 268 |
+
// Respective byte enables are asserted as per write strobes
|
| 269 |
+
// Slave register 1
|
| 270 |
+
slv_reg1[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 271 |
+
end
|
| 272 |
+
2'h2:
|
| 273 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 274 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 275 |
+
// Respective byte enables are asserted as per write strobes
|
| 276 |
+
// Slave register 2
|
| 277 |
+
slv_reg2[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 278 |
+
end
|
| 279 |
+
2'h3:
|
| 280 |
+
for ( byte_index = 0; byte_index <= (C_S_AXI_DATA_WIDTH/8)-1; byte_index = byte_index+1 )
|
| 281 |
+
if ( S_AXI_WSTRB[byte_index] == 1 ) begin
|
| 282 |
+
// Respective byte enables are asserted as per write strobes
|
| 283 |
+
// Slave register 3
|
| 284 |
+
slv_reg3[(byte_index*8) +: 8] <= S_AXI_WDATA[(byte_index*8) +: 8];
|
| 285 |
+
end
|
| 286 |
+
default : begin
|
| 287 |
+
slv_reg0 <= slv_reg0;
|
| 288 |
+
slv_reg1 <= slv_reg1;
|
| 289 |
+
slv_reg2 <= slv_reg2;
|
| 290 |
+
slv_reg3 <= slv_reg3;
|
| 291 |
+
end
|
| 292 |
+
endcase
|
| 293 |
+
end
|
| 294 |
+
end
|
| 295 |
+
end
|
| 296 |
+
|
| 297 |
+
// Implement write response logic generation
|
| 298 |
+
// The write response and response valid signals are asserted by the slave
|
| 299 |
+
// when axi_wready, S_AXI_WVALID, axi_wready and S_AXI_WVALID are asserted.
|
| 300 |
+
// This marks the acceptance of address and indicates the status of
|
| 301 |
+
// write transaction.
|
| 302 |
+
|
| 303 |
+
always @( posedge S_AXI_ACLK )
|
| 304 |
+
begin
|
| 305 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 306 |
+
begin
|
| 307 |
+
axi_bvalid <= 0;
|
| 308 |
+
axi_bresp <= 2'b0;
|
| 309 |
+
end
|
| 310 |
+
else
|
| 311 |
+
begin
|
| 312 |
+
if (axi_awready && S_AXI_AWVALID && ~axi_bvalid && axi_wready && S_AXI_WVALID)
|
| 313 |
+
begin
|
| 314 |
+
// indicates a valid write response is available
|
| 315 |
+
axi_bvalid <= 1'b1;
|
| 316 |
+
axi_bresp <= 2'b0; // 'OKAY' response
|
| 317 |
+
end // work error responses in future
|
| 318 |
+
else
|
| 319 |
+
begin
|
| 320 |
+
if (S_AXI_BREADY && axi_bvalid)
|
| 321 |
+
//check if bready is asserted while bvalid is high)
|
| 322 |
+
//(there is a possibility that bready is always asserted high)
|
| 323 |
+
begin
|
| 324 |
+
axi_bvalid <= 1'b0;
|
| 325 |
+
end
|
| 326 |
+
end
|
| 327 |
+
end
|
| 328 |
+
end
|
| 329 |
+
|
| 330 |
+
// Implement axi_arready generation
|
| 331 |
+
// axi_arready is asserted for one S_AXI_ACLK clock cycle when
|
| 332 |
+
// S_AXI_ARVALID is asserted. axi_awready is
|
| 333 |
+
// de-asserted when reset (active low) is asserted.
|
| 334 |
+
// The read address is also latched when S_AXI_ARVALID is
|
| 335 |
+
// asserted. axi_araddr is reset to zero on reset assertion.
|
| 336 |
+
|
| 337 |
+
always @( posedge S_AXI_ACLK )
|
| 338 |
+
begin
|
| 339 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 340 |
+
begin
|
| 341 |
+
axi_arready <= 1'b0;
|
| 342 |
+
axi_araddr <= 32'b0;
|
| 343 |
+
end
|
| 344 |
+
else
|
| 345 |
+
begin
|
| 346 |
+
if (~axi_arready && S_AXI_ARVALID)
|
| 347 |
+
begin
|
| 348 |
+
// indicates that the slave has acceped the valid read address
|
| 349 |
+
axi_arready <= 1'b1;
|
| 350 |
+
// Read address latching
|
| 351 |
+
axi_araddr <= S_AXI_ARADDR;
|
| 352 |
+
end
|
| 353 |
+
else
|
| 354 |
+
begin
|
| 355 |
+
axi_arready <= 1'b0;
|
| 356 |
+
end
|
| 357 |
+
end
|
| 358 |
+
end
|
| 359 |
+
|
| 360 |
+
// Implement axi_arvalid generation
|
| 361 |
+
// axi_rvalid is asserted for one S_AXI_ACLK clock cycle when both
|
| 362 |
+
// S_AXI_ARVALID and axi_arready are asserted. The slave registers
|
| 363 |
+
// data are available on the axi_rdata bus at this instance. The
|
| 364 |
+
// assertion of axi_rvalid marks the validity of read data on the
|
| 365 |
+
// bus and axi_rresp indicates the status of read transaction.axi_rvalid
|
| 366 |
+
// is deasserted on reset (active low). axi_rresp and axi_rdata are
|
| 367 |
+
// cleared to zero on reset (active low).
|
| 368 |
+
always @( posedge S_AXI_ACLK )
|
| 369 |
+
begin
|
| 370 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 371 |
+
begin
|
| 372 |
+
axi_rvalid <= 0;
|
| 373 |
+
axi_rresp <= 0;
|
| 374 |
+
end
|
| 375 |
+
else
|
| 376 |
+
begin
|
| 377 |
+
if (axi_arready && S_AXI_ARVALID && ~axi_rvalid)
|
| 378 |
+
begin
|
| 379 |
+
// Valid read data is available at the read data bus
|
| 380 |
+
axi_rvalid <= 1'b1;
|
| 381 |
+
axi_rresp <= 2'b0; // 'OKAY' response
|
| 382 |
+
end
|
| 383 |
+
else if (axi_rvalid && S_AXI_RREADY)
|
| 384 |
+
begin
|
| 385 |
+
// Read data is accepted by the master
|
| 386 |
+
axi_rvalid <= 1'b0;
|
| 387 |
+
end
|
| 388 |
+
end
|
| 389 |
+
end
|
| 390 |
+
|
| 391 |
+
// Implement memory mapped register select and read logic generation
|
| 392 |
+
// Slave register read enable is asserted when valid address is available
|
| 393 |
+
// and the slave is ready to accept the read address.
|
| 394 |
+
assign slv_reg_rden = axi_arready & S_AXI_ARVALID & ~axi_rvalid;
|
| 395 |
+
always @(*)
|
| 396 |
+
begin
|
| 397 |
+
// Address decoding for reading registers
|
| 398 |
+
case ( axi_araddr[ADDR_LSB+OPT_MEM_ADDR_BITS:ADDR_LSB] )
|
| 399 |
+
2'h0 : reg_data_out <= slv_reg0;
|
| 400 |
+
2'h1 : reg_data_out <= slv_reg1;
|
| 401 |
+
2'h2 : reg_data_out <= slv_reg2;
|
| 402 |
+
2'h3 : reg_data_out <= slv_reg3;
|
| 403 |
+
default : reg_data_out <= 0;
|
| 404 |
+
endcase
|
| 405 |
+
end
|
| 406 |
+
|
| 407 |
+
// Output register or memory read data
|
| 408 |
+
always @( posedge S_AXI_ACLK )
|
| 409 |
+
begin
|
| 410 |
+
if ( S_AXI_ARESETN == 1'b0 )
|
| 411 |
+
begin
|
| 412 |
+
axi_rdata <= 0;
|
| 413 |
+
end
|
| 414 |
+
else
|
| 415 |
+
begin
|
| 416 |
+
// When there is a valid read address (S_AXI_ARVALID) with
|
| 417 |
+
// acceptance of read address by the slave (axi_arready),
|
| 418 |
+
// output the read dada
|
| 419 |
+
if (slv_reg_rden)
|
| 420 |
+
begin
|
| 421 |
+
axi_rdata <= reg_data_out; // register read data
|
| 422 |
+
end
|
| 423 |
+
end
|
| 424 |
+
end
|
| 425 |
+
|
| 426 |
+
// Add user logic here
|
| 427 |
+
MM_ultra
|
| 428 |
+
#(
|
| 429 |
+
.A_size(array_size), //决定了SA的边长,即大小
|
| 430 |
+
.data_width(data_width), //决定了量化的数据位宽
|
| 431 |
+
.shift_width(shift_width), //决定了移位器移位变量的位宽
|
| 432 |
+
.Weight_Block_num(Weight_block_num), //决定了IN_BUFFER里面weight_buffer_block的数量 一个block包含A_size个数据,数据位宽 data_width
|
| 433 |
+
.IN_Feature_Block_num(in_feature_Block_num), //决定了IN_BUFFER里面feature_buffer_block的数量 一个block包含A_size个数据,数据位宽 data_width
|
| 434 |
+
.OUT_Feature_Block_num(out_feature_block_num), //决定了OUT_BUFFER里面feature_buffer_block的数量 一个block包含A_size个数据,数据位宽OUT_MEM_WIDTH
|
| 435 |
+
.OUT_MEM_WIDTH(out_mem_width), //决定了OUT_BUFFER的数据位宽
|
| 436 |
+
.F_length_width(feature_length_width), //决定了F_length寄存器位宽以及MM_buffer里面bram大小
|
| 437 |
+
.F_width_block_num_width(feature_width_block_num_width), //决定了F_width_block_num寄存器位宽
|
| 438 |
+
.W_width_block_num_width(weight_width_block_num_width) //决定了W_width_block_num寄存器位宽以及MM_buffer里面bram大小
|
| 439 |
+
//F_length和W_width_block_num会有相乘,注意时序
|
| 440 |
+
)u_MM_ultra(
|
| 441 |
+
.clk(axis_aclk),
|
| 442 |
+
.rst_n(aresetn),
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
.shift_in(slv_reg0),
|
| 446 |
+
.F_length_in(slv_reg1), //1 ~ block_num *A_size
|
| 447 |
+
.F_width_block_num_in(slv_reg2), //1 ~ block_num
|
| 448 |
+
.W_width_block_num_in(slv_reg3), //1 ~ block_num
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
.in_F_valid(s0_axis_tvalid),
|
| 452 |
+
.in_F_last(s0_axis_tlast),
|
| 453 |
+
.in_F_ready(s0_axis_tready),
|
| 454 |
+
.in_F_data(s0_axis_tdata),
|
| 455 |
+
|
| 456 |
+
.in_W_valid(s1_axis_tvalid),
|
| 457 |
+
.in_W_last(s1_axis_tlast),
|
| 458 |
+
.in_W_ready(s1_axis_tready),
|
| 459 |
+
.in_W_data(s1_axis_tdata),
|
| 460 |
+
|
| 461 |
+
.out_data_valid(m0_axis_tvalid),
|
| 462 |
+
.out_data_last(m0_axis_tlast),
|
| 463 |
+
.out_data_ready(m0_axis_tready),
|
| 464 |
+
.out_data(m0_axis_tdata)
|
| 465 |
+
);
|
| 466 |
+
|
| 467 |
+
// User logic ends
|
| 468 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/MM_ultra_top.v
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module MM_ultra_top #
|
| 4 |
+
(
|
| 5 |
+
// Users to add parameters here
|
| 6 |
+
parameter integer array_size=24,
|
| 7 |
+
parameter integer data_width=8,
|
| 8 |
+
parameter integer shift_width=5,
|
| 9 |
+
parameter integer Weight_block_num=2000,
|
| 10 |
+
parameter integer in_feature_Block_num=2000,
|
| 11 |
+
parameter integer out_feature_block_num=2000,
|
| 12 |
+
parameter integer out_mem_width=21,
|
| 13 |
+
parameter integer feature_length_width=10,
|
| 14 |
+
parameter integer feature_width_block_num_width=6,
|
| 15 |
+
parameter integer weight_width_block_num_width=6,
|
| 16 |
+
// User parameters ends
|
| 17 |
+
// Do not modify the parameters beyond this line
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Parameters of Axi Slave Bus Interface S00_AXI
|
| 21 |
+
localparam integer C_S00_AXI_DATA_WIDTH = 32,
|
| 22 |
+
localparam integer C_S00_AXI_ADDR_WIDTH = 4
|
| 23 |
+
)
|
| 24 |
+
(
|
| 25 |
+
// Users to add ports here
|
| 26 |
+
input aclk,
|
| 27 |
+
input aresetn,
|
| 28 |
+
|
| 29 |
+
input [array_size*data_width-1:0] s0_axis_tdata,
|
| 30 |
+
input s0_axis_tvalid,
|
| 31 |
+
output s0_axis_tready,
|
| 32 |
+
input s0_axis_tlast,
|
| 33 |
+
|
| 34 |
+
input [array_size*data_width-1:0] s1_axis_tdata,
|
| 35 |
+
input s1_axis_tvalid,
|
| 36 |
+
output s1_axis_tready,
|
| 37 |
+
input s1_axis_tlast,
|
| 38 |
+
|
| 39 |
+
output [array_size*data_width-1:0] m0_axis_tdata,
|
| 40 |
+
output m0_axis_tvalid,
|
| 41 |
+
input m0_axis_tready,
|
| 42 |
+
output m0_axis_tlast,
|
| 43 |
+
// User ports ends
|
| 44 |
+
// Do not modify the ports beyond this line
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
// Ports of Axi Slave Bus Interface S00_AXI
|
| 48 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_awaddr,
|
| 49 |
+
input wire [2 : 0] s00_axi_awprot,
|
| 50 |
+
input wire s00_axi_awvalid,
|
| 51 |
+
output wire s00_axi_awready,
|
| 52 |
+
input wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_wdata,
|
| 53 |
+
input wire [(C_S00_AXI_DATA_WIDTH/8)-1 : 0] s00_axi_wstrb,
|
| 54 |
+
input wire s00_axi_wvalid,
|
| 55 |
+
output wire s00_axi_wready,
|
| 56 |
+
output wire [1 : 0] s00_axi_bresp,
|
| 57 |
+
output wire s00_axi_bvalid,
|
| 58 |
+
input wire s00_axi_bready,
|
| 59 |
+
input wire [C_S00_AXI_ADDR_WIDTH-1 : 0] s00_axi_araddr,
|
| 60 |
+
input wire [2 : 0] s00_axi_arprot,
|
| 61 |
+
input wire s00_axi_arvalid,
|
| 62 |
+
output wire s00_axi_arready,
|
| 63 |
+
output wire [C_S00_AXI_DATA_WIDTH-1 : 0] s00_axi_rdata,
|
| 64 |
+
output wire [1 : 0] s00_axi_rresp,
|
| 65 |
+
output wire s00_axi_rvalid,
|
| 66 |
+
input wire s00_axi_rready
|
| 67 |
+
);
|
| 68 |
+
// Instantiation of Axi Bus Interface S00_AXI
|
| 69 |
+
MM_ultra_axi # (
|
| 70 |
+
.C_S_AXI_DATA_WIDTH(C_S00_AXI_DATA_WIDTH),
|
| 71 |
+
.C_S_AXI_ADDR_WIDTH(C_S00_AXI_ADDR_WIDTH),
|
| 72 |
+
|
| 73 |
+
.array_size(array_size),
|
| 74 |
+
.data_width(data_width),
|
| 75 |
+
.shift_width(shift_width),
|
| 76 |
+
.Weight_block_num(Weight_block_num),
|
| 77 |
+
.in_feature_Block_num(in_feature_Block_num),
|
| 78 |
+
.out_feature_block_num(out_feature_block_num),
|
| 79 |
+
.out_mem_width(out_mem_width),
|
| 80 |
+
.feature_length_width(feature_length_width),
|
| 81 |
+
.feature_width_block_num_width(feature_width_block_num_width),
|
| 82 |
+
.weight_width_block_num_width(weight_width_block_num_width)
|
| 83 |
+
) U_MM_ultra_axi (
|
| 84 |
+
.S_AXI_ACLK(aclk),
|
| 85 |
+
.S_AXI_ARESETN(aresetn),
|
| 86 |
+
.S_AXI_AWADDR(s00_axi_awaddr),
|
| 87 |
+
.S_AXI_AWPROT(s00_axi_awprot),
|
| 88 |
+
.S_AXI_AWVALID(s00_axi_awvalid),
|
| 89 |
+
.S_AXI_AWREADY(s00_axi_awready),
|
| 90 |
+
.S_AXI_WDATA(s00_axi_wdata),
|
| 91 |
+
.S_AXI_WSTRB(s00_axi_wstrb),
|
| 92 |
+
.S_AXI_WVALID(s00_axi_wvalid),
|
| 93 |
+
.S_AXI_WREADY(s00_axi_wready),
|
| 94 |
+
.S_AXI_BRESP(s00_axi_bresp),
|
| 95 |
+
.S_AXI_BVALID(s00_axi_bvalid),
|
| 96 |
+
.S_AXI_BREADY(s00_axi_bready),
|
| 97 |
+
.S_AXI_ARADDR(s00_axi_araddr),
|
| 98 |
+
.S_AXI_ARPROT(s00_axi_arprot),
|
| 99 |
+
.S_AXI_ARVALID(s00_axi_arvalid),
|
| 100 |
+
.S_AXI_ARREADY(s00_axi_arready),
|
| 101 |
+
.S_AXI_RDATA(s00_axi_rdata),
|
| 102 |
+
.S_AXI_RRESP(s00_axi_rresp),
|
| 103 |
+
.S_AXI_RVALID(s00_axi_rvalid),
|
| 104 |
+
.S_AXI_RREADY(s00_axi_rready),
|
| 105 |
+
|
| 106 |
+
.axis_aclk(aclk),
|
| 107 |
+
.aresetn(aresetn),
|
| 108 |
+
|
| 109 |
+
.s0_axis_tdata(s0_axis_tdata),
|
| 110 |
+
.s0_axis_tvalid(s0_axis_tvalid),
|
| 111 |
+
.s0_axis_tready(s0_axis_tready),
|
| 112 |
+
.s0_axis_tlast(s0_axis_tlast),
|
| 113 |
+
|
| 114 |
+
.s1_axis_tdata(s1_axis_tdata),
|
| 115 |
+
.s1_axis_tvalid(s1_axis_tvalid),
|
| 116 |
+
.s1_axis_tready(s1_axis_tready),
|
| 117 |
+
.s1_axis_tlast(s1_axis_tlast),
|
| 118 |
+
|
| 119 |
+
.m0_axis_tdata(m0_axis_tdata),
|
| 120 |
+
.m0_axis_tvalid(m0_axis_tvalid),
|
| 121 |
+
.m0_axis_tready(m0_axis_tready),
|
| 122 |
+
.m0_axis_tlast(m0_axis_tlast)
|
| 123 |
+
);
|
| 124 |
+
|
| 125 |
+
// Add user logic here
|
| 126 |
+
|
| 127 |
+
// User logic ends
|
| 128 |
+
|
| 129 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE.v
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module PE
|
| 4 |
+
#(
|
| 5 |
+
parameter data_width = 8,
|
| 6 |
+
parameter array_m = 16,
|
| 7 |
+
parameter array_n = 16,
|
| 8 |
+
parameter log2_array_m = 4
|
| 9 |
+
)
|
| 10 |
+
(
|
| 11 |
+
input clk,
|
| 12 |
+
input set_w,
|
| 13 |
+
input rst_n,
|
| 14 |
+
input signed [data_width-1:0] x_in,
|
| 15 |
+
input signed [data_width-1:0] w,
|
| 16 |
+
input signed [2*data_width+log2_array_m-1:0] psum_in,
|
| 17 |
+
output reg signed [data_width-1:0] x_out,
|
| 18 |
+
output reg signed [2*data_width+log2_array_m-1:0] psum_out
|
| 19 |
+
);
|
| 20 |
+
reg signed [data_width-1:0] reg_w;
|
| 21 |
+
|
| 22 |
+
always @(posedge clk or negedge rst_n) begin
|
| 23 |
+
if(~rst_n)begin
|
| 24 |
+
psum_out <= 0;
|
| 25 |
+
reg_w <= 0;
|
| 26 |
+
x_out <= 0;
|
| 27 |
+
end
|
| 28 |
+
else begin
|
| 29 |
+
if(set_w)
|
| 30 |
+
reg_w <=w;
|
| 31 |
+
psum_out <= psum_in + x_in*reg_w;
|
| 32 |
+
x_out <= x_in;
|
| 33 |
+
end
|
| 34 |
+
end
|
| 35 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE_array.v
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module PE_array
|
| 4 |
+
(
|
| 5 |
+
clk,
|
| 6 |
+
rst_n,
|
| 7 |
+
set_w,
|
| 8 |
+
x_packed,
|
| 9 |
+
w_packed,
|
| 10 |
+
PE_out_packed
|
| 11 |
+
);
|
| 12 |
+
parameter integer data_width = 8;
|
| 13 |
+
parameter integer array_m = 16;
|
| 14 |
+
parameter integer array_n = 16;
|
| 15 |
+
parameter integer log2_array_m = 4;
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
input wire clk;
|
| 19 |
+
input wire rst_n;
|
| 20 |
+
input wire set_w;
|
| 21 |
+
input [data_width*array_m-1:0] x_packed;
|
| 22 |
+
input [array_m*array_n*data_width-1:0] w_packed;
|
| 23 |
+
output [array_n*(log2_array_m+data_width*2)-1:0] PE_out_packed;
|
| 24 |
+
|
| 25 |
+
wire [array_n*data_width-1:0] w_line_array [array_m-1:0];
|
| 26 |
+
wire [array_n*(log2_array_m+data_width*2)-1:0] psum_in_packed_array [array_m:0];
|
| 27 |
+
|
| 28 |
+
wire [data_width-1:0] x_array [array_m-1:0];
|
| 29 |
+
|
| 30 |
+
//assign PE_out_packed = psum_in_packed_array[array_m];
|
| 31 |
+
wire [array_n*(log2_array_m+data_width*2)-1:0] psum_in_packed_last;
|
| 32 |
+
assign psum_in_packed_last = psum_in_packed_array[array_m];
|
| 33 |
+
genvar i;
|
| 34 |
+
generate
|
| 35 |
+
for(i=array_n-1;i>=0;i=i-1) begin: buf_out
|
| 36 |
+
if(i==array_n-1)begin
|
| 37 |
+
assign PE_out_packed[(log2_array_m+data_width*2)*i +: (log2_array_m+data_width*2)] = psum_in_packed_last[(log2_array_m+data_width*2)*i +: (log2_array_m+data_width*2)];
|
| 38 |
+
end
|
| 39 |
+
else begin
|
| 40 |
+
reg [(log2_array_m+data_width*2)-1:0] out_buf [array_n-2-i:0];
|
| 41 |
+
always @(posedge clk or negedge rst_n) begin
|
| 42 |
+
if(~rst_n)
|
| 43 |
+
out_buf[0]<=0;
|
| 44 |
+
else
|
| 45 |
+
out_buf[0]<=psum_in_packed_last[i*(log2_array_m+data_width*2) +: (log2_array_m+data_width*2)];
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
genvar k;
|
| 49 |
+
for (k=1;k<=array_n-2-i;k=k+1)begin:out_buf_for
|
| 50 |
+
always@(posedge clk or negedge rst_n)begin
|
| 51 |
+
if(~rst_n)
|
| 52 |
+
out_buf[k]<=0;
|
| 53 |
+
else
|
| 54 |
+
out_buf[k]<=out_buf[k-1];
|
| 55 |
+
end
|
| 56 |
+
end
|
| 57 |
+
assign PE_out_packed[i*(log2_array_m+data_width*2) +: (log2_array_m+data_width*2)] = out_buf [array_n-2-i];
|
| 58 |
+
end
|
| 59 |
+
end
|
| 60 |
+
endgenerate
|
| 61 |
+
assign psum_in_packed_array[0] = 0;
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
generate
|
| 65 |
+
for (i=0;i<array_m;i=i+1)begin:packed_to_array_1
|
| 66 |
+
assign x_array[i] = x_packed[data_width*i +: data_width];
|
| 67 |
+
assign w_line_array[i] = w_packed[(array_n*data_width)*i +: (array_n*data_width)];
|
| 68 |
+
end
|
| 69 |
+
endgenerate
|
| 70 |
+
|
| 71 |
+
generate
|
| 72 |
+
for (i=0; i<array_m; i=i+1) begin:array
|
| 73 |
+
if (i==0) begin
|
| 74 |
+
PE_line #(
|
| 75 |
+
.data_width (data_width),
|
| 76 |
+
.array_m(array_m),
|
| 77 |
+
.array_n(array_n),
|
| 78 |
+
.log2_array_m(log2_array_m)
|
| 79 |
+
)
|
| 80 |
+
PE_line_u
|
| 81 |
+
(
|
| 82 |
+
.clk(clk),
|
| 83 |
+
.rst_n(rst_n),
|
| 84 |
+
.set_w(set_w),
|
| 85 |
+
.x(x_array[i]),
|
| 86 |
+
.psum_in_packed(psum_in_packed_array[i]),
|
| 87 |
+
.w_packed(w_line_array[i]),
|
| 88 |
+
.psum_out_packed(psum_in_packed_array[i+1])
|
| 89 |
+
);
|
| 90 |
+
end
|
| 91 |
+
else begin
|
| 92 |
+
reg [data_width-1:0] x_buf [i-1:0];
|
| 93 |
+
always @(posedge clk or negedge rst_n) begin
|
| 94 |
+
if(~rst_n)
|
| 95 |
+
x_buf[0]<=0;
|
| 96 |
+
else
|
| 97 |
+
x_buf[0]<=x_array[i];
|
| 98 |
+
end
|
| 99 |
+
|
| 100 |
+
genvar k;
|
| 101 |
+
for (k=1;k<=i-1;k=k+1)begin:x_buf_for
|
| 102 |
+
always@(posedge clk or negedge rst_n)begin
|
| 103 |
+
if(~rst_n)
|
| 104 |
+
x_buf[k]<=0;
|
| 105 |
+
else
|
| 106 |
+
x_buf[k]<=x_buf[k-1];
|
| 107 |
+
end
|
| 108 |
+
end
|
| 109 |
+
|
| 110 |
+
PE_line #(
|
| 111 |
+
.data_width (data_width),
|
| 112 |
+
.array_m(array_m),
|
| 113 |
+
.array_n(array_n),
|
| 114 |
+
.log2_array_m(log2_array_m)
|
| 115 |
+
)
|
| 116 |
+
PE_line_u
|
| 117 |
+
(
|
| 118 |
+
.clk(clk),
|
| 119 |
+
.rst_n(rst_n),
|
| 120 |
+
.set_w(set_w),
|
| 121 |
+
.x(x_buf[i-1]),
|
| 122 |
+
.psum_in_packed(psum_in_packed_array[i]),
|
| 123 |
+
.w_packed(w_line_array[i]),
|
| 124 |
+
.psum_out_packed(psum_in_packed_array[i+1])
|
| 125 |
+
);
|
| 126 |
+
end
|
| 127 |
+
end
|
| 128 |
+
endgenerate
|
| 129 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/PE_line.v
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
|
| 3 |
+
module PE_line
|
| 4 |
+
#(
|
| 5 |
+
parameter array_m = 4,
|
| 6 |
+
parameter array_n = 4,
|
| 7 |
+
parameter data_width = 8,
|
| 8 |
+
parameter log2_array_m = 2
|
| 9 |
+
)
|
| 10 |
+
(
|
| 11 |
+
input clk,
|
| 12 |
+
input rst_n,
|
| 13 |
+
input set_w,
|
| 14 |
+
input [data_width-1:0] x,
|
| 15 |
+
input [array_n*(log2_array_m+data_width*2)-1:0] psum_in_packed,
|
| 16 |
+
input [array_n*data_width-1:0] w_packed,
|
| 17 |
+
output [array_n*(log2_array_m+data_width*2)-1:0] psum_out_packed
|
| 18 |
+
);
|
| 19 |
+
|
| 20 |
+
wire [2*data_width+log2_array_m-1:0] psum_in_array [array_n-1:0];
|
| 21 |
+
wire [2*data_width+log2_array_m-1:0] psum_out_array [array_n-1:0];
|
| 22 |
+
wire [data_width-1:0] w_array [array_n-1:0];
|
| 23 |
+
wire [data_width-1:0] x_array [array_n:0];
|
| 24 |
+
|
| 25 |
+
assign x_array[0]=x;
|
| 26 |
+
|
| 27 |
+
genvar i;
|
| 28 |
+
generate
|
| 29 |
+
for(i=0;i<array_n;i=i+1)begin:packed_to_array_1
|
| 30 |
+
assign w_array[i] = w_packed[ data_width*i +: data_width];
|
| 31 |
+
assign psum_out_packed[(log2_array_m+data_width*2)*i +: (log2_array_m+data_width*2)] = psum_out_array[i];
|
| 32 |
+
assign psum_in_array[i] = psum_in_packed[(log2_array_m+data_width*2)*i +: (log2_array_m+data_width*2)];
|
| 33 |
+
end
|
| 34 |
+
endgenerate
|
| 35 |
+
|
| 36 |
+
generate
|
| 37 |
+
for(i=0;i<array_n;i=i+1)begin:array_line
|
| 38 |
+
PE#(
|
| 39 |
+
.data_width(data_width),
|
| 40 |
+
.array_m(array_m),
|
| 41 |
+
.array_n(array_n),
|
| 42 |
+
.log2_array_m(log2_array_m)
|
| 43 |
+
)
|
| 44 |
+
PE_u(
|
| 45 |
+
.clk(clk),
|
| 46 |
+
.set_w(set_w),
|
| 47 |
+
.rst_n(rst_n),
|
| 48 |
+
.x_in(x_array[i]),
|
| 49 |
+
.w(w_array[i]),
|
| 50 |
+
.psum_in(psum_in_array[i]),
|
| 51 |
+
.x_out(x_array[i+1]),
|
| 52 |
+
.psum_out(psum_out_array[i])
|
| 53 |
+
);
|
| 54 |
+
end
|
| 55 |
+
endgenerate
|
| 56 |
+
endmodule
|
Buck008_Transformer-Accelerator-Based-on-FPGA/src/right_shifter.v
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
`timescale 1ns / 1ps
|
| 2 |
+
//��������
|
| 3 |
+
module right_shifter
|
| 4 |
+
#(
|
| 5 |
+
parameter before_data_width = 32,
|
| 6 |
+
parameter after_data_width = 8,
|
| 7 |
+
parameter shift_width = 5
|
| 8 |
+
)
|
| 9 |
+
(
|
| 10 |
+
shift,
|
| 11 |
+
data_in,
|
| 12 |
+
data_out
|
| 13 |
+
);
|
| 14 |
+
|
| 15 |
+
input wire [shift_width-1:0]shift;
|
| 16 |
+
input wire signed [before_data_width-1:0] data_in;
|
| 17 |
+
output reg signed[after_data_width-1:0] data_out;
|
| 18 |
+
|
| 19 |
+
wire signed [before_data_width-1:0] temp1_out;
|
| 20 |
+
wire signed [before_data_width-1:0] temp2_out;
|
| 21 |
+
|
| 22 |
+
assign temp1_out = data_in >>> shift;
|
| 23 |
+
assign temp2_out = data_in[shift-1] ? temp1_out + 1 : temp1_out;
|
| 24 |
+
|
| 25 |
+
wire under_min = temp2_out[before_data_width-1] & (~(& temp2_out[before_data_width-2:after_data_width-1]));
|
| 26 |
+
wire over_max = (~temp2_out[before_data_width-1]) & (|temp2_out[before_data_width-2:after_data_width-1]);
|
| 27 |
+
|
| 28 |
+
wire under_min_S0 = data_in[before_data_width-1] & (~(& data_in[before_data_width-2:after_data_width-1]));
|
| 29 |
+
wire over_max_S0 = (~data_in[before_data_width-1]) & (|data_in[before_data_width-2:after_data_width-1]);
|
| 30 |
+
|
| 31 |
+
always @(*) begin
|
| 32 |
+
if(shift == 0)
|
| 33 |
+
case ({under_min_S0,over_max_S0})
|
| 34 |
+
2'b10: data_out = {1'b1,{(after_data_width-1){1'b0}}};//data_out = 8'b1000_0000;
|
| 35 |
+
2'b01: data_out = {1'b0,{(after_data_width-1){1'b1}}};//8'b0111_1111;
|
| 36 |
+
default: data_out = data_in;
|
| 37 |
+
endcase
|
| 38 |
+
else begin
|
| 39 |
+
case ({under_min,over_max})
|
| 40 |
+
2'b10: data_out = {1'b1,{(after_data_width-1){1'b0}}};//data_out = 8'b1000_0000;
|
| 41 |
+
2'b01: data_out = {1'b0,{(after_data_width-1){1'b1}}};//8'b0111_1111;
|
| 42 |
+
default: data_out = temp2_out[after_data_width-1:0];
|
| 43 |
+
endcase
|
| 44 |
+
end
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
endmodule
|
| 48 |
+
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Defines.h
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef SRC_DEFINES_H_
|
| 2 |
+
#define SRC_DEFINES_H_
|
| 3 |
+
#include "xparameters.h"
|
| 4 |
+
#include "xaxidma_hw.h"
|
| 5 |
+
#define CACHE_LINE_SIZE 32
|
| 6 |
+
#define DATA_TYPE s8
|
| 7 |
+
#define MAX_LIMIT 127
|
| 8 |
+
#define MIN_LIMIT -128
|
| 9 |
+
|
| 10 |
+
#define MM_ADDR XPAR_MM_ULTRA_TOP_0_BASEADDR
|
| 11 |
+
#define SHIFT_ADDR MM_ADDR
|
| 12 |
+
#define FL_ADDR (MM_ADDR + 0x04)
|
| 13 |
+
#define FWBN_ADDR (MM_ADDR +0x08)
|
| 14 |
+
#define WWBN_ADDR (MM_ADDR +0x0c)
|
| 15 |
+
|
| 16 |
+
#define WEIGHT_DMA_ADDR XPAR_AXI_DMA_1_BASEADDR
|
| 17 |
+
#define WEIGHT_MM2S_DMACR (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_CR_OFFSET) //MM2S DMA Control register
|
| 18 |
+
#define WEIGHT_MM2S_DMASR (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SR_OFFSET) //MM2S DMA Status register
|
| 19 |
+
#define WEIGHT_MM2S_SA (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //MM2S Source Address
|
| 20 |
+
#define WEIGHT_MM2S_LENGTH (WEIGHT_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //MM2S Transfer Length (Bytes)
|
| 21 |
+
|
| 22 |
+
#define FEATURE_DMA_ADDR XPAR_AXI_DMA_0_BASEADDR
|
| 23 |
+
#define FEATURE_MM2S_DMACR (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_CR_OFFSET) //MM2S DMA Control register
|
| 24 |
+
#define FEATURE_MM2S_DMASR (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SR_OFFSET) //MM2S DMA Status register
|
| 25 |
+
#define FEATURE_MM2S_SA (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //MM2S Source Address
|
| 26 |
+
#define FEATURE_MM2S_LENGTH (FEATURE_DMA_ADDR + XAXIDMA_TX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //MM2S Transfer Length (Bytes)
|
| 27 |
+
|
| 28 |
+
#define RESULT_DMA_ADDR XPAR_AXI_DMA_2_BASEADDR
|
| 29 |
+
#define RESULT_S2MM_DMACR (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_CR_OFFSET) //S2MM DMA Control register
|
| 30 |
+
#define RESULT_S2MM_DMASR (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_SR_OFFSET) //S2MM DMA Status register
|
| 31 |
+
#define RESULT_S2MM_DA (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_SRCADDR_OFFSET) //S2MM Destination Address
|
| 32 |
+
#define RESULT_S2MM_LENGTH (RESULT_DMA_ADDR + XAXIDMA_RX_OFFSET + XAXIDMA_BUFFLEN_OFFSET) //S2MM Transfer Length (Bytes)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
//SA parameters
|
| 36 |
+
#define A_SIZE 16
|
| 37 |
+
#define W_block_num 4096
|
| 38 |
+
#define F_in_block_num 4096
|
| 39 |
+
#define F_out_Block_num 4096
|
| 40 |
+
#define F_length_width 10
|
| 41 |
+
#define F_width_block_num_width 6
|
| 42 |
+
#define W_width_block_num_width 6
|
| 43 |
+
#define shift_width 5
|
| 44 |
+
|
| 45 |
+
//matrix size limits
|
| 46 |
+
#define F_IN_MATRIX_SIZE_MAX (F_in_block_num * A_SIZE)
|
| 47 |
+
#define W_MATRIX_SIZE_MAX (W_block_num * A_SIZE)
|
| 48 |
+
#define F_OUT_MATRIX_SIZE_MAX (F_out_Block_num * A_SIZE)
|
| 49 |
+
#define F_LENGTH_MAX (2 ** F_length_width)
|
| 50 |
+
#define F_WIDTH_MAX ((2 ** F_width_block_num_width) * A_SIZE)
|
| 51 |
+
#define W_LENGTH_MAX F_WIDTH_MAX
|
| 52 |
+
#define W_WIDTH_MAX ((2 ** W_width_block_num_width) * A_SIZE)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
#endif /* SRC_DEFINES_H_ */
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Matrix.cpp
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "Matrix.h"
|
| 2 |
+
#include "xparameters.h"
|
| 3 |
+
#include "Defines.h"
|
| 4 |
+
#include <stdio.h>
|
| 5 |
+
#include "xil_io.h"
|
| 6 |
+
#include "xtime_l.h"
|
| 7 |
+
#include "xil_cache.h"
|
| 8 |
+
#include <string.h>
|
| 9 |
+
|
| 10 |
+
Matrix::Matrix(int rows, int cols) {
|
| 11 |
+
this->rows = rows;
|
| 12 |
+
this->cols= cols;
|
| 13 |
+
this->real_cols = (cols / A_SIZE + (cols % A_SIZE != 0 ? 1 : 0)) * A_SIZE;
|
| 14 |
+
this->real_rows = (rows / A_SIZE + (rows % A_SIZE != 0 ? 1 : 0)) * A_SIZE;
|
| 15 |
+
this->real_size = real_cols * real_rows;
|
| 16 |
+
this->base_addr = new DATA_TYPE[real_rows * real_cols](); //initialize to 0
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
Matrix::~Matrix() {
|
| 20 |
+
delete[] base_addr;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
int Matrix::get_real_cols() const{
|
| 24 |
+
return this->real_cols;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
int Matrix::get_real_rows() const{
|
| 28 |
+
return this->real_rows;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
int Matrix::get_real_size() const{
|
| 32 |
+
return this->real_size;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
DATA_TYPE * Matrix::get_base_addr() const{
|
| 36 |
+
return this->base_addr;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
void Matrix::set_value(int row, int col, DATA_TYPE value){
|
| 40 |
+
*(this->base_addr + row * this->real_cols + col)=value;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
DATA_TYPE Matrix::get_value(int row, int col){
|
| 44 |
+
return *(this->base_addr + row * this->real_cols + col);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
void Matrix::mat_print(){
|
| 48 |
+
for(int i = 0; i < this->rows; i++){
|
| 49 |
+
for(int j = 0; j < this->cols; j++){
|
| 50 |
+
printf("%d, ", this->get_value(i,j));
|
| 51 |
+
}
|
| 52 |
+
printf("\n");
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
bool Matrix_compare(const Matrix &A, const Matrix &B){
|
| 56 |
+
if(A.rows != B.rows){
|
| 57 |
+
printf("size mismatch\n");
|
| 58 |
+
return FALSE;
|
| 59 |
+
}
|
| 60 |
+
if(A.cols != B.cols){
|
| 61 |
+
printf("size mismatch\n");
|
| 62 |
+
return FALSE;
|
| 63 |
+
}
|
| 64 |
+
int result = memcmp(A.get_base_addr(), B.get_base_addr(), A.get_real_size());
|
| 65 |
+
return (bool)result;
|
| 66 |
+
}
|
| 67 |
+
void Matrix_mul_soft(Matrix &A, Matrix &B, Matrix &C, int R_shift){ //A*B=C
|
| 68 |
+
if(A.cols != B.rows){
|
| 69 |
+
printf("size mismatch\n");
|
| 70 |
+
return;
|
| 71 |
+
}
|
| 72 |
+
if(A.rows != C.rows || B.cols != C.cols){
|
| 73 |
+
printf("size mismatch\n");
|
| 74 |
+
return;
|
| 75 |
+
}
|
| 76 |
+
int temp;
|
| 77 |
+
int i;
|
| 78 |
+
int j;
|
| 79 |
+
int k;
|
| 80 |
+
|
| 81 |
+
for (i=0;i<C.rows;i++){
|
| 82 |
+
// printf("\n");
|
| 83 |
+
for(j=0;j<C.cols;j++){
|
| 84 |
+
temp=0;
|
| 85 |
+
for(k=0;k<A.cols;k++){
|
| 86 |
+
temp = temp + A.get_value(i,k)*B.get_value(k,j);
|
| 87 |
+
}
|
| 88 |
+
// printf("temp: %d\n",temp);
|
| 89 |
+
if(R_shift > 0){
|
| 90 |
+
temp = (temp+(1<<(R_shift-1))) >> R_shift; //rounding off
|
| 91 |
+
}
|
| 92 |
+
if (temp > MAX_LIMIT){
|
| 93 |
+
temp = MAX_LIMIT;
|
| 94 |
+
}
|
| 95 |
+
if (temp < MIN_LIMIT){
|
| 96 |
+
temp = MIN_LIMIT;
|
| 97 |
+
}
|
| 98 |
+
// printf("%d",temp);
|
| 99 |
+
C.set_value(i,j,temp);
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
void Matrix_mul_hard(Matrix &A, Matrix &B, Matrix &C, int R_shift){//A*B=C
|
| 105 |
+
if(A.cols != B.rows){
|
| 106 |
+
printf("size mismatch\n");
|
| 107 |
+
return;
|
| 108 |
+
}
|
| 109 |
+
if(A.rows != C.rows || B.cols != C.cols){
|
| 110 |
+
printf("size mismatch\n");
|
| 111 |
+
return;
|
| 112 |
+
}
|
| 113 |
+
u32 weight_buffer;
|
| 114 |
+
u32 feature_in_buffer;
|
| 115 |
+
u32 feature_out_buffer;
|
| 116 |
+
int weight_size;
|
| 117 |
+
int feature_in_size;
|
| 118 |
+
int feature_out_size;
|
| 119 |
+
|
| 120 |
+
weight_buffer = (u32)B.get_base_addr();
|
| 121 |
+
feature_in_buffer = (u32)A.get_base_addr();
|
| 122 |
+
feature_out_buffer = (u32)C.get_base_addr();
|
| 123 |
+
|
| 124 |
+
weight_size = B.get_real_size();
|
| 125 |
+
feature_in_size = A.get_real_size();
|
| 126 |
+
feature_out_size = C.get_real_size();
|
| 127 |
+
|
| 128 |
+
u32 shift = R_shift;
|
| 129 |
+
u32 in_rows_num = A.get_real_rows();
|
| 130 |
+
u32 F_width_block_num = A.get_real_cols() / A_SIZE;
|
| 131 |
+
u32 W_width_block_num = B.get_real_cols() / A_SIZE;
|
| 132 |
+
|
| 133 |
+
Xil_DCacheFlushRange(weight_buffer,weight_size);
|
| 134 |
+
Xil_DCacheFlushRange(feature_in_buffer,feature_in_size);
|
| 135 |
+
Xil_DCacheFlushRange(feature_out_buffer,feature_out_size);
|
| 136 |
+
|
| 137 |
+
//set control register value
|
| 138 |
+
Xil_Out32(SHIFT_ADDR,shift);
|
| 139 |
+
Xil_Out32(FL_ADDR,in_rows_num);
|
| 140 |
+
Xil_Out32(FWBN_ADDR,F_width_block_num);
|
| 141 |
+
Xil_Out32(WWBN_ADDR,W_width_block_num);
|
| 142 |
+
|
| 143 |
+
//first open receive channel
|
| 144 |
+
Xil_Out32(RESULT_S2MM_DMACR, 0x4);//reset
|
| 145 |
+
Xil_Out32(RESULT_S2MM_DA, feature_out_buffer); //set addr
|
| 146 |
+
Xil_Out32(RESULT_S2MM_DMACR, 0x1); //open channel
|
| 147 |
+
Xil_Out32(RESULT_S2MM_LENGTH,feature_out_size); //set length
|
| 148 |
+
|
| 149 |
+
Xil_Out32(WEIGHT_MM2S_DMACR, 0x4);
|
| 150 |
+
Xil_Out32(WEIGHT_MM2S_SA, weight_buffer);
|
| 151 |
+
Xil_Out32(WEIGHT_MM2S_DMACR, 0x1);
|
| 152 |
+
Xil_Out32(WEIGHT_MM2S_LENGTH,weight_size);
|
| 153 |
+
|
| 154 |
+
Xil_Out32(FEATURE_MM2S_DMACR, 0x4);
|
| 155 |
+
Xil_Out32(FEATURE_MM2S_SA, feature_in_buffer);
|
| 156 |
+
Xil_Out32(FEATURE_MM2S_DMACR, 0x1);
|
| 157 |
+
Xil_Out32(FEATURE_MM2S_LENGTH,feature_in_size);
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
while((Xil_In32(RESULT_S2MM_DMASR) & XAXIDMA_IDLE_MASK) ? FALSE : TRUE){
|
| 161 |
+
printf("*\n");
|
| 162 |
+
};
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Matrix.h
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef MY_MATRIX_H
|
| 2 |
+
#define MY_MATRIX_H
|
| 3 |
+
#include "xil_types.h"
|
| 4 |
+
#include "Defines.h"
|
| 5 |
+
|
| 6 |
+
class Matrix {
|
| 7 |
+
private:
|
| 8 |
+
int real_cols;
|
| 9 |
+
int real_rows;
|
| 10 |
+
int real_size;
|
| 11 |
+
DATA_TYPE * base_addr;
|
| 12 |
+
|
| 13 |
+
public:
|
| 14 |
+
int rows;
|
| 15 |
+
int cols;
|
| 16 |
+
// constructor
|
| 17 |
+
Matrix(int rows, int cols);
|
| 18 |
+
|
| 19 |
+
// destructor
|
| 20 |
+
~Matrix();
|
| 21 |
+
|
| 22 |
+
int get_real_cols() const;
|
| 23 |
+
int get_real_rows() const;
|
| 24 |
+
int get_real_size() const;
|
| 25 |
+
DATA_TYPE* get_base_addr() const;
|
| 26 |
+
void set_value(int row, int col, DATA_TYPE value);
|
| 27 |
+
DATA_TYPE get_value(int row, int col);
|
| 28 |
+
void mat_print();
|
| 29 |
+
|
| 30 |
+
};
|
| 31 |
+
void Matrix_mul_soft(Matrix &A, Matrix &B, Matrix &C, int R_shift); //A*B=C
|
| 32 |
+
void Matrix_mul_hard(Matrix &A, Matrix &B, Matrix &C, int R_shift); //A*B=C
|
| 33 |
+
bool Matrix_compare(const Matrix &A, const Matrix &B);
|
| 34 |
+
#endif
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/README.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Empty application. Add your own sources.
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/Xilinx.spec
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*startfile:
|
| 2 |
+
crti%O%s crtbegin%O%s
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/lscript.ld
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*******************************************************************/
|
| 2 |
+
/* */
|
| 3 |
+
/* This file is automatically generated by linker script generator.*/
|
| 4 |
+
/* */
|
| 5 |
+
/* Version: 2018.3 */
|
| 6 |
+
/* */
|
| 7 |
+
/* Copyright (c) 2010-2019 Xilinx, Inc. All rights reserved. */
|
| 8 |
+
/* */
|
| 9 |
+
/* Description : Cortex-A9 Linker Script */
|
| 10 |
+
/* */
|
| 11 |
+
/*******************************************************************/
|
| 12 |
+
|
| 13 |
+
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000;
|
| 14 |
+
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x1FFFFFFF;
|
| 15 |
+
|
| 16 |
+
_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024;
|
| 17 |
+
_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048;
|
| 18 |
+
_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024;
|
| 19 |
+
_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024;
|
| 20 |
+
_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024;
|
| 21 |
+
|
| 22 |
+
/* Define Memories in the system */
|
| 23 |
+
|
| 24 |
+
MEMORY
|
| 25 |
+
{
|
| 26 |
+
ps7_ddr_0 : ORIGIN = 0x100000, LENGTH = 0x3FF00000
|
| 27 |
+
ps7_ram_0 : ORIGIN = 0x0, LENGTH = 0x30000
|
| 28 |
+
ps7_ram_1 : ORIGIN = 0xFFFF0000, LENGTH = 0xFE00
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* Specify the default entry point to the program */
|
| 32 |
+
|
| 33 |
+
ENTRY(_vector_table)
|
| 34 |
+
|
| 35 |
+
/* Define the sections, and where they are mapped in memory */
|
| 36 |
+
|
| 37 |
+
SECTIONS
|
| 38 |
+
{
|
| 39 |
+
.text : {
|
| 40 |
+
KEEP (*(.vectors))
|
| 41 |
+
*(.boot)
|
| 42 |
+
*(.text)
|
| 43 |
+
*(.text.*)
|
| 44 |
+
*(.gnu.linkonce.t.*)
|
| 45 |
+
*(.plt)
|
| 46 |
+
*(.gnu_warning)
|
| 47 |
+
*(.gcc_execpt_table)
|
| 48 |
+
*(.glue_7)
|
| 49 |
+
*(.glue_7t)
|
| 50 |
+
*(.vfp11_veneer)
|
| 51 |
+
*(.ARM.extab)
|
| 52 |
+
*(.gnu.linkonce.armextab.*)
|
| 53 |
+
} > ps7_ddr_0
|
| 54 |
+
|
| 55 |
+
.init : {
|
| 56 |
+
KEEP (*(.init))
|
| 57 |
+
} > ps7_ddr_0
|
| 58 |
+
|
| 59 |
+
.fini : {
|
| 60 |
+
KEEP (*(.fini))
|
| 61 |
+
} > ps7_ddr_0
|
| 62 |
+
|
| 63 |
+
.rodata : {
|
| 64 |
+
__rodata_start = .;
|
| 65 |
+
*(.rodata)
|
| 66 |
+
*(.rodata.*)
|
| 67 |
+
*(.gnu.linkonce.r.*)
|
| 68 |
+
__rodata_end = .;
|
| 69 |
+
} > ps7_ddr_0
|
| 70 |
+
|
| 71 |
+
.rodata1 : {
|
| 72 |
+
__rodata1_start = .;
|
| 73 |
+
*(.rodata1)
|
| 74 |
+
*(.rodata1.*)
|
| 75 |
+
__rodata1_end = .;
|
| 76 |
+
} > ps7_ddr_0
|
| 77 |
+
|
| 78 |
+
.sdata2 : {
|
| 79 |
+
__sdata2_start = .;
|
| 80 |
+
*(.sdata2)
|
| 81 |
+
*(.sdata2.*)
|
| 82 |
+
*(.gnu.linkonce.s2.*)
|
| 83 |
+
__sdata2_end = .;
|
| 84 |
+
} > ps7_ddr_0
|
| 85 |
+
|
| 86 |
+
.sbss2 : {
|
| 87 |
+
__sbss2_start = .;
|
| 88 |
+
*(.sbss2)
|
| 89 |
+
*(.sbss2.*)
|
| 90 |
+
*(.gnu.linkonce.sb2.*)
|
| 91 |
+
__sbss2_end = .;
|
| 92 |
+
} > ps7_ddr_0
|
| 93 |
+
|
| 94 |
+
.data : {
|
| 95 |
+
__data_start = .;
|
| 96 |
+
*(.data)
|
| 97 |
+
*(.data.*)
|
| 98 |
+
*(.gnu.linkonce.d.*)
|
| 99 |
+
*(.jcr)
|
| 100 |
+
*(.got)
|
| 101 |
+
*(.got.plt)
|
| 102 |
+
__data_end = .;
|
| 103 |
+
} > ps7_ddr_0
|
| 104 |
+
|
| 105 |
+
.data1 : {
|
| 106 |
+
__data1_start = .;
|
| 107 |
+
*(.data1)
|
| 108 |
+
*(.data1.*)
|
| 109 |
+
__data1_end = .;
|
| 110 |
+
} > ps7_ddr_0
|
| 111 |
+
|
| 112 |
+
.got : {
|
| 113 |
+
*(.got)
|
| 114 |
+
} > ps7_ddr_0
|
| 115 |
+
|
| 116 |
+
.note.gnu.build-id : {
|
| 117 |
+
KEEP (*(.note.gnu.build-id))
|
| 118 |
+
} > ps7_ddr_0
|
| 119 |
+
|
| 120 |
+
.ctors : {
|
| 121 |
+
__CTOR_LIST__ = .;
|
| 122 |
+
___CTORS_LIST___ = .;
|
| 123 |
+
KEEP (*crtbegin.o(.ctors))
|
| 124 |
+
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
|
| 125 |
+
KEEP (*(SORT(.ctors.*)))
|
| 126 |
+
KEEP (*(.ctors))
|
| 127 |
+
__CTOR_END__ = .;
|
| 128 |
+
___CTORS_END___ = .;
|
| 129 |
+
} > ps7_ddr_0
|
| 130 |
+
|
| 131 |
+
.dtors : {
|
| 132 |
+
__DTOR_LIST__ = .;
|
| 133 |
+
___DTORS_LIST___ = .;
|
| 134 |
+
KEEP (*crtbegin.o(.dtors))
|
| 135 |
+
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
|
| 136 |
+
KEEP (*(SORT(.dtors.*)))
|
| 137 |
+
KEEP (*(.dtors))
|
| 138 |
+
__DTOR_END__ = .;
|
| 139 |
+
___DTORS_END___ = .;
|
| 140 |
+
} > ps7_ddr_0
|
| 141 |
+
|
| 142 |
+
.fixup : {
|
| 143 |
+
__fixup_start = .;
|
| 144 |
+
*(.fixup)
|
| 145 |
+
__fixup_end = .;
|
| 146 |
+
} > ps7_ddr_0
|
| 147 |
+
|
| 148 |
+
.eh_frame : {
|
| 149 |
+
*(.eh_frame)
|
| 150 |
+
} > ps7_ddr_0
|
| 151 |
+
|
| 152 |
+
.eh_framehdr : {
|
| 153 |
+
__eh_framehdr_start = .;
|
| 154 |
+
*(.eh_framehdr)
|
| 155 |
+
__eh_framehdr_end = .;
|
| 156 |
+
} > ps7_ddr_0
|
| 157 |
+
|
| 158 |
+
.gcc_except_table : {
|
| 159 |
+
*(.gcc_except_table)
|
| 160 |
+
} > ps7_ddr_0
|
| 161 |
+
|
| 162 |
+
.mmu_tbl (ALIGN(16384)) : {
|
| 163 |
+
__mmu_tbl_start = .;
|
| 164 |
+
*(.mmu_tbl)
|
| 165 |
+
__mmu_tbl_end = .;
|
| 166 |
+
} > ps7_ddr_0
|
| 167 |
+
|
| 168 |
+
.ARM.exidx : {
|
| 169 |
+
__exidx_start = .;
|
| 170 |
+
*(.ARM.exidx*)
|
| 171 |
+
*(.gnu.linkonce.armexidix.*.*)
|
| 172 |
+
__exidx_end = .;
|
| 173 |
+
} > ps7_ddr_0
|
| 174 |
+
|
| 175 |
+
.preinit_array : {
|
| 176 |
+
__preinit_array_start = .;
|
| 177 |
+
KEEP (*(SORT(.preinit_array.*)))
|
| 178 |
+
KEEP (*(.preinit_array))
|
| 179 |
+
__preinit_array_end = .;
|
| 180 |
+
} > ps7_ddr_0
|
| 181 |
+
|
| 182 |
+
.init_array : {
|
| 183 |
+
__init_array_start = .;
|
| 184 |
+
KEEP (*(SORT(.init_array.*)))
|
| 185 |
+
KEEP (*(.init_array))
|
| 186 |
+
__init_array_end = .;
|
| 187 |
+
} > ps7_ddr_0
|
| 188 |
+
|
| 189 |
+
.fini_array : {
|
| 190 |
+
__fini_array_start = .;
|
| 191 |
+
KEEP (*(SORT(.fini_array.*)))
|
| 192 |
+
KEEP (*(.fini_array))
|
| 193 |
+
__fini_array_end = .;
|
| 194 |
+
} > ps7_ddr_0
|
| 195 |
+
|
| 196 |
+
.ARM.attributes : {
|
| 197 |
+
__ARM.attributes_start = .;
|
| 198 |
+
*(.ARM.attributes)
|
| 199 |
+
__ARM.attributes_end = .;
|
| 200 |
+
} > ps7_ddr_0
|
| 201 |
+
|
| 202 |
+
.sdata : {
|
| 203 |
+
__sdata_start = .;
|
| 204 |
+
*(.sdata)
|
| 205 |
+
*(.sdata.*)
|
| 206 |
+
*(.gnu.linkonce.s.*)
|
| 207 |
+
__sdata_end = .;
|
| 208 |
+
} > ps7_ddr_0
|
| 209 |
+
|
| 210 |
+
.sbss (NOLOAD) : {
|
| 211 |
+
__sbss_start = .;
|
| 212 |
+
*(.sbss)
|
| 213 |
+
*(.sbss.*)
|
| 214 |
+
*(.gnu.linkonce.sb.*)
|
| 215 |
+
__sbss_end = .;
|
| 216 |
+
} > ps7_ddr_0
|
| 217 |
+
|
| 218 |
+
.tdata : {
|
| 219 |
+
__tdata_start = .;
|
| 220 |
+
*(.tdata)
|
| 221 |
+
*(.tdata.*)
|
| 222 |
+
*(.gnu.linkonce.td.*)
|
| 223 |
+
__tdata_end = .;
|
| 224 |
+
} > ps7_ddr_0
|
| 225 |
+
|
| 226 |
+
.tbss : {
|
| 227 |
+
__tbss_start = .;
|
| 228 |
+
*(.tbss)
|
| 229 |
+
*(.tbss.*)
|
| 230 |
+
*(.gnu.linkonce.tb.*)
|
| 231 |
+
__tbss_end = .;
|
| 232 |
+
} > ps7_ddr_0
|
| 233 |
+
|
| 234 |
+
.bss (NOLOAD) : {
|
| 235 |
+
__bss_start = .;
|
| 236 |
+
*(.bss)
|
| 237 |
+
*(.bss.*)
|
| 238 |
+
*(.gnu.linkonce.b.*)
|
| 239 |
+
*(COMMON)
|
| 240 |
+
__bss_end = .;
|
| 241 |
+
} > ps7_ddr_0
|
| 242 |
+
|
| 243 |
+
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
|
| 244 |
+
|
| 245 |
+
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
|
| 246 |
+
|
| 247 |
+
/* Generate Stack and Heap definitions */
|
| 248 |
+
|
| 249 |
+
.heap (NOLOAD) : {
|
| 250 |
+
. = ALIGN(16);
|
| 251 |
+
_heap = .;
|
| 252 |
+
HeapBase = .;
|
| 253 |
+
_heap_start = .;
|
| 254 |
+
. += _HEAP_SIZE;
|
| 255 |
+
_heap_end = .;
|
| 256 |
+
HeapLimit = .;
|
| 257 |
+
} > ps7_ddr_0
|
| 258 |
+
|
| 259 |
+
.stack (NOLOAD) : {
|
| 260 |
+
. = ALIGN(16);
|
| 261 |
+
_stack_end = .;
|
| 262 |
+
. += _STACK_SIZE;
|
| 263 |
+
. = ALIGN(16);
|
| 264 |
+
_stack = .;
|
| 265 |
+
__stack = _stack;
|
| 266 |
+
. = ALIGN(16);
|
| 267 |
+
_irq_stack_end = .;
|
| 268 |
+
. += _IRQ_STACK_SIZE;
|
| 269 |
+
. = ALIGN(16);
|
| 270 |
+
__irq_stack = .;
|
| 271 |
+
_supervisor_stack_end = .;
|
| 272 |
+
. += _SUPERVISOR_STACK_SIZE;
|
| 273 |
+
. = ALIGN(16);
|
| 274 |
+
__supervisor_stack = .;
|
| 275 |
+
_abort_stack_end = .;
|
| 276 |
+
. += _ABORT_STACK_SIZE;
|
| 277 |
+
. = ALIGN(16);
|
| 278 |
+
__abort_stack = .;
|
| 279 |
+
_fiq_stack_end = .;
|
| 280 |
+
. += _FIQ_STACK_SIZE;
|
| 281 |
+
. = ALIGN(16);
|
| 282 |
+
__fiq_stack = .;
|
| 283 |
+
_undef_stack_end = .;
|
| 284 |
+
. += _UNDEF_STACK_SIZE;
|
| 285 |
+
. = ALIGN(16);
|
| 286 |
+
__undef_stack = .;
|
| 287 |
+
} > ps7_ddr_0
|
| 288 |
+
|
| 289 |
+
_end = .;
|
| 290 |
+
}
|
| 291 |
+
|
Buck008_Transformer-Accelerator-Based-on-FPGA/vitis/main.cpp
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "Matrix.h"
|
| 2 |
+
#include "stdio.h"
|
| 3 |
+
#include <stdlib.h>
|
| 4 |
+
int main(){
|
| 5 |
+
u32 IN_ROWS_NUM = 121;
|
| 6 |
+
u32 IN_COLS_NUM = 311;
|
| 7 |
+
u32 OUT_COLS_NUM = 72;
|
| 8 |
+
|
| 9 |
+
int R_shift = 0;
|
| 10 |
+
|
| 11 |
+
u32 i;
|
| 12 |
+
u32 j;
|
| 13 |
+
Matrix A(IN_ROWS_NUM, IN_COLS_NUM);
|
| 14 |
+
Matrix B(IN_COLS_NUM, OUT_COLS_NUM);
|
| 15 |
+
Matrix C(IN_ROWS_NUM, OUT_COLS_NUM);
|
| 16 |
+
Matrix C_hard(IN_ROWS_NUM, OUT_COLS_NUM);
|
| 17 |
+
for(i=0;i<IN_ROWS_NUM;i++){
|
| 18 |
+
for(j=0;j<IN_COLS_NUM;j++){
|
| 19 |
+
DATA_TYPE value = rand()%256-128;//rand()%16-7;
|
| 20 |
+
// DATA_TYPE value = (i * A_SIZE +j + 128)%256 - 128;
|
| 21 |
+
// DATA_TYPE value = 1;
|
| 22 |
+
A.set_value(i,j,value);
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
for(i=0;i<IN_COLS_NUM;i++){
|
| 27 |
+
for(j=0;j<OUT_COLS_NUM;j++){
|
| 28 |
+
DATA_TYPE value = rand()%256-128;//rand()%16-7;
|
| 29 |
+
// DATA_TYPE value = (i * A_SIZE +j + 128)%256 - 128;
|
| 30 |
+
// DATA_TYPE value = 2;
|
| 31 |
+
B.set_value(i,j,value);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
Matrix_mul_soft(A, B, C, R_shift);
|
| 36 |
+
Matrix_mul_hard(A, B, C_hard, R_shift);
|
| 37 |
+
bool result = Matrix_compare(C, C_hard);
|
| 38 |
+
if(result){
|
| 39 |
+
printf("Right!");
|
| 40 |
+
}else{
|
| 41 |
+
printf("Wrong!");
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
return 0;
|
| 45 |
+
}
|