




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、上机作业题目2:简述begin-end语句块和fork-join语句块的区别,并写出下面信号对应的程序代码begin-end语句块和fork-join语句块的区别:1、执行顺序:begin-end语句块按照语句顺序执行,fork-join语句块所有语句均在同一时刻执行;2、语句前面延迟时间的意义:begin-end语句块为相对于前一条语句执行结束的时间,fork-join语句块为相对于并行语句块启动的时间;3、起始时间:begin-end语句块为首句开始执行的时间,fork-join语句块为转入并行语句块的时间;4、结束时间:begin-end语句块为最后一条语句执行结束的时间,fork-jo
2、in语句块为执行时间最长的那条语句执行结束的时间;5、行为描述的意义:begin-end语句块为电路中的数据在时钟及控制信号的作用下,沿数据通道中各级寄存器之间的传送过程。fork-join语句块为电路上电后,各电路模块同时开始工作的过程。程序如下:module b(a,b);output a,b;reg a,b;initialbegin a=0; b=1; #10 a=1;fork b=0; #10 b=1; #20 a=0;join #10 b=0; #10 a=1; b=1;endendmodule题目3. 分别用阻塞和非阻塞赋值语句描述如下图所示移位寄存器的电路图。程序如下:modul
3、e block1(din,clk,out0,out1,out2,out3);input din,clk;output out0,out1,out2,out3;reg out0,out1,out2,out3;always(posedge clk)begin out3=out2;out2=out1;out1=out0;out0=din;endendmodulemodule non_block1(din,clk,out0,out1,out2,out3);input din,clk;output out0,out1,out2,out3;reg out0,out1,out2,out3;always(po
4、sedge clk)begin out0<=din;out1<=out0;out2<=out1;out3<=out2;endendmodule题目4:设计16位同步计数器要求:(1)分析16位同步计数器结构和电路特点; (2)用硬件描述语言进行设计; (3)编写测试仿真并进行仿真。程序如下:module b; reg clk; reg reset; wire 3:0count,result; always #5 clk=clk; initial begin clk=0;reset=0; #20 reset=1;end a U1(.clk(clk),.reset(rese
5、t),.result(result),.count(count);endmodule module a(count,clk,reset,result); output count,result; input clk,reset; reg 3:0count; always(posedge clk) begin if(!reset) count=4'b0000; else count=count+1; end assign result=count0|count1|count2|count3;endmodule题目5. 试用Verilog HDL门级描述方式描述如下图所示的电路。程序如下:
6、module diwuti(D0,D1,D2,D3,S1,S2,Z);output Z;input D0,D1,D2,D3,S1,S2;wire wi1,wi2,w3,w4,w5,w6;not U1(w1,S1), U2(w2,S2);and U3(w6,D3,S2), U4(w5,D2,S1,w2), U5(w4,D1,S1,w1), U6(w3,D0,w1,w2);or U7(Z,w3,w4,w5,w6);endmodule题目6. 试用查找真值表的方式实现真值表中的加法器,写出Verilog HDL代码:CinainbinsumCout00000001100101001101100101
7、01011100111111程序如下:module fulladder(SUM,C_OUT,A,B,C_IN);output SUM,C_OUT;input A,B,C_IN;reg SUM,C_OUT;always(A or B or C_IN)case(A,B,C_IN) 3'b000:SUM<=0; 3'b000:C_OUT<=0; 3'b001:SUM<=1; 3'b001:C_OUT<=0; 3'b010:SUM<=1; 3'b010:C_OUT<=0; 3'b011:SUM<=0; 3
8、'b011:C_OUT<=1; 3'b100:SUM<=1; 3'b100:C_OUT<=0; 3'b101:SUM<=0; 3'b101:C_OUT<=1; 3'b110:SUM<=0; 3'b110:C_OUT<=1; 3'b111:SUM<=1; 3'b111: C_OUT<=1; endcase endmodule题目7:设计16位同步加法器和乘法器要求:(1)分析16位同步加法器和乘法器结构和电路特 点; (2)用硬件描述语言进行设计; (3)编写测试仿真并进
9、行仿真。程序如下:module c; parameter adder16_width=16; reg adder16_width-1:0ain,bin; reg Cin; wire adder16_width-1:0sum; wire Cout; initial begin ain=10;bin=10;Cin=1; end initial begin #5 ain=16'b1111111111111111;#10 bin=1; end a U1(.ain(ain),.bin(bin),.Cin(Cin),.Cout(Cout),.sum(sum);endmodulemodule d;
10、parameter width=16; reg width-1:0ain,din; wire width*2-1:0mul; initial begin ain=2;din=2; end initial begin #10 ain=100;#15 din=100; end b U1(.ain(ain),.din(din),.mul(mul);endmodulemodule a(bin,ain,sum,Cout,Cin); parameter width=16; output width-1:0sum; output Cout; input width-1:0ain,bin; input Cin
11、; assign Cout,sum=ain+bin+Cin;endmodule module c(ain,din,mul); parameter width=16; input width-1:0ain,din; output width*2-1:0mul; assign mul=ain*din;endmodule题目8. 将下面的状态转移图用Verilog HDL描述。在图中,状态机的输入只与状态的跳转有关,与状态机的输出无关,因此该状态机为摩尔型状态机。下面为三段式描述方式程序如下:module b(clk,out,step,clr); output 2:0out; input step,
12、clk,clr; reg 2:0out; reg 1:0state,next_state; always (posedge clk) state<=next_state; always (state or clr) if(clr) next_state<=0; else case(state) 2'b00: case(step) 1'b0:begin next_state<=2'b00;out<=3'b001;end 1'b1:begin next_state<=2'b01; out<=3'b001;e
13、nd endcase 2'b01: begin out<=3'b010; next_state<=2'b11; end 2'b11: case(step) 1'b0:begin next_state<=2'b00;out<=3'b100;end 1'b1:begin next_state<=2'b10;out<=3'b100;end endcase 2'b10: case(step) 1'b0:begin next_state<=2'b10;out&
14、lt;=3'b111;end 1'b1:begin next_state<=2'b00;out<=3'b111;end endcase endcaseendmodulemodule a; reg clk,step,clr; wire 3:0out; always #5 clk=clk; Initialbegin clk=0; clr=1;step=1;end initial begin #5clr=0; #80 step=0; #100step=1;end b U1(clk,out,step,clr);endmodule题目9. 如下图所示电路,若其
15、延迟时间设定如表所示,试写Verilog HDL程序设计该电路。路径最小值(min)典型值(type)最大值(max)a_sa_y101214s_s0_sa_y151719s_sb_y111315b_sb_y101214程序如下:module a(a,s,b,y,s0); input a,b,s,s0; output y; assign y=(s&&b)|(s0&&a); specify (a=>y)=(10,12,14); (b=>y)=(10,12,14); (s=>y)=(11,13,15); (s0=>y)=(11,13,15);
16、 endspecifyendmodulemodule b(a,s,b,y); input s,a,s,b; output y; wire s0; not #(4)U1(s0,s); delay_door U2(a,s,b,y,s0);endmodule题目10.设计一个8位数字显示的简易频率计。要求:能够测试10Hz10MHz方波信号;电路输入的基准时钟为1Hz,要求测量值以8421BCD码形式输出;系统有复位键;采用分层次分模块的方法,用Verilog HDL进行设计。程序如下:module x; reg standard_clk; reg test_clk; wire 7:0out; re
17、g reset; initial begin reset=0; test_clk=0; standard_clk=0; end initial #15 reset=1; always #1 test_clk=test_clk; always #10 standard_clk=standard_clk; a U1(.reset(reset),.test_clk(test_clk),.standard_clk(standard_clk),.ratio_final(out);endmodulemodule a(reset,test_clk,standard_clk,ratio_final); inp
18、ut reset,test_clk,standard_clk; output 7:0ratio_final; wire mul_clk; wire reset_comp; wire 7:0ratio_start; and U0(reset_comp,reset,standard_clk); t U1(.ain(test_clk),.din(standard_clk),.mul(mul_clk); w U2(.clk(mul_clk),.count(ratio_start),.reset(reset_comp); c U3(.ratio_start(ratio_start),.ratio_fin
19、al(ratio_final);endmodule module w(clk,count,reset); input clk,reset; output count; parameter bit=8; reg bit-1:0count; always (posedge clk or negedge reset) if(!reset) count<=8'b00000000; else count<=count+1; endmodulemodule t(ain,din,mul); parameter width=1; input width-1:0ain,din; output
20、 width*2-1:0mul; assign mul=ain*din;endmodulemodule c(ratio_start,ratio_final); input 7:0ratio_start; output 7:0ratio_final; assign ratio_final=2*ratio_start;endmodule题目11. 用Verilog HDL设计一个4位LED显示器的动态扫描译码电路。要求:4个七段显示器共用一个译码驱动电路;显示的数码管清晰明亮,无闪烁现象发生。程序如下:module a(out,in); output out; input in; reg6:0out; wire3:0in; always(in) begin case(in) 4'd0:out=7'b1111110; 4'd1:out=7'b0110000; 4'd2:out=7'b1101101; 4'd3:out=7'b1111001; 4'd4:out=7'b0110011; 4'd5:out=7'b1011011
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 瓷具创意美术课件
- 水利水电工程前景探索试题及答案
- 水利水电工程设计创新试题及答案
- 经济学毕业设计答辩
- 冲刺抢分卷05 备战2025年高考考前仿真模拟卷冲刺抢分卷化学试题05 (辽宁、黑龙江、吉林、内蒙古专用) 含解析
- 中级经济师市场规制试题及答案
- 2025年市政工程资源配置试题及答案
- 有趣的棒棒糖世界探秘
- 2025年经济法概论核心知识试题及答案
- 畜牧养殖废物处理利用协议
- 计算机辅助制造(CAM)技术实践考核试卷
- 《广西高标准农田耕地质量评价工作 指导手册》
- 课件中华民族共同体概论课件专家版15第十五讲:新时代与中华民族共同体建设
- 机械伤害应急处理措施
- 新能源材料与器件基础知识单选题100道及答案解析
- 北师大版数学四年级下册期末考试试卷及答案
- 2024年黑龙江、吉林、辽宁高考地理试卷(含答案逐题解析)
- 市容环境卫生业务培训
- 建筑行业太阳能系统售后服务方案
- 蛇皮市场发展前景分析及供需格局研究预测报告
- 2022年内分泌医疗质量控制评价体系与考核标准
评论
0/150
提交评论