|
|
|
|
|
|
|
|
|
|
|
|
|
|
task_start : in std_logic; |
|
|
task_start : in std_logic; |
|
|
task_state : out work.task.State; |
|
|
task_state : out work.task.State; |
|
|
--beide read auf 1 setzen zum lesen, danach wieder auf 0 wenn man fertig gelesen hat |
|
|
|
|
|
signal_a_read : out std_logic; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signal_a_read : out std_logic; --signal_read wird als Bestätigung gesetzt, dass die Daten gelesen wurden, d.h. bei der nächsten rising edge werden die nächsten Daten angelegt. |
|
|
signal_a_readdata : in std_logic_vector( 31 downto 0 ); |
|
|
signal_a_readdata : in std_logic_vector( 31 downto 0 ); |
|
|
|
|
|
|
|
|
signal_b_read : out std_logic; |
|
|
signal_b_read : out std_logic; |
|
|
|
|
|
|
|
|
signal current_calc_state : CalcState; |
|
|
signal current_calc_state : CalcState; |
|
|
signal next_calc_state : CalcState; |
|
|
signal next_calc_state : CalcState; |
|
|
|
|
|
|
|
|
signal ergebnis : ?; |
|
|
|
|
|
|
|
|
signal ergebnis : signed( 31 downto 0); --das hier vielleicht zu std_logic_vector oder float |
|
|
signal ergebnis_valid : std_logic; |
|
|
signal ergebnis_valid : std_logic; |
|
|
|
|
|
|
|
|
begin |
|
|
begin |
|
|
|
|
|
|
|
|
u_float_add : entity work.float_add |
|
|
|
|
|
|
|
|
u_float_add : entity work.float_add --Das hier ist der IP Core !!! |
|
|
port map( |
|
|
port map( |
|
|
clk => clk, |
|
|
clk => clk, |
|
|
reset => reset, |
|
|
reset => reset, |
|
|
|
|
|
|
|
|
end case; |
|
|
end case; |
|
|
end process task_state_transitions; |
|
|
end process task_state_transitions; |
|
|
|
|
|
|
|
|
--Übergangsschaltnetz der Zustandsmaschine für die Berechnung |
|
|
|
|
|
calc_state_transitions : process ( all ) is |
|
|
|
|
|
begin |
|
|
|
|
|
next_calc_state <= current_calc_state; |
|
|
|
|
|
-- ... |
|
|
|
|
|
end process calc_state_transitions; |
|
|
|
|
|
|
|
|
|
|
|
-- Zustandsspeicher und Ausgangsschaltnetz zu der Steuerung der Tasks |
|
|
|
|
|
task_sync : process ( clk, reset ) is |
|
|
|
|
|
begin |
|
|
|
|
|
|
|
|
|
|
|
end process task_sync; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Übergangsschaltnetz der Zustandsmaschine für die Berechnung ###Fertig |
|
|
|
|
|
calc_state_transitions: process (all) is |
|
|
|
|
|
begin |
|
|
|
|
|
next_calc_state <= current_calc_state; |
|
|
|
|
|
case current_calc_state is |
|
|
|
|
|
when CALC_IDLE=> |
|
|
|
|
|
if (current_task_state= work.task.TASK_RUNNING) then |
|
|
|
|
|
next_calc_state <= CALC_ADD; |
|
|
|
|
|
end if; |
|
|
|
|
|
when CALC_ADD => |
|
|
|
|
|
if (done_flag = '1') then |
|
|
|
|
|
next_calc_state <= CALC_STORE_RESULT; |
|
|
|
|
|
end if; |
|
|
|
|
|
when CALC STORE RESULT => |
|
|
|
|
|
next_calc_state <= CALC_IDLE; |
|
|
|
|
|
end case; |
|
|
|
|
|
end process calc state transitions; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Zustandsspeicher und Ausgangsschaltnetz zu der Steuerung der Tasks |
|
|
|
|
|
task_sync : process (clk, reset) is |
|
|
|
|
|
begin |
|
|
|
|
|
if (reset = '1') then |
|
|
|
|
|
current_task_state <= work.task.TASK_IDLE; |
|
|
|
|
|
|
|
|
|
|
|
elsif (rising_edge( clk)) then |
|
|
|
|
|
current_task_state <= next_task_state; |
|
|
|
|
|
case next_task_state is |
|
|
|
|
|
when work.task. TASK IDLE => null; |
|
|
|
|
|
when work.task. TASK_RUNNING => null; |
|
|
|
|
|
when work.task. TASK_DONE => null; |
|
|
|
|
|
end case; |
|
|
|
|
|
end if; |
|
|
|
|
|
end process task_sync; |
|
|
|
|
|
|
|
|
|
|
|
--Zustandsspeicher und Ausgangsschaltnetz zu Berechnung |
|
|
|
|
|
sync : process (clk, reset) is |
|
|
|
|
|
begin |
|
|
|
|
|
if (reset = '1') then |
|
|
|
|
|
index <= 0; |
|
|
|
|
|
current_calc_state <= CALC_IDLE; |
|
|
|
|
|
ergebnis <= (others => '0'); |
|
|
|
|
|
ergebnis_valid <= '0'; |
|
|
|
|
|
signal_write <= '0'; |
|
|
|
|
|
signal_writedata <= (others => '0'); |
|
|
|
|
|
elsif (rising_edge( clk)) then |
|
|
|
|
|
current_calc_state <= next_calc_state; |
|
|
|
|
|
ergebnis_valid <= '0'; |
|
|
|
|
|
case next_calc_state is |
|
|
|
|
|
when CALC_IDLE => |
|
|
|
|
|
start_flag <= '0'; |
|
|
|
|
|
signal_read <= '0'; --Daten wurden noch nicht verwendet. |
|
|
|
|
|
signal_write <= '0'; |
|
|
|
|
|
when CALC_ADD => --hier Berechnung mit IP Core? |
|
|
|
|
|
start_flag <= '1'; |
|
|
|
|
|
when CALC_STORE_RESULT => |
|
|
|
|
|
start_flag <= '0'; |
|
|
|
|
|
index <= index + 1; |
|
|
|
|
|
signal_write <= '1'; |
|
|
|
|
|
--signal_writedata <= std_logic_vector( ergebnis ); --Ergebnis schreiben, ergebnis direkt aus IP Core anschliessen |
|
|
|
|
|
signal_read <= '1' --mitteilen, dass die Daten gelesen wurden und jetzt neue Daten angelegt werden sollen |
|
|
|
|
|
end case; |
|
|
|
|
|
end if; |
|
|
|
|
|
end process sync; |
|
|
|
|
|
task_state <= current_task_state; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--signal_read anlegen. im nächsten Takt kann gelesen werden. |
|
|
|
|
|
--Werte holen, addieren, wieder ablegen |
|
|
|
|
|
--running gibt start-signal an add-StateMachine |
|
|
|
|
|
--IP Core macht nur eine Rechnung |
|
|
|
|
|
--wenn done signal kommt -> summe lesen |
|
|
|
|
|
-- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Zustandsspeicher und Ausgangsschaltnetz zu Berechnung |
|
|
-- Zustandsspeicher und Ausgangsschaltnetz zu Berechnung |
|
|
|
|
|
|
|
|
--wenn: done = 1, start = 1 |
|
|
--wenn: done = 1, start = 1 |
|
|
--wenn done kommt, wert aus sum lesen |
|
|
--wenn done kommt, wert aus sum lesen |
|
|
--start nach einem Takt auf 0 setzen? |
|
|
--start nach einem Takt auf 0 setzen? |
|
|
index <= index + 1; |
|
|
|
|
|
signal_write <= '1'; |
|
|
|
|
|
signal_writedata <= ( others => '0' ); |
|
|
|
|
|
|
|
|
index <= index + 1; --inkrement nach erfolgreicher Berechnung. Abbruchbedingung index==1024 |
|
|
|
|
|
signal_write <= '1'; --hier wird in den Speicher geschrieben |
|
|
|
|
|
signal_writedata <= ( others => '0' ); --eigenes Ergebnis zuweisen |
|
|
when work.task.TASK_DONE => |
|
|
when work.task.TASK_DONE => |
|
|
index <= 0; |
|
|
index <= 0; |
|
|
signal_write <= '0'; |
|
|
signal_write <= '0'; |