我想用VHDL設計一個32位二進制串行加法器,使用結構化描述。加法器應該使用一個完整的加法器和一個d-latch。我看到它的方式是:二進制串行加法器 - VHDL
全加器:
architecture Behavioral of FullAdder is
begin
s <= (x xor y) xor cin;
cout <= (x and y) or (y and cin) or (x and cin);
end Behavioral;
d-鎖:
architecture Behavioral of dLatch is
begin
state: process(clk)
begin
if(clk'event and clk = '1') then
q <= d;
end if;
end process;
end Behavioral;
串行加法:
add: process (clk)
variable count : integer range 0 to 31;
variable aux : STD_LOGIC;
variable aux2 : STD_LOGIC;
begin
if(clk'event and clk = '1') then
fa: FullAdder port map(x(count), y(count), aux, s(count), aux2);
dl: dLatch port map(clock, aux2, aux);
count := count + 1;
end if;
end process;
但是,它似乎並沒有工作。 另外,管道串行加法器最簡單的方法是什麼?
因爲您已經使用信號到端口的postional映射,所以在沒有實體聲明的情況下檢查有點困難。我建議使用命名的端口映射(pinname => signal_name)。你建立了一個模擬?如果不這樣做。如果你有,用它來向我們解釋「這似乎不起作用」的意思 - 你期望看到什麼?你究竟看到了什麼? –