Implement the circuit described by the Karnaugh map below.
Try to simplify the k-map before coding it. Try both product-of-sums and sum-of-products forms. We can't check whether you have the optimal simplification of the k-map. But we can check if your reduction is equivalent, and we can check whether you can translate a k-map into a circuit.
就是对上面的卡诺图进行化简,给出输出 out 的表达式
对于这个卡诺图,出现的d可以当作0,也可以当作1。
module top_module(
input a,
input b,
input c,
input d,
output out );
assign out = a | ( !b & c );
endmodule
这里有个点需要注意:我平时喜欢用~,这个地方取反用的是!,下面说一下区别:
“!”表示逻辑取反,“~”表示按位取反
当面对位宽为1时:两个操作符的作用相同。
当位宽不为1时:
“~”会将变量的各个位依次取反如:a[3:0] ={1,0,1,1} , ~a ={0,1,0,0};
“!”会将变量作为一个值去做处理,非0为1:a[3:0] ={1,0,1,1} ,a=11,!a=0。a[3:0] ={0,0,0,0} ,a=0,!a=1