大号在练葵花宝典 发表于 2022-10-28 13:24:42

【HDLBits刷题日记】08 Karnaugh Map to Circuit

Kmap1

化简卡诺图即可。
module top_module(
    input a,
    input b,
    input c,
    output out);
    assign out=b|c|a;
endmoduleKmap2

https://img2022.cnblogs.com/blog/2365699/202210/2365699-20221028103203951-1918022443.png
我是这样化简的。
module top_module(
    input a,
    input b,
    input c,
    input d,
    output out);
    assign out=(~a&~d)|(~b&~c)|(a&~b&d)|(b&c&d);
endmoduleKmap3

这里d代表的是无关项,要不要圈起来都可以。
module top_module(
    input a,
    input b,
    input c,
    input d,
    output out);
    assign out=(~b&c)|(a&c)|(a&~d);
endmoduleKmap4

这道题一眼看过去根本没办法化简,但是根据提示,改变一个输入值总会使输出反转,所以可以推断出a、b、c、d应该进行的是异或运算。
module top_module(
    input a,
    input b,
    input c,
    input d,
    output out);
    assign out=a^b^c^d;
endmoduleExams/ece241 2013 q2

 https://img2022.cnblogs.com/blog/2365699/202210/2365699-20221028112156638-337691694.png
 
 
 sop形式直接写就可以了,pos形式则需要sop形式使用摩根定理取反两次进行变换。
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&(~a|d)&(~b|d);

endmoduleExams/m2014 q3

也是直接化简就可以了。
https://img2022.cnblogs.com/blog/2365699/202210/2365699-20221028114258947-1179446775.png
 
 
 
module top_module (
    input x,
    output f );
    assign f=(~x&x)|(x&x&~x);
endmoduleExams/2012 q1g

化简的时候注意四个角。
https://img2022.cnblogs.com/blog/2365699/202210/2365699-20221028114617571-10127320.png
 
 
 
module top_module (
    input x,
    output f
);
    assign f=(~x&~x)|(~x&x)|(x&x&x);
endmoduleExams/ece241 2014 q3

https://img2022.cnblogs.com/blog/2365699/202210/2365699-20221028121523159-1485111504.png
 
 
 
这里要使用一个4-to-1的数据选择器实现四输入的逻辑。
逻辑为:f=(~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为00时,选中mux_in,也就是说控制mux_in就可以了。
module top_module (
    input c,
    input d,
    output mux_in
);
    assign mux_in=(~c&~d)?1'b0:1'b1;
    assign mux_in=1'b0;
    assign mux_in=(~d)?1'b1:1'b0;
    assign mux_in=(c&d)?1'b1:1'b0;

endmodule我这里貌似还是用了逻辑门,不符合要求,答案的表达式更加简洁,可以参考一下。
module top_module (
    input c,
    input d,
    output 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 = c ? 1 : d;          // 1 mux:   c|d
    assign mux_in = 0;                  // No muxes:0
    assign mux_in = d ? 0 : 1;          // 1 mux:    ~d
    assign mux_in = c ? d : 0;          // 1 mux:   c&d
   
endmodule 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: 【HDLBits刷题日记】08 Karnaugh Map to Circuit