| |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
-> 嵌入式 -> NICE的Verilog代码 -> 正文阅读 |
|
[嵌入式]NICE的Verilog代码 |
一、端口说明
二、RISC-V的指令其中opcode有4个可自行扩展 ?NICE使用了custom3,如下
三、代码中的定义1、指令相关①定义opcode为指令的{6->0},rv32_func3为{14->12}, rv32_func7为{31->25}
②定义扩展模式custom3 = 7'h3b
③定义func3和func7相关
④定义三条自定义指令在custom3情况下与func3、func7的关系
具体的来说,三条指令如下?
|
lbuf_cnt_r???????????????? | 现在计数值 |
lbuf_cnt_nxt???????? | 下一个计数值 |
lbuf_cnt_clr???????? | 计数清零,使能 |
lbuf_cnt_incr???????????????? | 计数增加,使能 |
lbuf_cnt_ena | 计数,D触发器,使能 |
lbuf_cnt_last???????? | 计数到最后值 |
lbuf_icb_rsp_hsked | 状态机为lbuf,并且储存响应握手成功 |
nice_rsp_valid_lbuf | 状态机为lbuf,计数到最后值,E203发出储存响应信号 |
nice_icb_cmd_valid_lbuf | 状态机为lbuf,计数值小于最后值 |
1)已知assign nice_icb_rsp_hsked = nice_icb_rsp_valid & nice_icb_rsp_ready;并且nice_icb_rsp_ready is 1'b1 always,所以nice_icb_rsp_hsked = nice_icb_rsp_valid
所以lbuf_icb_rsp_hsked,当前状态为lbuf,储存响应握手
2)lbuf_icb_rsp_hsked_last,当前状态为lbuf,储存响应握手,计数为最后值
3)lbuf_cnt_last即计数到最后值,也就是lbuf_cnt_r为clonum2‘b10
4)已知assign nice_req_hsked = nice_req_valid & nice_req_ready;
所以lbuf_cnt_clr含义为当前指令为lbuf,命令请求握手
5)lbuf_cnt_incr为当前状态为lbuf,储存响应握手,计数值不是最后值
6)lbuf_cnt_ena,当前指令为lbuf,命令请求握手;或者当前状态lbuf,储存指令握手,计数值不是最后值
7)当前指令lbuf,命令请求握手,lbuf_cnt_nxt归零;当前状态lbuf,储存响应握手,计数值不是最后值,lbuf_cnt_nxt为lbuf_cnt_r+1
8)nice_rsp_valid_lbuf,当前状态为lbuf,计数值为最后值,E203发出储存响应信号
9)nice_icb_cmd_valid_lbuf,当前状态为lbuf,且现计数值小于最后值
assign lbuf_icb_rsp_hsked = state_is_lbuf & nice_icb_rsp_hsked;
assign lbuf_icb_rsp_hsked_last = lbuf_icb_rsp_hsked & lbuf_cnt_last;
assign lbuf_cnt_last = (lbuf_cnt_r == clonum);
assign lbuf_cnt_clr = custom3_lbuf & nice_req_hsked;
assign lbuf_cnt_incr = lbuf_icb_rsp_hsked & ~lbuf_cnt_last;
assign lbuf_cnt_ena = lbuf_cnt_clr | lbuf_cnt_incr;
assign lbuf_cnt_nxt = ({ROWBUF_IDX_W{lbuf_cnt_clr }} & {ROWBUF_IDX_W{1'b0}})
| ({ROWBUF_IDX_W{lbuf_cnt_incr}} & (lbuf_cnt_r + 1'b1) )
;
// nice_rsp_valid wait for nice_icb_rsp_valid in LBUF
assign nice_rsp_valid_lbuf = state_is_lbuf & lbuf_cnt_last & nice_icb_rsp_valid;
// nice_icb_cmd_valid sets when lbuf_cnt_r is not full in LBUF
assign nice_icb_cmd_valid_lbuf = (state_is_lbuf & (lbuf_cnt_r < clonum));
③D触发器构成时序计数器
时钟:nice_clk ; 复位信号:nice_rst_n ; 使能信号:lbuf_cnt_ena ;
输入数据lbuf_cnt_nxt ; 输出数据:lbuf_cnt_r
sirv_gnrl_dfflr #(ROWBUF_IDX_W) lbuf_cnt_dfflr
(lbuf_cnt_ena, lbuf_cnt_nxt, lbuf_cnt_r, nice_clk, nice_rst_n);
sbuf_cnt_r | 当前计数值 |
subf_cnt_nxt | 下个计数值 |
sbuf_cnt_clr | sbuf_icb_rsp_hsked_last |
sbuf_cnt_incr | sbuf_cnt增加,使能 |
sbuf_cnt_ena | D触发器,使能 |
sbuf_cnt_last | 当前计数值为最后值 |
sbuf_icb_cmd_hsked | 当前状态为sbuf,或(状态为IDLE且指令为sbuf),储存握手成功 |
sbuf_icb_rsp_hsked | 当前状态为sbuf,储存响应握手成功 |
nice_rsp_valid_sbuf | 状态机为sbuf,计数到最后值,E203发出储存响应信号 |
nice_icb_cmd_valid_sbuf | 状态为sbuf,sbuf_cmd_cnt_r小于等于最后值,sbuf_cnt不是最后值 |
nice_icb_cmd_hsked | 储存请求握手成功 |
1)sbuf_icb_cmd_hsked,当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功
2)sbuf_icb_rsp_hsked,当前状态sbuf,储存响应握手
3)sbuf_icb_rsp_hsked_last,当前状态sbuf,储存响应握手,计数值为最后值
4)sbuf_cnt_last,计数值为最后值
5)sbuf_cnt_clr,就是sbuf_icb_rsp_hsked_last,当前状态sbuf,储存响应握手,计数值为最后值
6)sbuf_cnt_incr,当前状态sbuf,储存响应握手,计数值不是最后值
7)sbuf_cnt_ena,当前状态sbuf,储存响应握手
8)sbuf_cnt_nxt,当前状态sbuf,储存响应握手,(计数值为最后值则为2'b00;否则为现在计数值+1)
9)nice_rsp_valid_sbuf,当前状态sbuf,计数值为最后值,E203发出储存响应信号
assign sbuf_icb_cmd_hsked = (state_is_sbuf | (state_is_idle & custom3_sbuf)) & nice_icb_cmd_hsked;
assign sbuf_icb_rsp_hsked = state_is_sbuf & nice_icb_rsp_hsked;
assign sbuf_icb_rsp_hsked_last = sbuf_icb_rsp_hsked & sbuf_cnt_last;
assign sbuf_cnt_last = (sbuf_cnt_r == clonum);
//assign sbuf_cnt_clr = custom3_sbuf & nice_req_hsked;
assign sbuf_cnt_clr = sbuf_icb_rsp_hsked_last;
assign sbuf_cnt_incr = sbuf_icb_rsp_hsked & ~sbuf_cnt_last;
assign sbuf_cnt_ena = sbuf_cnt_clr | sbuf_cnt_incr;
assign sbuf_cnt_nxt = ({ROWBUF_IDX_W{sbuf_cnt_clr }} & {ROWBUF_IDX_W{1'b0}})
| ({ROWBUF_IDX_W{sbuf_cnt_incr}} & (sbuf_cnt_r + 1'b1) )
;
// nice_rsp_valid wait for nice_icb_rsp_valid in SBUF
assign nice_rsp_valid_sbuf = state_is_sbuf & sbuf_cnt_last & nice_icb_rsp_valid;
sirv_gnrl_dfflr #(ROWBUF_IDX_W) sbuf_cnt_dfflr
(sbuf_cnt_ena, sbuf_cnt_nxt, sbuf_cnt_r, nice_clk, nice_rst_n);
sbuf_cmd_cnt_r | sbuf_cmd现计数值 |
sbuf_cmd_cnt_nxt | sbuf_cmd下个计数值 |
sbuf_cmd_cnt_clr | 当前状态sbuf,储存响应握手,sbuf计数值为最后值 |
sbuf_cmd_cnt_incr | 当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功,subf_cmd计数值不是最后值 |
sbuf_cmd_cnt_ena | (当前状态sbuf,储存响应握手,sbuf计数值为最后值)或(当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功,subf_cmd计数值不是最后值) |
sbuf_cmd_cnt_last | sbuf_cmd计数值为最后值 |
1)sbuf_cmd_cnt_last,sbuf_cmd计数值为最后值
2)sbuf_cmd_cnt_clr,当前状态sbuf,储存响应握手,sbuf计数值为最后值
3)sbuf_cmd_cnt_incr,当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功,subf_cmd计数值不是最后值
4)sbuf_cmd_cnt_ena,(当前状态sbuf,储存响应握手,sbuf计数值为最后值)或(当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功,subf_cmd计数值不是最后值)
5)sbuf_cmd_cnt_nxt,当前状态sbuf,储存响应握手,sbuf计数为最后值,为2'b00;当前状态为sbuf,或(idle状态指令为sbuf),储存请求握手成功,sbuf_cmd计数值不是最后值,为sbuf_cmd_cnt_r+1
6)nice_icb_cmd_valid_sbuf,当前状态sbuf,sbuf_cmd小于等于最后值,sbuf不等于最后值
assign sbuf_cmd_cnt_last = (sbuf_cmd_cnt_r == clonum);
assign sbuf_cmd_cnt_clr = sbuf_icb_rsp_hsked_last;
assign sbuf_cmd_cnt_incr = sbuf_icb_cmd_hsked & ~sbuf_cmd_cnt_last;
assign sbuf_cmd_cnt_ena = sbuf_cmd_cnt_clr | sbuf_cmd_cnt_incr;
assign sbuf_cmd_cnt_nxt = ({ROWBUF_IDX_W{sbuf_cmd_cnt_clr }} & {ROWBUF_IDX_W{1'b0}})
| ({ROWBUF_IDX_W{sbuf_cmd_cnt_incr}} & (sbuf_cmd_cnt_r + 1'b1) )
;
// nice_icb_cmd_valid sets when sbuf_cmd_cnt_r is not full in SBUF
assign nice_icb_cmd_valid_sbuf = (state_is_sbuf & (sbuf_cmd_cnt_r <= clonum) & (sbuf_cnt_r != clonum));
sirv_gnrl_dfflr #(ROWBUF_IDX_W) sbuf_cmd_cnt_dfflr
(sbuf_cmd_cnt_ena, sbuf_cmd_cnt_nxt, sbuf_cmd_cnt_r, nice_clk, nice_rst_n);
wire [ROWBUF_IDX_W-1:0] rowbuf_cnt_r;
wire [ROWBUF_IDX_W-1:0] rowbuf_cnt_nxt;
wire rowbuf_cnt_clr;
wire rowbuf_cnt_incr;
wire rowbuf_cnt_ena;
wire rowbuf_cnt_last;
wire rowbuf_icb_rsp_hsked;
wire rowbuf_rsp_hsked;
wire nice_rsp_valid_rowsum;
assign rowbuf_rsp_hsked = nice_rsp_valid_rowsum & nice_rsp_ready;
assign rowbuf_icb_rsp_hsked = state_is_rowsum & nice_icb_rsp_hsked;
assign rowbuf_cnt_last = (rowbuf_cnt_r == clonum);
assign rowbuf_cnt_clr = rowbuf_icb_rsp_hsked & rowbuf_cnt_last;
assign rowbuf_cnt_incr = rowbuf_icb_rsp_hsked & ~rowbuf_cnt_last;
assign rowbuf_cnt_ena = rowbuf_cnt_clr | rowbuf_cnt_incr;
assign rowbuf_cnt_nxt = ({ROWBUF_IDX_W{rowbuf_cnt_clr }} & {ROWBUF_IDX_W{1'b0}})
| ({ROWBUF_IDX_W{rowbuf_cnt_incr}} & (rowbuf_cnt_r + 1'b1))
;
sirv_gnrl_dfflr #(ROWBUF_IDX_W) rowbuf_cnt_dfflr
(rowbuf_cnt_ena, rowbuf_cnt_nxt, rowbuf_cnt_r, nice_clk, nice_rst_n);
wire rcv_data_buf_ena;
wire rcv_data_buf_set;
wire rcv_data_buf_clr;
wire rcv_data_buf_valid;
wire [`E203_XLEN-1:0] rcv_data_buf;
wire [ROWBUF_IDX_W-1:0] rcv_data_buf_idx;
wire [ROWBUF_IDX_W-1:0] rcv_data_buf_idx_nxt;
assign rcv_data_buf_set = rowbuf_icb_rsp_hsked;
assign rcv_data_buf_clr = rowbuf_rsp_hsked;
assign rcv_data_buf_ena = rcv_data_buf_clr | rcv_data_buf_set;
assign rcv_data_buf_idx_nxt = ({ROWBUF_IDX_W{rcv_data_buf_clr}} & {ROWBUF_IDX_W{1'b0}})
| ({ROWBUF_IDX_W{rcv_data_buf_set}} & rowbuf_cnt_r );
第一个是使能信号的一个时钟延迟
第二个是输入数据的缓冲
第三个是对rowbuf写入的序号
sirv_gnrl_dfflr #(1) rcv_data_buf_valid_dfflr
(1'b1, rcv_data_buf_ena, rcv_data_buf_valid, nice_clk, nice_rst_n);
sirv_gnrl_dfflr #(`E203_XLEN) rcv_data_buf_dfflr
(rcv_data_buf_ena, nice_icb_rsp_rdata, rcv_data_buf, nice_clk, nice_rst_n);
sirv_gnrl_dfflr #(ROWBUF_IDX_W) rowbuf_cnt_d_dfflr
(rcv_data_buf_ena, rcv_data_buf_idx_nxt, rcv_data_buf_idx, nice_clk, nice_rst_n);
wire [`E203_XLEN-1:0] rowsum_acc_r;
wire [`E203_XLEN-1:0] rowsum_acc_nxt;
wire [`E203_XLEN-1:0] rowsum_acc_adder;
wire rowsum_acc_ena;
wire rowsum_acc_set;
wire rowsum_acc_flg;
wire nice_icb_cmd_valid_rowsum;
wire [`E203_XLEN-1:0] rowsum_res;
2)rowsum_acc_flg,rcv_data_buf_idx非零,且上个周期的状态为rowsum时(储存响应握手或E203发出nice_rsp_ready信号)
assign rowsum_acc_set = rcv_data_buf_valid & (rcv_data_buf_idx == {ROWBUF_IDX_W{1'b0}});
assign rowsum_acc_flg = rcv_data_buf_valid & (rcv_data_buf_idx != {ROWBUF_IDX_W{1'b0}});
assign rowsum_acc_adder = rcv_data_buf + rowsum_acc_r;
assign rowsum_acc_ena = rowsum_acc_set | rowsum_acc_flg;
assign rowsum_acc_nxt = ({`E203_XLEN{rowsum_acc_set}} & rcv_data_buf)
| ({`E203_XLEN{rowsum_acc_flg}} & rowsum_acc_adder)
;
assign rowsum_done = state_is_rowsum & nice_rsp_hsked;
assign rowsum_res = rowsum_acc_r;
// rowsum finishes when the last acc data is added to rowsum_acc_r
assign nice_rsp_valid_rowsum = state_is_rowsum & (rcv_data_buf_idx == clonum) & ~rowsum_acc_flg;
// nice_icb_cmd_valid sets when rcv_data_buf_idx is not full in LBUF
assign nice_icb_cmd_valid_rowsum = state_is_rowsum & (rcv_data_buf_idx < clonum) & ~rowsum_acc_flg;
累加的时序操作
sirv_gnrl_dfflr #(`E203_XLEN) rowsum_acc_dfflr
(rowsum_acc_ena, rowsum_acc_nxt, rowsum_acc_r, nice_clk, nice_rst_n);
rowbuf是数据缓存,lbuf和rowsum会写入,sbuf会读出
rowbuf_r | 4个32位的数据 |
rowbuf_wdata | 4个32位的数据 |
rowbuf_we | 4位宽的数据 |
rowbuf_idx_mux | rowbuf的序号选择 |
rowbuf_wdata_mux | rowbuf的写入数据选择 |
rowbuf_wr_mux | rowbuf的写入信号选择 |
lbuf_dix | lbuf写入的序号 |
lbuf_wr | lbuf写入的使能 |
lbuf_wdata | lbuf写入的数据 |
rowsum_idx | rowsum写入的序号 |
rcv_data_buf_valid | rowsum写入的使能 |
rowsum_wdata | rowsum写入的数据 |
写入的选择
1)lbuf_idx,写入序号选择,为lbuf_cnt_r,即lbuf计数的时序输出,当前的计数值,从0到2
2)lbuf_wr,写入使能,为lbuf_icb_rsp_hsked,即当前状态为lbuf,储存响应握手
3)lbuf_wdata,写入数据,外部输入的从memory读取的数据
4)rowsum_dix,写入序号选择,为rcv_data_buf_idx,当前的计数值,从0到2
5)rowsum_wr,写入使能,为rcv_data_buf-valid,是rcv_data_buf_ena缓冲一个时钟
6)rowsum_wdata,写入数据,为rowbuf_r当前数据与rcv_data_buf的加和
7)rowbuf_idx_mux,写入序号选择,若lbuf_wr为高,则为luf_idx,若rowsum_wr为高,则为rowsum_dix
8)rowbuf_wr_mux,写入使能选择,lbuf_wr与rowsum_wr的或
9)rowbuf_wdat_mux,写入数据选择
// lbuf write to rowbuf
wire [ROWBUF_IDX_W-1:0] lbuf_idx = lbuf_cnt_r;
wire lbuf_wr = lbuf_icb_rsp_hsked;
wire [`E203_XLEN-1:0] lbuf_wdata = nice_icb_rsp_rdata;
// rowsum write to rowbuf(column accumulated data)
wire [ROWBUF_IDX_W-1:0] rowsum_idx = rcv_data_buf_idx;
wire rowsum_wr = rcv_data_buf_valid;
wire [`E203_XLEN-1:0] rowsum_wdata = rowbuf_r[rowsum_idx] + rcv_data_buf;
// rowbuf write mux
assign rowbuf_wdat_mux = ({`E203_XLEN{lbuf_wr }} & lbuf_wdata )
| ({`E203_XLEN{rowsum_wr}} & rowsum_wdata)
;
assign rowbuf_wr_mux = lbuf_wr | rowsum_wr;
assign rowbuf_idx_mux = ({ROWBUF_IDX_W{lbuf_wr }} & lbuf_idx )
| ({ROWBUF_IDX_W{rowsum_wr}} & rowsum_idx)
;
实例化4个32位的D触发器
1)rowbuf_we为使能信号,为rowbuf_wr_mux与一个表达式的与,i的低2位与rowbuf_idx_mux相等才可以
2)rowbuf_wdat为输入数据,使能时为rowbuf_wdat_mux
// rowbuf inst
genvar i;
generate
for (i=0; i<ROWBUF_DP; i=i+1) begin:gen_rowbuf
assign rowbuf_we[i] = (rowbuf_wr_mux & (rowbuf_idx_mux == i[ROWBUF_IDX_W-1:0]))
;
assign rowbuf_wdat[i] = ({`E203_XLEN{rowbuf_we[i]}} & rowbuf_wdat_mux )
;
sirv_gnrl_dfflr #(`E203_XLEN) rowbuf_dfflr (rowbuf_we[i], rowbuf_wdat[i], rowbuf_r[i], nice_clk, nice_rst_n);
end
endgenerate
nice_icb_cmd_hsked | 储存请求握手 |
lbuf_maddr_ena | lbuf,访问memory的使能 |
sbuf_maddr_ena | sbuf,访问memory的使能 |
rowsum_maddr_ena | rowsum,访问memory的使能 |
maddr_ena | 访问memory的使能 |
maddr_ena_dile | 访问memory的使能,且当前状态为idle |
maddr_acc_op1 | 操作数1 |
maddr_acc_op2 | 操作数2 |
maddr_acc_ena | 访问memory的使能 |
2)lbuf_maddr_ena,(当前状态为idle,命令为lbuf,并且储存请求握手)或(当前状态lbuf,储存请求握手)
3)sbuf_maddr_ena,(当前状态为idle,命令为sbuf,并且储存请求握手)或(当前状态sbuf,储存请求握手)
4)rowsum_maddr_ena,(当前状态为idle,命令为rowsum,并且储存请求握手)或(当前状态rowsum,储存请求握手)
5)maddr_ena,(当前状态为idle,命令有效,并且储存请求握手)或(当前状态非idle,储存请求握手)
6)maddr_ena_idle,当前状态为idle,命令为有效,并且储存请求握手
7)maddr_acc_op1,当前状态为idle,命令为有效,并且储存请求握手,为寄存器1值,否则为maddr_acc_r
8)maddr_acc_op2,32/8 = 4,所以每次要加4
9)maddr_acc_next,下一个地址,为当前地址+4
10)maddr_acc_ena,为(当前状态为idle,命令有效,并且储存请求握手)或(当前状态非idle,储存请求握手)
assign nice_icb_cmd_hsked = nice_icb_cmd_valid & nice_icb_cmd_ready;
// custom3_lbuf
//wire [`E203_XLEN-1:0] lbuf_maddr = state_is_idle ? nice_req_rs1 : maddr_acc_r ;
wire lbuf_maddr_ena = (state_is_idle & custom3_lbuf & nice_icb_cmd_hsked)
| (state_is_lbuf & nice_icb_cmd_hsked)
;
// custom3_sbuf
//wire [`E203_XLEN-1:0] sbuf_maddr = state_is_idle ? nice_req_rs1 : maddr_acc_r ;
wire sbuf_maddr_ena = (state_is_idle & custom3_sbuf & nice_icb_cmd_hsked)
| (state_is_sbuf & nice_icb_cmd_hsked)
;
// custom3_rowsum
//wire [`E203_XLEN-1:0] rowsum_maddr = state_is_idle ? nice_req_rs1 : maddr_acc_r ;
wire rowsum_maddr_ena = (state_is_idle & custom3_rowsum & nice_icb_cmd_hsked)
| (state_is_rowsum & nice_icb_cmd_hsked)
;
// maddr acc
//wire maddr_incr = lbuf_maddr_ena | sbuf_maddr_ena | rowsum_maddr_ena | rbuf_maddr_ena;
wire maddr_ena = lbuf_maddr_ena | sbuf_maddr_ena | rowsum_maddr_ena;
wire maddr_ena_idle = maddr_ena & state_is_idle;
wire [`E203_XLEN-1:0] maddr_acc_op1 = maddr_ena_idle ? nice_req_rs1 : maddr_acc_r; // not reused
wire [`E203_XLEN-1:0] maddr_acc_op2 = maddr_ena_idle ? `E203_XLEN'h4 : `E203_XLEN'h4;
wire [`E203_XLEN-1:0] maddr_acc_next = maddr_acc_op1 + maddr_acc_op2;
wire maddr_acc_ena = maddr_ena;
使能信号:maddr_acc_ena,输入数据:maddr_acc_next,输出:maddr_acc_r
sirv_gnrl_dfflr #(`E203_XLEN) maddr_acc_dfflr
(maddr_acc_ena, maddr_acc_next, maddr_acc_r, nice_clk, nice_rst_n);
1)nice_req_hsked,命令请求握手
2)nice_req_ready,nice发出的命令请求握手信号,当前状态是idle,且指令有效,则为nice_icb_cmd_ready,否则为1'b1
3)nice_rsp_hsked,命令响应握手
4)nice_icb_rsp_hsked,储存响应握手
5)nice_rsp_valid,(当前状态lbuf,lbuf计数值为最后值,E203发出储存响应信号)或(当前状态sbuf,sbuf计数值为最后值,E203发出储存响应信号)或(当前状态rowsum,rcv_data_buf_idx计数值为最后值,rowsum_acc_flg为低)或(rcv_data_buf_idx非零,且上个周期的状态为rowsum时(储存响应握手或E203发出nice_rsp_ready信号))
6)nice_rsp_rdat,当前状态为rowsum时为rowsum_res
7)nice_rsp_err,储存响应握手且在访问memory时出错
// Control cmd_req
assign nice_req_hsked = nice_req_valid & nice_req_ready;
assign nice_req_ready = state_is_idle & (custom_mem_op ? nice_icb_cmd_ready : 1'b1);
// Control cmd_rsp
assign nice_rsp_hsked = nice_rsp_valid & nice_rsp_ready;
assign nice_icb_rsp_hsked = nice_icb_rsp_valid & nice_icb_rsp_ready;
assign nice_rsp_valid = nice_rsp_valid_rowsum | nice_rsp_valid_sbuf | nice_rsp_valid_lbuf;
assign nice_rsp_rdat = {`E203_XLEN{state_is_rowsum}} & rowsum_res;
// memory access bus error
//assign nice_rsp_err_irq = (nice_icb_rsp_hsked & nice_icb_rsp_err)
// | (nice_req_hsked & illgel_instr)
// ;
assign nice_rsp_err = (nice_icb_rsp_hsked & nice_icb_rsp_err);
1)nice_icb_rsp_ready始终为1'b1
2)sbuf_idx为subf_cmd_cnt_r
3)nice_icb_cmd_valid,(当前状态为idle且E203发出nice_req_valid且指令有效)或(状态lbuf,lbuf计数值小于最后值)或(状态sbuf,sbuf_cmd小于等于最后值且sbuf计数值不是最后值)或(状态rowsum,rcv_data_buf计数值小于最后值,且(rcv_data_buf_idx非零,且上个周期的状态为rowsum时(储存响应握手或E203发出nice_rsp_ready信号))
4)nice_icb_cmd_addr,(状态idle且命令有效)为寄存器1,否则为maddr_acc_r
5)nice_icb_cmd_read,(状态idle且为lbuf或rowsumz指令,为1,为sbuf指令,为0),或者为sbuf状态为0,否则为1
6)nice_icb_cmd_wdata,(状态idle,sbuf指令)或subf状态,为rowbuf_r[sbuf_idx],否则为0
7)nice_icb_cmd_size,为2,代表4字节32位宽数据
8)nice_mem_holdup,为非idle状态,访问memory锁
// rsp always ready
assign nice_icb_rsp_ready = 1'b1;
wire [ROWBUF_IDX_W-1:0] sbuf_idx = sbuf_cmd_cnt_r;
assign nice_icb_cmd_valid = (state_is_idle & nice_req_valid & custom_mem_op)
| nice_icb_cmd_valid_lbuf
| nice_icb_cmd_valid_sbuf
| nice_icb_cmd_valid_rowsum
;
assign nice_icb_cmd_addr = (state_is_idle & custom_mem_op) ? nice_req_rs1 :
maddr_acc_r;
assign nice_icb_cmd_read = (state_is_idle & custom_mem_op) ? (custom3_lbuf | custom3_rowsum) :
state_is_sbuf ? 1'b0 :
1'b1;
assign nice_icb_cmd_wdata = (state_is_idle & custom3_sbuf) ? rowbuf_r[sbuf_idx] :
state_is_sbuf ? rowbuf_r[sbuf_idx] :
`E203_XLEN'b0;
//assign nice_icb_cmd_wmask = {`sirv_XLEN_MW{custom3_sbuf}} & 4'b1111;
assign nice_icb_cmd_size = 2'b10;
assign nice_mem_holdup = state_is_lbuf | state_is_sbuf | state_is_rowsum;
|
嵌入式 最新文章 |
基于高精度单片机开发红外测温仪方案 |
89C51单片机与DAC0832 |
基于51单片机宠物自动投料喂食器控制系统仿 |
《痞子衡嵌入式半月刊》 第 68 期 |
多思计组实验实验七 简单模型机实验 |
CSC7720 |
启明智显分享| ESP32学习笔记参考--PWM(脉冲 |
STM32初探 |
STM32 总结 |
【STM32】CubeMX例程四---定时器中断(附工 |
|
上一篇文章 下一篇文章 查看所有文章 |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 | -2024/11/26 4:27:42- |
|
网站联系: qq:121756557 email:121756557@qq.com IT数码 |