目录

题目1

原题复现

我的设计

题目2

原题复现

我的设计


题目1

这篇博文主要就是练习一下卡诺图的东西,然后选取几个经典的案例吧,如下:

原题复现

Implement the circuit described by the Karnaugh map below.

HDLBits 系列(12)All about Karnaugh Map_状态机

d的意思就是不关系,也即do not care的意思。

把有利于化简的d看做1,否则为0比较能够化简出最简的表达式:

f = a | ~bc;

我的设计

那么直接给出设计:

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

endmodule

 

HDLBits 系列(12)All about Karnaugh Map_状态机_02

题目2

原题复现

这个题目很简单,下面再给出一个稍微有点变了样子的卡诺图相关题目:
For the following Karnaugh map, give the circuit implementation using one 4-to-1 multiplexer and as many 2-to-1 multiplexers as required, but using as few as possible. You are not allowed to use any other logic gate and you must use a and b as the multiplexer selector inputs, as shown on the 4-to-1 multiplexer below.You are implementing just the portion labelled top_module, such that the entire circuit (including the 4-to-1 mux) implements the K-map.

HDLBits 系列(12)All about Karnaugh Map_状态机_03

简言之就是让设计上图中的top_module的电路,下面给出我的设计:

我的设计

module top_module (
    input c,
    input d,
    output [3:0] mux_in
); 
	assign mux_in[0] = ({c,d} == 2'b00) ? 0 : 1;
	assign mux_in[1] = 0;
	assign mux_in[3] = ({c,d} == 2'b11) ? 1 : 0;
	assign mux_in[2] = ({c,d} == 2'b00 | {c,d} == 2'b10) ? 1 : 0;


endmodule