Skip to content

Commit

Permalink
no accu
Browse files Browse the repository at this point in the history
  • Loading branch information
yhx committed Jun 8, 2016
1 parent 432645b commit 0a6625f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
39 changes: 23 additions & 16 deletions RTL/ll_ccie/matrix_multiply_buf_pl.v
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,20 @@ module matrix_multiply_buf_pl #(ADDR_LMT = 20, MDATA = 14, CACHE_WIDTH = 512, DA
wire ready_mul;
wire ready_accu;

num_accu_pl #(
.CACHE_WIDTH (CACHE_WIDTH),
.DATA_WIDTH (DATA_WIDTH)
)
accuer (
.clk (clk),
.rst (rst),
.size_out ({12'd0, N}),
.inc (ready_mul),
.array (res_mul),
.res (res_accu),
.ready (ready_accu)
);
//TODO uncomment
//num_accu_pl #(
// .CACHE_WIDTH (CACHE_WIDTH),
// .DATA_WIDTH (DATA_WIDTH)
//)
//accuer (
// .clk (clk),
// .rst (rst),
// .size_out ({12'd0, N}),
// .inc (ready_mul),
// .array (res_mul),
// .res (res_accu),
// .ready (ready_accu)
//);

array_mul_pl #(
.CACHE_WIDTH (CACHE_WIDTH),
Expand Down Expand Up @@ -345,11 +346,17 @@ module matrix_multiply_buf_pl #(ADDR_LMT = 20, MDATA = 14, CACHE_WIDTH = 512, DA
//Write request
always@(posedge clk)
begin
if (run && !wr_req_almostfull && ready_accu)
//TODO uncomment
//if (run && !wr_req_almostfull && ready_accu)
if (run && !wr_req_almostfull && ready_mul)
begin
$display("Write %d@%d", res_accu, wr_idx + addr_wr_base);
//TODO uncomment
//$display("Write %d@%d", res_accu, wr_idx + addr_wr_base);
$display("Write %d@%d", res_mul, wr_idx + addr_wr_base);
r_wr_req_addr <= wr_idx + addr_wr_base;
r_wr_req_data <= { 480'd0, res_accu};
//TODO uncomment
//r_wr_req_data <= { 480'd0, res_accu};
r_wr_req_data <= { 480'd0, res_mul};
r_wr_req_en <= 1'b1;
r_wr_req_direct <= 1'b0;
r_wr_req_mdata <= 'd0;
Expand Down
Binary file modified SW/matrix_mul
Binary file not shown.
3 changes: 2 additions & 1 deletion SW/matrix_mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ int matrixMulApp::run()
int *ptr = (int*)pSource;
//INIT
FILE *f = NULL;
int M = 1, N = 4, P = 1;
int M = 4, N = 3, P = 2;
int M_ = ((M+15)>>4)<<4;
ptr[0] = M;
ptr[1] = N;
Expand Down Expand Up @@ -513,6 +513,7 @@ int matrixMulApp::run()
for(uint32_t k =0; k<M; k++) {
int res = 0;
for(uint32_t i = 0; i < N; i++) {
res = 0;
for (uint32_t j=0; j<16; j++) {
res += (ptr[16 + k*N*16 + i*16 + j] * ptr[16 + M*N*16 + l*N*16 + i*16 + j]);
}
Expand Down

0 comments on commit 0a6625f

Please sign in to comment.