




免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数字系统设计与Verilog HDL第七章答案(第6版)7.2module dflip(d,clk,q);input d,clk;output reg q;always (posedge clk)beginq=d;end endmodule /sturct design /*module dflip(d,clk,q,q_n);input d,clk;output q,q_n;/nand (out,input1,input2);/the struct of logic designwire g5,g6;nand G1 (q_n.g5,q) ;nand G2 (q,g6,q_n) ;nand G3 (g5,clk,g6);nand G4 (g6,clk,d) ;endmodule */module D_Test(in,out,clk);input clk;input in;output 7:0out;dflip u1(.d(in),.clk(clk),.q(out1);dflip u2(.d(out1),.clk(clk),.q(out2);dflip u3(.d(out2),.clk(clk),.q(out3);dflip u4(.d(out3),.clk(clk),.q(out4);dflip u5(.d(out4),.clk(clk),.q(out5);dflip u6(.d(out5),.clk(clk),.q(out6);dflip u7(.d(out6),.clk(clk),.q(out7);dflip u8(.d(out7),.clk(clk),.q(out0);endmodule7.3/*module JK_Model(clk,j,k,Q);input clk;input j,k;output Q;reg Q;always(posedge clk)Q=j&(Q)|(k)&Q;endmodule */module JK_Model(clk,j,k,Q,rs,set);input clk,j,k,set,rs;output Q;reg Q;always(posedge clk or negedge rs or negedge set)beginif(!rs)Q=1b0;else if(!set)Q=1b1;else case(j,k)2b00:Q=Q;2b01:Q=1b0;2b10:Q=1b1;2b11:Q=Q;default:Q=1bx;endcaseendendmodule7.4module Counter5(clk,reset,car,out);/car jup loadinput clk,reset;output car,out;reg2:0cnt;reg car;wire2:0out;assign out=cnt;always(posedge clk or negedge reset)beginif(!reset)begincnt=3b000;car=0;endelse begin if(cnt=3b100)/model=5begincar=3b001;/upcnt=3b000;endelse begin cnt=cnt+3b001;car=3b000;endendendendmodule7.5module Ser_to_Par(clk,rst,in,out); input clk,rst; input in; output3:0 out; /wire3:0 out; reg 3:0 shiftreg; always(posedge clk or negedge rst) if(!rst) shiftreg=0; else begin shiftreg=shiftreg3:1,in;/mix (shiftreg3,2,1),in end assign out=shiftreg;endmodule7.6module Par_to_Ser(clk,rst,in,out);input clk,rst;input3:0in;output out;reg out;reg1:0i;always(posedge clk)beginif(rst)begini=2d0;out=1d0;endelse if(i=3)begin out=ini;i=i+1;endendendmodule7.8module data(data_in,data_out);input 7:0 data_in;output 7:0 data_out;reg7:0 data_out;always (data_in)beginif(data_in7)data_out=(data_in)+1)|8h80;elsedata_out=data_in;endendmodule7.9module Light(clk,ledout,reset);input reset,clk;output7:0 ledout;integer i;reg7:0ledout;reg2:0count;reg4:0count2;reg clkflag;reg1:0in;always(posedge clk)beginif(!reset)count=0;else if(count=3)beginclkflag=0;count=count+1;endelse if(count =7)beginclkflag=1;count=0;endelsebeginclkflag=1;count=count+1;endendalways(posedge clk)beginif(!reset)count2=0;else if(count2=7)beginin=2b00;count2=count2+1;endelse if(count2=15)beginin=2b01;count2=count2+1;endelse if(count2=23)beginin=2b10;count2=count2+1;endelse if(count2=23)beginin=2b10;count2=0;endendalways(clkflag or count or in or reset)beginif(!reset)ledout=8h00;elsebegincase(in)2b00:if(clkflag) ledout=8hff; else ledout=8h00;2b01:case(count)h0:ledout=8h80;h1:ledout=8h40;h2:ledout=8h20;h3:ledout=8h10;h4:ledout=8h08;h5:ledout=8h04;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025昆明市官渡区北京八十学校招聘(18人)考前自测高频考点模拟试题及答案详解(考点梳理)
- 2025福建厦门大学学院水声通信课题组嵌入式工程师招聘1人考前自测高频考点模拟试题有完整答案详解
- 2025河南郑州市第九十九中学招聘公益性岗位工作人员21人模拟试卷参考答案详解
- 2025年深圳市烟草专卖局(公司)招聘(22人)模拟试卷及答案详解(必刷)
- 人员操作行为分析-洞察与解读
- 2025年马鞍山市消防救援局招聘政府专职消防员38人考前自测高频考点模拟试题及答案详解(典优)
- 2025北京协和医院麻醉科合同制科研助理招聘模拟试卷及1套参考答案详解
- 2025贵州医科大学第二附属医院第十三届贵州人才博览会引才47人考前自测高频考点模拟试题有答案详解
- 班组安全培训实施课件
- 2025黑龙江双鸭山市饶河县招募就业见习单位及招聘见习人员668人模拟试卷附答案详解(突破训练)
- 冷库建设工程施工进度计划及保证措施
- 建筑设计行业2024年财务挑战解析
- 慢性病防治健康教育知识讲座
- 中国石化加油站视觉形象(VI)标准手册-课件
- 小学数学新旧知识关联
- 退费账户确认书
- 国家开放大学《政治学原理》章节自检自测题参考答案
- 第9课 共同弘扬中华传统美德 《中华民族大团结》(初中 精讲课件)
- 小学五年级道德与法治(上册)月考试卷及答案(一套)
- 恒瑞医药简介课件
- GB/T 20671.4-2006非金属垫片材料分类体系及试验方法第4部分:垫片材料密封性试验方法
评论
0/150
提交评论