云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 2015年EDA复习11

2015年EDA复习11

  • 62 次阅读
  • 3 次下载
  • 2026/4/24 4:23:07

图1

图2

module MUX21A(input s,input [1:0] a,input [1:0] b,output [1:0] y); reg [1:0] y_reg; always @( s or a or b ) case ( s )

0 : y_reg = a;//当选择信号为是0时,选择a0 1 : y_reg = b;//当选择我信号为1时,选择我a1 default :y_reg = 2'b00; endcase

assign y = y_reg; endmodule

module MUXK (a1, a2, a3, s0, s1, outy); input a1, a2, a3, s0, s1; output outy; wire outy; wire tmp;

mux21a u1 (.a(a2),.b(a3),.s(s0),.y(tmp)); mux21a u2 (.a (a1),.b (tmp),.s(s1),.y(outy)); endmodule

14、根据下列给定的仿真输入输出波形图,说明完成此功能的电路是什么功能电 路?并写出对应的Verilog HDL描述程序(图中clk,clr为输入,q,c为输出)。

module counter(clk,clr,q,c) input clk,clr;

output ret[1:0] q; output c;

always@(posedge clk or negedge clr) begin

if(~clr) q<=2’h0; else begin

if(2’h3==q) q<=2’h0; else q<=q+2’h1; end end

assign c=(2’h3==q) endmodule

15.Verilog HDL设计一个4位4输入最大数值检测电路。(10分)

//Verilog设计一个4位4输入最大数值检测电路

module Maximum_value_detection(Mostlarge,a,b,c,d);//4位4输入最大数值检测电路 output [3:0] Mostlarge; input [3:0] a,b,c,d; wire[3:0]sum1,sum2,sum3; assign sum1=(a>b)?a:b; assign sum2=(c>d)?c:d;

assign Mostlarge=(sum1>sum2)?sum1:sum2; endmodule

16. 用for循环语句设计一个7人投票表决器,若超过4 人赞成,则通过。

module voter7(pass,vote);

output pass; input[6:0] vote; reg[2:0] sum; integer i; reg pass; always @(vote)

begin sum=0;

for(i=0;i<=6;i=i+1) //for 语句 if(vote[i]) sum=sum+1;

if(sum[2]) pass=1; //若超过4 人赞成,则pass=1

else pass=0;

end endmodule

17.请用Verilog的case 语句设计一个真值表如下的3-8译码器。(10分)。

module decoder3_8 ( G1 ,Y ,G2 ,A ,G3 ); input G1, G2, G3; wire G1, G2, G3; input [2:0] A ; wire [2:0] A ; output [7:0] Y ; reg [7:0] Y ; reg s;

always @ ( A ,G1, G2, G3) begin

s <= G2 | G3 ; if (G1 == 0)

Y <= 8'b1111_1111; else if (s)

Y <= 8'b1111_1111;

搜索更多关于: 2015年EDA复习11 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

图1 图2 module MUX21A(input s,input [1:0] a,input [1:0] b,output [1:0] y); reg [1:0] y_reg; always @( s or a or b ) case ( s ) 0 : y_reg = a;//当选择信号为是0时,选择a0 1 : y_reg = b;//当选择我信号为1时,选择我a1 default :y_reg = 2'b00; endcase assign y = y_reg; endmodule module MUXK (a1, a2, a3, s0, s1, outy); input a1, a2, a3, s0, s1;

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com