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