我計算的卡諾圖,但我的代碼是不正確的。我得到錯誤:「D ='1'的錯誤C ='0'B ='1'A ='0'預計O ='1',收到O ='0'」。
我在哪裏犯錯?
library IEEE;
use IEEE.std_logic_1164.all;
entity truth_table is port( A,B,C,D : in std_logic;
O : out std_logic);
end truth_table;
architecture behavior of truth_table isbegin
O <= (((not A) and C and D) or ((not D) and B and C) or (A and (not C) and D) or (A and C and (not B)));
end behavior;
您應該避免將代碼發佈爲鏈接圖像。代碼很好地顯示爲問題中的文本。 – Tome
如果您的代碼沒有複製真值表,那是因爲您在K-map中發生了錯誤。你沒有顯示這個,所以我們不能說出你做錯了什麼!就我個人而言,我發現這一個更容易處理反向輸出,然後在最後反轉整個方程。這給了4個產品總和而不是6個。 –
我的錯誤,反轉並不能減少產品的總和,但是如果這對於應用來說非常重要的話,它確實使用較少的門控輸入。 –