文章目录
Circuits:Karnaugh Map to Circuit
一、3-variable
本小节讲通过卡诺图化简得出表达式
本题化简完毕是
- RTL代码
module top_module(
input a,
input b,
input c,
output out );
assign out = ~(~a & ~b & ~c);
endmodule
- 仿真波形图
二、4-variable
卡诺图化简结果为
- RTL代码
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = ( ~a & ~b & ~c) | (a & ~b & ~c) | (~a & ~d) | (b & c & d) | (a & ~b & d);
endmodule
- 仿真波形图
三、4-variable
卡诺图化简为(要注意看外一行的数字,有陷阱)
- RTL代码
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = a | (~b & c);
endmodule
- 仿真波形图
四、4-variable
- RTL代码
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
- 仿真波形图
五、Minimum SOP and POS
SOP是以1为中心圈卡诺圈,POS是以0为中心圈卡诺圈,二者用的是同一张卡诺图。
- RTL代码
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 = c & (~b | d) & (~a | d);
endmodule
六、Karnaugh map
- RTL代码
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
- RTL代码
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
- RTL代码
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
- 仿真波形图