版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、FPGA技术课程作业1. 分析test2.v程序,完成下列各题:1) 完成程序填空。2) 画出该代码综合后的电路图。module test2 (clk,reset,in1,in2,in3,out1,out2 );input clk,reset;input in1,in2, in3 ;output out1,out2;reg out1,out2; integer temp1,temp2;always (posedge clk or posedge reset) if(reset) begin temp1 = 0; temp2 = 0;end else begin temp1 = in1 & in
2、2;temp2 = in2 | in3;endalways (posedge clk) begin out1 = temp1 & temp2; out2 = temp1 in3; endendmodule 2、分析test1.v程序,完成下列题目:1) 完成程序填空。2) 根据图一所画出的输入激励波形,编写测试文件,仿真截图在0到900ns时间区间里输出端口的输出波形。module test1(data_1,data_2,data_3,data_out1,data_out2 );input data_1,data_2,data_3;output data_out1,data_out2; tas
3、k writeburst ;input a,b; integer c; c = a + b;endtaskreg data_out1,data_out2;always (data_1 or data_2 or 3 )begin write(data_1,data_2,data_out1); write(data_2,data_3,data_out2);endendmodule图一3. 根据下面的Verilog HDL代码,画出综合后的电路图。module test12(out,clk,in1,in2,in3,in4);input clk;input in1,in2,in3,in4;output
4、 out;reg out;reg temp1,temp2;always (posedge clk)begin temp1 = in1 & in2; temp2 = temp1 | in3; out = temp2 | in4;endendmodule4. 根据图1所示的原理图写出相应的Verilog HDL程序,其中DFF模块是上升沿触发的触发器,编写相应的测试程序,在ISE软件中完成仿真,对仿真波形图进行截图。图二程序:module my_moduke (clk,xin,out); input clk,xin; output out; reg out; reg temp; always(po
5、sedge clk) begin temp=xin|out; end always(posedge clk) begin out=temp; endendmodule激励文件:initialbeginclk=0;forever #30 clk=clk;endinitial begin/ Initialize Inputsxin = 0;forever #300 xin=xin;end仿真:5. 用Verilog HDL设计一个四分频电路,在ISE软件中完成仿真,对仿真波形图进行截图。1)输入信号:clk- 输入时钟 reset-同步复位信号,当reset=1b1时,系统输出置零,当reset=
6、1b0时,系统正常工作。 2)输出信号:clk_out -输出信号,其频率是输入时钟的四分之一module D_4div(clkin,reset_n,clkout);input clkin,reset_n; output clkout; wire in1,in2,clkin_2;reg out; reg clkout_1; assign in1=clkout_1;assign clkin_2=clkout_1; assign in2=out; assign clkout=out;always(posedge clkin) /由第一个D触发器构成的2分频程序;beginif(!reset_n)
7、begin out=0; clkout_1=0; end else clkout_1=in1;endalways(posedge clkin_2) /由第二个D触发器构成的2分频程序时钟输入为上面的输出;begin if(!reset_n) out=0; else out=in2;endendmodule6.设计一个带有异步复位控制端和时钟使能控制端的10进制计数器。module Counter(clk,clk_key,clr,ena,cout,sel,seg);inputclk,clk_key,clr,ena; outputcout; output7:0sel,seg;assignsel=8
8、hf0;wireclk_k;debounce_moduleU0(.CLK(clk),.RSTn(clr),.Pin_In(clk_key),.Pin_Out(clk_k);wire3:0sum;countU1(.clk(clk),.clk_k(clk_k),.clr(clr),.ena(ena),.cout(cout),.sum(sum);tubeU2(.clk(clk),.sum(sum),.seg(seg);endmodule计数模块modulecount(clk,clk_k,clr,ena,cout,sum);inputclk,clk_k,clr,ena; outputcout; out
9、put3:0sum;regcout; reg3:0sum; rega,b;always(posedgeclk)begin a=clk_k; b=a;endwirekey_posedge=(b&a)?1b1:1b0;always(posedgeclk)begin if(clr) begin cout=0; sum=0; end elseif(key_posedge&ena) begin if(sum4d9) begin sum=sum+1b1; cout=0; end else begin cout=1; sum=0; end end elsebegin cout=cout; sum=sum; endendendmodule数码管module tube(clk,sum,seg);input clk; input 3:0sum; output 7:0seg; reg 7:0seg;always(posedge clk)begincase(sum)4d0:seg=8hc0; 4d1:seg=8hf9; 4d2:seg=8ha4; 4d3:seg=8hb0;4d4:seg=8h99; 4d5:seg=8h92;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025湖北天宏检测科技集团有限公司招聘备考题库含答案详解
- 2026广西姆洛甲文化旅游投资有限公司招聘文旅策划主管2人备考题库及完整答案详解
- 2026新疆伊犁师范大学招聘编制外辅导员、思政教师、学报编辑52人备考题库及答案详解(新)
- 2026安徽省能源集团有限公司校园招聘备考题库及答案详解(易错题)
- 2025天津师范大学后勤管理处膳食服务中心劳务派遣工作人员招聘备考题库及答案详解1套
- 2026天津市北辰医院招聘事业单位人员1人备考题库及一套答案详解
- 2025秋季广西北海市中日友谊中学学期教师招聘备考题库及答案详解(考点梳理)
- 2025北京外企(江西)人力资源服务有限公司宜春分公司招聘备考题库完整参考答案详解
- 2026年甘肃省兰州天立学校后勤部招聘备考题库(19+人)完整参考答案详解
- 2026年马鞍山学院辅导员招聘5名备考题库及一套参考答案详解
- 信访工作系列知识培训课件
- 压力变送器拆校课件
- 2025年高考真题分类汇编必修二 《经济与社会》(全国)(原卷版)
- 支撑粱施工方案
- 2026届高考英语二轮复习:2025浙江1月卷读后续写 课件
- 2.3.2 中国第一大河-长江 课件 湘教版地理八年级上册
- 2025贵州省某大型国有企业招聘光伏、风电项目工作人员笔试备考题库及答案解析
- 导致老年人跌倒的用药风险研究
- GB 21256-2025粗钢生产主要工序单位产品能源消耗限额
- 经颅磁刺激在神经疾病治疗中的应用
- 装修工人出意外合同范本
评论
0/150
提交评论