0
我想模擬我的VHDL代碼。當q(0到0)和q1(0到0)有一些值時,似乎有差異,但是當我將它們分配給新向量時,它們具有不正確的值(在同一個週期中)see ModelSim simulation here。由於我的下一個狀態邏輯取決於這兩個位,所以這是不正確的。VHDL模擬結果的差異性
這裏,r和t被分配給q(0 downto 0)和q1(0降到0),如代碼所示。在這個例子中,當q [0]是1時,r應該取值1。但它出來是0.
我想知道什麼可以是這個問題的原因?
when S0 => state <= S0;
funct <= '0';
load_m <= '0';
load_a <= '0';
load_q <= '0';
load_q1 <= '0';
shift <= '0';
dc <= '0';
rst_counter <= '0';
rst_shifter <= '0';
done <= '0';
--q0 <= to_bit(q(0 downto 0));
--q11 <= to_bit(q1);
r <= q(0 downto 0);
t <= q1(0 downto 0);
if ((q(0 downto 0) = "1" and q1(0 downto 0) = "1") or (q(0 downto 0) = "0" and q1(0 downto 0) = "0")) then
next_state <= S4;
elsif (q(0 downto 0) = "0" and q1(0 downto 0) = "1") then
next_state <= S2;
elsif (q(0 downto 0) = "1" and q1(0 downto 0) = "0") then
next_state <= S1;
end if;
您的代碼示例不是[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。在VHDL中,查看所涉及的聲明,結構,完整流程和所有信號分配通常很有幫助。沒有足夠的信息來回答。是否有一些原因,你使用長度爲1而不是它的元素類型的數組類型? – user1155120