hls nn

hls

#include<ap_int.h>
#define N 2
#define w 16
void foo(ap_int<w> a[N][N],ap_int<w*2> y[N][N],ap_int<w> look_weight[N][N]);

#include"shift_demo.h"
void foo(ap_int<w> a[N][N],ap_int<w*2> y[N][N],ap_int<w> look_weight[N][N]){
	const ap_int<w> weight[N][N]={
#include "w.h"
	};
for(int i=0;i<N;i++){
	foo_label0:for(int j=0;j<N;j++){
		look_weight[i][j] = weight[i][j] ;
		y[i][j] = (a[i][j]*weight[i][j])>>2;
	}
}
}

11,
-22,
33,
-44

综合报告
tb

`timescale 1ns / 1ns
//
module tb2();
wire a_V_ce0,y_V_ce0,y_V_we0,look_weight_V_ce0,look_weight_V_we0;
wire ap_done,ap_idle,ap_ready;
wire [1:0] a_V_address0;
wire [1 : 0] y_V_address0;
wire [31 : 0] y_V_d0;
wire [1 : 0] look_weight_V_address0;
wire [15 : 0] look_weight_V_d0;

reg clk = 0;
always #1 clk = ~clk;

reg rst =  1;
reg ap_start = 0;

reg signed [15 : 0] a_V_q0=-2;
always @(posedge clk)begin
  if(a_V_q0 == 2)begin
    a_V_q0<=-2;
  end else begin
    a_V_q0<=a_V_q0+1;
  end
end
foo_0 your_instance_name (
  .a_V_ce0(a_V_ce0),                                // output wire a_V_ce0
  .y_V_ce0(y_V_ce0),                                // output wire y_V_ce0
  .y_V_we0(y_V_we0),                                // output wire y_V_we0
  .look_weight_V_ce0(look_weight_V_ce0),            // output wire look_weight_V_ce0
  .look_weight_V_we0(look_weight_V_we0),            // output wire look_weight_V_we0
  .ap_clk(clk),                                  // input wire ap_clk
  .ap_rst(rst),                                  // input wire ap_rst
  .ap_start(ap_start),                              // input wire ap_start
  .ap_done(ap_done),                                // output wire ap_done
  .ap_idle(ap_idle),                                // output wire ap_idle
  .ap_ready(ap_ready),                              // output wire ap_ready
  .a_V_address0(a_V_address0),                      // output wire [1 : 0] a_V_address0
  .a_V_q0(a_V_q0),                                  // input wire [15 : 0] a_V_q0
  .y_V_address0(y_V_address0),                      // output wire [1 : 0] y_V_address0
  .y_V_d0(y_V_d0),                                  // output wire [31 : 0] y_V_d0
  .look_weight_V_address0(look_weight_V_address0),  // output wire [1 : 0] look_weight_V_address0
  .look_weight_V_d0(look_weight_V_d0)              // output wire [15 : 0] look_weight_V_d0
);
initial begin
  #1
   rst <=  0;
  #2
  ap_start <= 1;
  #2
  ap_start <= 0;
end
endmodule

initial用<=
攻仿
就是这个样子
写到这
突然想吃烧麦
不写了

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值