Karnaugh Map to Circuit
3-variable
原題:3-variable
練習如何化簡K-map。
Verilog
module top_module(
input a,
input b,
input c,
output out );
assign out = a | b | c;
endmodule
4-variable(1)
練習如何化簡K-map,值得注意的是,K-map畫圈要重疊,才不會發生hazard。
Verilog
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = (~a & ~d) | (~b & ~c) | (a & ~b & d) | (a & c & d) | (b & c & d);
endmodule
4-variable(2)
練習如何化簡K-map,don't care的部分可以既看成0或看成1化簡,就看方便化簡。
Verilog
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = a | (~b & c);
endmodule
4-variable(3)
這裡的化簡重點是 XOR 結構,不適合硬套 SOP 或 POS。
Verilog
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = a ^ b ^ c ^ d;
endmodule
Minimum SOP and POS
練習如何畫K-map並化簡。
Verilog
module top_module (
input a,
input b,
input c,
input d,
output out_sop,
output out_pos
);
//K map
//cd\ab 00 01 11 10
// 00 0 0 d d
// 01 0 0 0 0
// 11 d 1 1 d
// 10 1 0 0 0
assign out_sop = (c & d) | (~a & ~b & c);
assign out_pos = c & (~a | b) & (~b | d);
endmodule
Karnaugh map(1)
練習如何畫K-map並化簡。
Verilog
module top_module (
input [4:1] x,
output f );
assign f = (~x[1] & x[3]) | (x[2] & x[4]);
endmodule
Karnaugh map(2)
練習如何畫K-map並化簡。
Verilog
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
K-map implemented with a multiplexer
這題用 multiplexer 實作 K-map 化簡後的結果。