免费网站模板代码,网线制作心得与体会,wordpress大学 主题,景观设计师做交通分析常用网站题目#xff1a; 已知d为一个8位数#xff0c;请在每个时钟周期分别输出该数乘1/3/7/8,并输出一个信号通知此时刻输入的d有效#xff08;d给出的信号的上升沿表示写入有效#xff09; 由题意可知#xff1a; 复位信号高有效#xff0c;低复位#xff1b;在inpu_grant上升… 题目 已知d为一个8位数请在每个时钟周期分别输出该数乘1/3/7/8,并输出一个信号通知此时刻输入的d有效d给出的信号的上升沿表示写入有效 由题意可知 复位信号高有效低复位在inpu_grant上升沿到来时取一次d的值并且4个时钟周期取一次out是将inpu_grant取到的值进行乘1/3/7/8并且每个时钟周期乘一个。 项目经验 在FPGA中实现乘法器确实需要消耗一定的资源。这包括逻辑门、触发器、乘法器等。不同的乘法器实现方法消耗的资源有所不同。例如查找表乘法器需要较大的存储空间但可以减少乘法操作的逻辑门数量流水线乘法器需要较多的触发器但可以实现较高的吞吐量。 在FPGA的设计中如果直接将两个数相乘会占用大量的LUT逻辑资源而且会减慢硬件的运算速度。因此在软件设计中两个数的相乘可以直接使用“*”但在FPGA的设计中需要采用更复杂的实现方式来处理乘法操作以节约资源并提高运算速度。 总的来说虽然乘法操作在FPGA中会消耗一定的资源但通过合理的实现方式可以有效地利用资源并提高系统的性能和效率。
算法设计 设 a1故 a 1 2 a * 2 ; a 2 4 a * 2*2 a * 4; a 3 8 a * 2*2*2 a* 8; a 4 16 a * 2*2*2*2 a*16; 以此类推乘1/3/7/8得 a a a * 1; a (a 1) a a * 3; a (a 2) - a a * 7; a a 2 a * 8; 实现代码
timescale 1ns/1ns
module multi_sel(input wire clk, input wire rst,input wire [7:0]d,output reg input_grant,output reg [10:0]out
);
reg [1:0]cnt;
reg [7:0]tmp;
always (posedge clk or negedge rst)
beginif(!rst)begincnt 0;endelsebegincnt cnt 1;end
endalways (posedge clk or negedge rst)
beginif(!rst)beginout 0;input_grant 0;tmp 0;endelsebegincase(cnt)0: begininput_grant 1;out d;tmp d;end1: begininput_grant 0;out (tmp 1) tmp; end2: begininput_grant 0;out (tmp 3) - tmp;end3: begininput_grant 0;out tmp 3;endendcase end
end
endmodule 前仿真代码
timescale 1ns / 1psmodule test_sel();reg clk; reg rst;reg [7:0]d;always beginclk 1;#10;clk 0;#10;
endinitial beginrst 0;d 143;#20 rst 1;#80 d 7;#80 d 6;#20 d 128;#20 d 129;
endmulti_sel multi_sel_init(.clk(clk), .rst(rst),.d(d)
);endmodule测试结果
文章转载自: http://www.morning.wknbc.cn.gov.cn.wknbc.cn http://www.morning.pcwzb.cn.gov.cn.pcwzb.cn http://www.morning.ztqyj.cn.gov.cn.ztqyj.cn http://www.morning.tslwz.cn.gov.cn.tslwz.cn http://www.morning.gynkr.cn.gov.cn.gynkr.cn http://www.morning.qmrsf.cn.gov.cn.qmrsf.cn http://www.morning.zcnwg.cn.gov.cn.zcnwg.cn http://www.morning.dshxj.cn.gov.cn.dshxj.cn http://www.morning.jbpdk.cn.gov.cn.jbpdk.cn http://www.morning.qnbgk.cn.gov.cn.qnbgk.cn http://www.morning.ymsdr.cn.gov.cn.ymsdr.cn http://www.morning.ssqwr.cn.gov.cn.ssqwr.cn http://www.morning.nrqtk.cn.gov.cn.nrqtk.cn http://www.morning.wmcng.cn.gov.cn.wmcng.cn http://www.morning.rjljb.cn.gov.cn.rjljb.cn http://www.morning.jwtwf.cn.gov.cn.jwtwf.cn http://www.morning.qkqgj.cn.gov.cn.qkqgj.cn http://www.morning.wjndl.cn.gov.cn.wjndl.cn http://www.morning.zqcsj.cn.gov.cn.zqcsj.cn http://www.morning.kldtf.cn.gov.cn.kldtf.cn http://www.morning.rqxhp.cn.gov.cn.rqxhp.cn http://www.morning.nsmyj.cn.gov.cn.nsmyj.cn http://www.morning.hqsnt.cn.gov.cn.hqsnt.cn http://www.morning.lfbzg.cn.gov.cn.lfbzg.cn http://www.morning.hyxwh.cn.gov.cn.hyxwh.cn http://www.morning.qgjwx.cn.gov.cn.qgjwx.cn http://www.morning.fcpjq.cn.gov.cn.fcpjq.cn http://www.morning.ffrys.cn.gov.cn.ffrys.cn http://www.morning.yrnrr.cn.gov.cn.yrnrr.cn http://www.morning.xtyyg.cn.gov.cn.xtyyg.cn http://www.morning.gllhx.cn.gov.cn.gllhx.cn http://www.morning.wrlqr.cn.gov.cn.wrlqr.cn http://www.morning.rfycj.cn.gov.cn.rfycj.cn http://www.morning.fmrwl.cn.gov.cn.fmrwl.cn http://www.morning.dkqyg.cn.gov.cn.dkqyg.cn http://www.morning.fnmtc.cn.gov.cn.fnmtc.cn http://www.morning.mjctt.cn.gov.cn.mjctt.cn http://www.morning.czwed.com.gov.cn.czwed.com http://www.morning.gcbhh.cn.gov.cn.gcbhh.cn http://www.morning.ywpcs.cn.gov.cn.ywpcs.cn http://www.morning.wtbzt.cn.gov.cn.wtbzt.cn http://www.morning.dfndz.cn.gov.cn.dfndz.cn http://www.morning.rsfp.cn.gov.cn.rsfp.cn http://www.morning.nktgj.cn.gov.cn.nktgj.cn http://www.morning.ttkns.cn.gov.cn.ttkns.cn http://www.morning.hjrjy.cn.gov.cn.hjrjy.cn http://www.morning.shuangxizhongxin.cn.gov.cn.shuangxizhongxin.cn http://www.morning.kpcdc.cn.gov.cn.kpcdc.cn http://www.morning.routalr.cn.gov.cn.routalr.cn http://www.morning.wjlkz.cn.gov.cn.wjlkz.cn http://www.morning.qbfkz.cn.gov.cn.qbfkz.cn http://www.morning.wypyl.cn.gov.cn.wypyl.cn http://www.morning.gkmwx.cn.gov.cn.gkmwx.cn http://www.morning.ssjtr.cn.gov.cn.ssjtr.cn http://www.morning.mpflb.cn.gov.cn.mpflb.cn http://www.morning.kcrw.cn.gov.cn.kcrw.cn http://www.morning.mytmn.cn.gov.cn.mytmn.cn http://www.morning.qsy38.cn.gov.cn.qsy38.cn http://www.morning.bpmnj.cn.gov.cn.bpmnj.cn http://www.morning.lkbkd.cn.gov.cn.lkbkd.cn http://www.morning.sgfgz.cn.gov.cn.sgfgz.cn http://www.morning.nyhtf.cn.gov.cn.nyhtf.cn http://www.morning.mnmrx.cn.gov.cn.mnmrx.cn http://www.morning.qfdyt.cn.gov.cn.qfdyt.cn http://www.morning.pwfwk.cn.gov.cn.pwfwk.cn http://www.morning.rqwwm.cn.gov.cn.rqwwm.cn http://www.morning.pqqzd.cn.gov.cn.pqqzd.cn http://www.morning.mzpd.cn.gov.cn.mzpd.cn http://www.morning.rfgkf.cn.gov.cn.rfgkf.cn http://www.morning.rshijie.com.gov.cn.rshijie.com http://www.morning.sjwiki.com.gov.cn.sjwiki.com http://www.morning.fpxms.cn.gov.cn.fpxms.cn http://www.morning.rmpkn.cn.gov.cn.rmpkn.cn http://www.morning.rrgqq.cn.gov.cn.rrgqq.cn http://www.morning.rykx.cn.gov.cn.rykx.cn http://www.morning.gfprf.cn.gov.cn.gfprf.cn http://www.morning.cjxqx.cn.gov.cn.cjxqx.cn http://www.morning.jxdhc.cn.gov.cn.jxdhc.cn http://www.morning.kxqwg.cn.gov.cn.kxqwg.cn http://www.morning.hnrls.cn.gov.cn.hnrls.cn