initialisiert Ich verwende Xilinx. Derzeit arbeite ich an einem Projekt zur Entwicklung eines MIPS-Pipeline-Prozessors. Ich habe eine Komponentendatei namens Program_Counter.vhd gemacht. Wenn ich es mit einer Testbench simuliere, wird der Ausgang mit U initialisiert und danach ist es in Ordnung. Ich kann dieses Verhalten nicht verstehen. Jede Hilfe wird sehr geschätzt.Ausgang wird mit U-Logik in der Simulation in VHDL
Mein Program_Counter.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Program_Counter is
port (clk,reset,Last : in std_logic;
addressALU : in std_logic_vector(31 downto 0);
addressIR : out std_logic_vector(31 downto 0)
) ;
end entity ; -- Program_Counter
architecture Behavioral of Program_Counter is
signal PC : std_logic_vector(31 downto 0);
begin
process(clk)
begin
if rising_edge(clk) then
if reset = '1' then
PC <= (others => '0');
elsif Last ='1' then
null;
else
PC <= addressALU;
end if ;
end if ;
end process;
addressIR <= PC;
end Behavioral;
Hier ist der Prüfstand
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY PC_tb IS
END PC_tb;
ARCHITECTURE behavior OF PC_tb IS
COMPONENT Program_Counter
PORT(
clk : IN std_logic;
reset : IN std_logic;
Last : IN std_logic;
addressALU : IN std_logic_vector(31 downto 0);
addressIR : OUT std_logic_vector(31 downto 0)
);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
signal reset : std_logic := '0';
signal Last : std_logic := '0';
signal addressALU : std_logic_vector(31 downto 0) := (others => '0');
--Outputs
signal addressIR : std_logic_vector(31 downto 0);
-- Clock period definitions
constant clk_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Program_Counter PORT MAP (
clk => clk,
reset => reset,
Last => Last,
addressALU => addressALU,
addressIR => addressIR
);
-- Clock process definitions
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
wait for 35 ns;
--reset <= '0';
for i in 1 to 10 loop
addressALU <= addressALU + "1";
wait for clk_period ;
end loop;
wait for clk_period*10;
wait;
end process;
END;
bitte die Wellenform nach der Simulation beziehen. Vielen Dank im Voraus.
Also ich sollte meine Uhr von asynchron auf asynchron ändern müssen oder gibt es eine andere Methode, um es zu vermeiden? –
Nein, mein Punkt ist, vermeiden Sie es nicht; umarme es als Feature. Es ist an sich kein Problem, dass Signale beim Start nicht definiert sind; In der Tat ist es nur so, dass echte Hardware normalerweise funktioniert, also sollte die Simulation sie widerspiegeln. Wenn Sie im Entwurf wohldefinierte Werte benötigen, fügen Sie ein Reset-Signal hinzu, das den Flip-Flop-Zustand entweder durch asynchronen oder synchronen Reset zurücksetzen kann. –
Danke, Sir, ich habe es behoben, indem ich das clk-Signal mit 1 anstelle von 0 gestartet habe. –