Kmap1
化簡卡諾圖即可,
module top_module( input a, input b, input c, output out ); assign out=b|c|a; endmodule
Kmap2

我是這樣化簡的,
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); endmodule
Kmap3
這里d代表的是無關項,要不要圈起來都可以,
module top_module( input a, input b, input c, input d, output out ); assign out=(~b&c)|(a&c)|(a&~d); endmodule
Kmap4
這道題一眼看過去根本沒辦法化簡,但是根據提示,改變一個輸入值總會使輸出反轉,所以可以推斷出a、b、c、d應該進行的是異或運算,
module top_module( input a, input b, input c, input d, output out ); assign out=a^b^c^d; endmodule
Exams/ece241 2013 q2

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); endmodule
Exams/m2014 q3
也是直接化簡就可以了,

module top_module ( input [4:1] x, output f ); assign f=(~x[1]&x[3])|(x[1]&x[2]&~x[3]); endmodule
Exams/2012 q1g
化簡的時候注意四個角,

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
Exams/ece241 2014 q3

這里要使用一個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[0],也就是說控制mux_in[0]就可以了,
module top_module ( input c, input d, output [3:0] mux_in ); assign mux_in[0]=(~c&~d)?1'b0:1'b1; assign mux_in[1]=1'b0; assign mux_in[2]=(~d)?1'b1:1'b0; assign mux_in[3]=(c&d)?1'b1:1'b0; endmodule
我這里貌似還是用了邏輯門,不符合要求,答案的運算式更加簡潔,可以參考一下,
module top_module ( input c, input d, output [3:0] 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[0] = c ? 1 : d; // 1 mux: c|d assign mux_in[1] = 0; // No muxes: 0 assign mux_in[2] = d ? 0 : 1; // 1 mux: ~d assign mux_in[3] = c ? d : 0; // 1 mux: c&d endmodule
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/522885.html
標籤:Verilog
上一篇:[python] Python制作自動填寫腳本,100%準確率
下一篇:java基礎-泛型與正則運算式
