HDLBits学习笔记(73~80)

HDLBits学习笔记(73~80)

学习阶段:有问题发873727286@qq.com大家一起讨论。

题目73 Kmap1

题干:Implement the circuit described by the Karnaugh map below.
在这里插入图片描述
题目大意:化简卡诺图实现图示电路。

题目分析:对卡诺图进行化简可得:
在这里插入图片描述
所以 out = a | b | c;

答案:

module top_module(
    input a,
    input b,
    input c,
    output out  ); 
	assign out = a | b | c ; 
endmodule

题目74 Kmap2

题目大意:与上题相同,均为卡诺图化简。
在这里插入图片描述
题目分析:对卡诺图进行化简,相同的颜色为同一框
在这里插入图片描述
可得 out = (~b & ~c)|( ~a & ~d)|(b & c & d)|(a & c & d);

答案:

module top_module(
    input a,
    input b,
    input c,
    input d,
    output out  ); 
	assign out = (~b & ~c)|( ~a & ~d)|(b & c & d)|(a & c & d);
endmodule

题目75 Kmap3

题目大意:与上题相同,均为卡诺图化简。
在这里插入图片描述
题目分析:与上题不同的是,该卡诺图中出现d,其值可以有自己随意设定来方便化简。
在这里插入图片描述
可得 out = a | (~b & c);

答案:

module top_module(
    input a,
    input b,
    input c,
    input d,
    output out  ); 
    assign out = a | (~b & c);
endmodule

题目76 Kmap4

题目大意:与上题相同,均为卡诺图化简。
在这里插入图片描述
题目分析:这种形式,通常是异或的标志。

答案:

module top_module(
    input a,
    input b,
    input c,
    input d,
    output out  ); 
    assign out = a^b^c^d;
endmodule

题目77 Exams/ece241 2013 q2

题干:A single-output digital system with four inputs (a,b,c,d) generates a logic-1 when 2, 7, or 15 appears on the inputs, and a logic-0 when 0, 1, 4, 5, 6, 9, 10, 13, or 14 appears. The input conditions for the numbers 3, 8, 11, and 12 never occur in this system. For example, 7 corresponds to a,b,c,d being set to 0,1,1,1, respectively.

Determine the output out_sop in minimum SOP form, and the output out_pos in minimum POS form.

题目大意:具有四个输入(A、b、c、d)的单输出数字系统在输入上出现2、7或15时生成逻辑 1,在出现0、1、4、5、6、9、10、13或14时生成逻辑 0。数字3、8、11和12的输入条件在此系统中从未出现。out_sop 用最小项输出,out_pos 用最大项输出。

题目分析:根据题干画出卡诺图,然后化简卡诺图。
在这里插入图片描述
用sop的形式化简可得:out = ( c & d )|( c & ~a & ~b );
在这里插入描述
用pos的形式化简可得(需要取反):out = ~(( ~c ) | ( b & ~d ) | (a & ~ d));
在这里插入图片描述
答案:

module top_module (
    input a,
    input b,
    input c,
    input d,
    output out_sop,
    output out_pos
); 
	assign out_sop = ( c & d )|( c & ~a & ~b );
    assign out_pos = ~(( ~c ) | ( b & ~d ) | (a & ~ d));
endmodule

题目78 Exams/m2014 q3

题目大意:与题75相同,均为卡诺图化简。
在这里插入图片描述
题目分析:卡诺图化简入下图所示,可得: out = (x3 & ~x1)|(x4 & x2);
在这里插入图片描述
答案:

module top_module (
    input [4:1] x, 
    output f );
    assign f = (x[3] & ~x[1])|(x[4] & x[2]);
endmodule

题目79 Exams/2012 q1g

题目大意:与题78相同,均为卡诺图化简。可以用POS和SOP两种形式实现。
在这里插入图片描述
题目分析:SOP下图所示,可得: out = ( ~ x[2] & ~ x[4]) | (~x[1] & x[3]) | (x[2] & x[3] & x[4]);
在这里插入图片描述
POS如下图所示,可得:
out = ~ ((x[2] & ~ x[3]) | (~x[3] & x[4]) | (x[1] & ~x[2] & x[4] ) | (x[1] & x[2] & ~x[4]));
在这里插入图片描述
答案:

module top_module (
    input [4:1] x,
    output f
); 
   assign f = (~x[2] & ~x[4]) | (~x[1] & x[3]) | (x[2] & x[3] & x[4]);
 //assign f = ~((x[2] & ~x[3]) | (~x[3] & x[4]) | (x[1] & ~x[2] & x[4] ) | (x[1] & x[2] & ~x[4]));    
endmodule

题目80 Exams/ece241 2014 q3

题干:For the following Karnaugh map, give the circuit implementation using one 4-to-1 multiplexer and as many 2-to-1 multiplexers as required, but using as few as possible. You are not allowed to use any other logic gate and you must use a and b as the multiplexer selector inputs, as shown on the 4-to-1 multiplexer below.

You are implementing just the portion labelled top_module, such that the entire circuit (including the 4-to-1 mux) implements the K-map.

题目大意:对于下面的卡诺图,使用一个4-to-1多路复用器和的2-to-1多路复用器的电路实现,但使用尽可能少的多路复用器。不允许使用任何其他逻辑门,必须使用a和b作为多路复用器选择器输入,如下面的4对1多路复用器所示。
但本题所要实现的部分并不是整个卡诺图,而是图2所示的电路。我们设计的电路和后面的4选1数据选择器共同构成卡诺图。
在这里插入图片描述图2
题目分析:此题可以拆开来看,当ab对应 00 时,当cd不全为0时,对应mux_in[0]输出1,其余为0。依此类推:
当ab 为 01时,无论cd为何值对应mux_in[1]输出0。当ab 为 10 时,只有cd全为1时,对应mux_in[2]输出1,当ab 为 11时,只有d不为0时,对应mux_in[1]输出0。依此逻辑写出对于cd的数据选择器。
利用三目运算符解决问题。

答案:

module top_module (
    input c,
    input d,
    output [3:0] mux_in
); 
    assign mux_in[0] = c ? 1 :(d ? 1 : 0);  //题目要求不能使用逻辑门
    assign mux_in[1] = 1'b0 ; 			    //恒为0
    assign mux_in[2] = d ? 0 : 1 ;         //这表示说~d时,结果才为1
    assign mux_in[3] = c ? (d ? 1 : 0) : 0;//cd都为真时,取值为1
endmodule
  • 6
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值