HDLBits刷题笔记7:Circuits.Combinational Logic.Karnaugh Map to Circuit

Karnaugh Map to Circuit

3-variable

实现如下卡诺图,用sop和pos两种方式

在这里插入图片描述

化简:

在这里插入图片描述

module top_module(
    input a,
    input b,
    input c,
    output out  ); 
    // sop和pos相同
    assign out = a | b | c;
endmodule

4-variable

实现如下卡诺图,用sop和pos两种方式

在这里插入图片描述

化简:

在这里插入图片描述

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);
    // pos不常用,而且不好用
    // assign out = (~a | ~b | c) & (~b | c | ~d) & (~a | ~c | d) & (a | b | ~c | ~d);
endmodule

4-variable

实现如下卡诺图

在这里插入图片描述

化简:

在这里插入图片描述

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

4-variable

实现如下卡诺图

在这里插入图片描述

此卡诺图不管是sop还是pos都没法化简,但不难看出,输入有奇数个1时,输出为1,所以是异或

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

minimum SOP and POS

一个4输入电路,其输入为a,b,c,d,当输入为2、7、15时,输出1,当输入为0、1、4、5、6、9、10、13、14时,输出0,其他情况不考虑,当a,b,c,d为0001时,输入为1。

根据题意,画出卡诺图如下:

在这里插入图片描述

化简:

在这里插入图片描述

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);
    // pos偷懒
    assign out_pos = out_sop;
endmodule

Karnaugh map

实现如下卡诺图

在这里插入图片描述

化简:

在这里插入图片描述

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

Karnaugh map

实现如下卡诺图

在这里插入图片描述

化简:

在这里插入图片描述

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

K-map implemented with a multiplexer

实现如下电路中的top_module

在这里插入图片描述

module top_module (
    input c,
    input d,
    output [3:0] mux_in
); 
    assign mux_in[0] = c | d;
    assign mux_in[1] = 1'b0;
    assign mux_in[2] = ~d;
    assign mux_in[3] = c & d;
endmodule
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值