vevilog 学习笔记 —— Karnaugh Map to Circuit

1. 3-variable

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

endmodule

 2. 4-variable

 卡诺图化简:

 

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

endmodule

 3.  4-variable

对于这个卡诺图,出现的d可以当作0,也可以当作1。

当做1化简比较简单,如下:

 

 

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

endmodule

 4. 4-variable

 

 

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

5. Minimum SOP and POS

 

 

 

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

 6. Karnaugh map

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

endmodule

 

 7. Karnaugh map

 

 

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] ;

endmodule

 7. K-map implemented with a multiplexer

 

module top_module (
	input c,
	input d,
	output [3:0] mux_in
);
	
	// After splitting the truth table into four columns,
	// the rest of this question involves implementing logic functions
	// using only multiplexers (no other gates).
	// I will use the conditional operator for each 2-to-1 mux: (s ? a : b)
	assign mux_in[0] = c ? 1 : d;          // 1 mux:   c|d
	assign mux_in[1] = 0;                  // No muxes:  0
	assign mux_in[2] = d ? 0 : 1;          // 1 mux:    ~d
	assign mux_in[3] = c ? d : 0;          // 1 mux:   c&d
	
endmodule

 

小结:

  卡诺图是逻辑函数的一种图形表示。卡诺图是一种平面方格图,每个小方格代表逻辑函数的一个最小项,故又称为最小项方格图。方格图中相邻两个方格的两组变量取值相比,只有一个变量的取值发生变化,按照这一原则得出的方格图(全部方格构成正方形或长方形)就称为卡诺方格图,简称卡诺图。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值