您的位置:首页 > 产品设计 > UI/UE

HDLBits刷题合集—10 Karnaugh Map to Circuit

2020-06-23 04:29 169 查看

HDLBits刷题合集—10 Karnaugh Map to Circuit

HDLBits-73 Kmap1

Problem Statement
实现下面卡诺图所描述的电路。


代码如下:

module top_module(
input a,
input b,
input c,
output out  );

//不要习惯性写成“+”,要用或(“|”)
assign out = a | b | c;

endmodule

HDLBits-74 Kmap2

Problem Statement
实现下面卡诺图所描述的电路。

在写代码之前,尝试简化卡诺图。试试“和之积”和“积之和”两种形式。我们不能检查是否得到了卡诺图的最简形式。但是我们可以检查简化的卡诺图是否相等,还可以检查是否可以将卡诺图转换成电路。


代码如下:

module top_module(
input a,
input b,
input c,
input d,
output out  );

//sum-of-products
assign out = ~b&~c | ~a&~d | b&c&d | a&c&d;
//product-of-sums
//assign out = (~b|c|~d) & (~a|~b|c) & (~a|~c|d) & (a|b|~c|~d);
endmodule

HDLBits-75 Kmap3

Problem Statement
实现下面卡诺图所描述的电路。


代码如下:

module top_module(
input a,
input b,
input c,
input d,
output out  );

//sum-of-products
assign out = a | ~b&c;
//product-of-sums
//assign out = (a|~b) & (a|c);
endmodule

HDLBits-76 Kmap4

Problem Statement
实现下面卡诺图所描述的电路。


代码如下:

module top_module(
input a,
input b,
input c,
input d,
output out  );

assign out = ~a&b&~c&~d | a&~b&~c&~d |~a&~b&~c&d |a&b&~c&d | ~a&b&c&d | a&~b&c&d | ~a&~b&c&~d |a&b&c&~d;

endmodule

HDLBits-77 Exams/ece241 2013 q2

Problem Statement
有四个输((a、b、c、d)的单输出数字系统在输入端出现2、7或15时生成逻辑1,在输入端出现0、1、4、5、6、9、10、13、14时生成逻辑0。输入端不会出现3、8、11和12。例如,7对应于a、b、c、d分别设置为0,1,1,1。

确认输出out_sop为最简的积之和形式,输出out_pos为最简的和之积形式。

代码如下:

module top_module (
input a,
input b,
input c,
input d,
output out_sop,
output out_pos	);

assign out_sop = c&d | ~a&~b&c;
assign out_pos = (a | c) & (c | ~d) & (~a | d) & (~b | d);

endmodule

HDLBits-78 Exams/m2014 q3

Problem Statement
实现下面卡诺图所描述的电路。其中d为无关项。


代码如下:

module top_module (
input [4:1] x,
output f );

//sum-of-products
//assign f = ~x[1]&x[3] | x[2]&x[4];
//product-of-sums
assign f = (x[3] | x[4]) & (x[2] | x[3]) &(~x[1] | x[4]);

endmodule

HDLBits-79 Exams/2012 q1g

Problem Statement
实现下面卡诺图所描述的电路。


代码如下:

module top_module (
input [4:1] x,
output f	);

//sum-of-products
//assign f = ~x[2]&~x[4] | ~x[1]&x[3] | x[2]&x[3]&x[4];
//product-of-sums
assign f = (x[3]|~x[4]) & (~x[2]|x[3]) & (~x[1]|x[2]|~x[4]) & (~x[1]|~x[2]|x[4]);
endmodule

HDLBits-80 Exams/ece241 2014 q3

Problem Statement
对于下面的卡诺图,使用一个4选1多路选择器和尽可能多的2选1多路选择器实现电路,但是尽量少用(这里应该指2选1多路选择器)。不允许使用任何其他逻辑门,必须使用a和b作为多路选择器输入,如下面的4选1多路选择器所示。


代码如下:

module top_module (
input c,
input d,
output [3:0] mux_in	);

assign mux_in = {c&d, ~d, 1'b0, c|d};

endmodule

Note
新手一枚,主要分享博客,记录学习过程,后期参考大佬代码或思想会一一列出。欢迎大家批评指正!

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: