|
|
|
|
|
|
|
|
|
|
|
|
|
|
task_start : in std_logic; |
|
|
task_start : in std_logic; |
|
|
task_state : out work.task.State; |
|
|
task_state : out work.task.State; |
|
|
|
|
|
|
|
|
signal_a_read : out std_logic; |
|
|
|
|
|
|
|
|
--beide read auf 1 setzen zum lesen, danach wieder auf 0 wenn man fertig gelesen hat |
|
|
|
|
|
signal_a_read : out std_logic; |
|
|
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 next_task_state : work.task.State; |
|
|
signal next_task_state : work.task.State; |
|
|
signal index : integer range 0 to work.task.STREAM_LEN; |
|
|
signal index : integer range 0 to work.task.STREAM_LEN; |
|
|
|
|
|
|
|
|
|
|
|
--hier noch einige Signale anlegen |
|
|
|
|
|
signal done_flag : std_logic; |
|
|
|
|
|
signal start_flag : std_logic; |
|
|
|
|
|
|
|
|
|
|
|
--Zustände für die Zustandsmaschine für die Berechnung |
|
|
|
|
|
type CalcState is ( |
|
|
|
|
|
CALC_IDLE, |
|
|
|
|
|
CALC_ADD, |
|
|
|
|
|
CALC_STORE_RESULT |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
--Signale für die Zustandsmaschine für die Berechnung |
|
|
|
|
|
signal current_calc_state : CalcState; |
|
|
|
|
|
signal next_calc_state : CalcState; |
|
|
|
|
|
|
|
|
|
|
|
signal ergebnis : ?; |
|
|
|
|
|
signal ergebnis_valid : std_logic; |
|
|
|
|
|
|
|
|
begin |
|
|
begin |
|
|
|
|
|
|
|
|
|
|
|
u_float_add : entity work.float_add |
|
|
|
|
|
port map( |
|
|
|
|
|
clk => clk, |
|
|
|
|
|
reset => reset, |
|
|
|
|
|
start => start_flag, |
|
|
|
|
|
done => done_flag, |
|
|
|
|
|
A => signal_a_readdata, |
|
|
|
|
|
B => signal_b_readdata, |
|
|
|
|
|
sum => signal_writedata |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
--task_state_transitions wird nicht geaendert |
|
|
|
|
|
--Übergangsschaltnetz der Zustandsmaschine zu Steuerung der Tasks |
|
|
task_state_transitions : process ( current_task_state, task_start, index ) is |
|
|
task_state_transitions : process ( current_task_state, task_start, index ) is |
|
|
begin |
|
|
begin |
|
|
next_task_state <= current_task_state; |
|
|
next_task_state <= current_task_state; |
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Zustandsspeicher und Ausgangsschaltnetz zu Berechnung |
|
|
sync : process ( clk, reset ) is |
|
|
sync : process ( clk, reset ) is |
|
|
begin |
|
|
begin |
|
|
|
|
|
-- Ablaufsteuerung ueberlegen |
|
|
if ( reset = '1' ) then |
|
|
if ( reset = '1' ) then |
|
|
current_task_state <= work.task.TASK_IDLE; |
|
|
current_task_state <= work.task.TASK_IDLE; |
|
|
index <= 0; |
|
|
index <= 0; |
|
|
|
|
|
--hier alle Signale zuruecksetzen/initialisieren |
|
|
|
|
|
start_flag <= '0'; |
|
|
|
|
|
done_flag <= '0'; |
|
|
|
|
|
|
|
|
elsif ( rising_edge( clk ) ) then |
|
|
elsif ( rising_edge( clk ) ) then |
|
|
current_task_state <= next_task_state; |
|
|
current_task_state <= next_task_state; |
|
|
case next_task_state is |
|
|
case next_task_state is |
|
|
|
|
|
|
|
|
index <= 0; |
|
|
index <= 0; |
|
|
signal_write <= '0'; |
|
|
signal_write <= '0'; |
|
|
when work.task.TASK_RUNNING => |
|
|
when work.task.TASK_RUNNING => |
|
|
|
|
|
--starten |
|
|
|
|
|
--wenn: start = 0 |
|
|
|
|
|
--A und B Signale anlegen |
|
|
|
|
|
--start Signal auf 1 setzen |
|
|
|
|
|
--done Signal auf 0 setzen |
|
|
|
|
|
if ( task_start = '0') then |
|
|
|
|
|
--do starten |
|
|
|
|
|
elsif ( task_start = '1' and done = '0' ) then |
|
|
|
|
|
--do warten |
|
|
|
|
|
elsif ( task_start = '1' and done = '1' ) then |
|
|
|
|
|
--do Ergebnis lesen |
|
|
|
|
|
end if; |
|
|
|
|
|
|
|
|
|
|
|
--warten |
|
|
|
|
|
--wenn: start = 1, done = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Ergebnis lesen |
|
|
|
|
|
--wenn: done = 1, start = 1 |
|
|
|
|
|
--wenn done kommt, wert aus sum lesen |
|
|
|
|
|
--start nach einem Takt auf 0 setzen? |
|
|
index <= index + 1; |
|
|
index <= index + 1; |
|
|
signal_write <= '1'; |
|
|
signal_write <= '1'; |
|
|
signal_writedata <= ( others => '0' ); |
|
|
signal_writedata <= ( others => '0' ); |
|
|
|
|
|
|
|
|
end case; |
|
|
end case; |
|
|
end if; |
|
|
end if; |
|
|
end process sync; |
|
|
end process sync; |
|
|
|
|
|
--● Sie müssen sich eine Ablaufsteuerung |
|
|
|
|
|
--überlegen mit, welcher Sie den IP-Core die von |
|
|
|
|
|
--den Datenquellen gelesenen Werte zuführen |
|
|
|
|
|
--und die berechneten Additionen in der |
|
|
|
|
|
--Datensenke speichern |
|
|
|
|
|
--● Timing Diagramm des IP-Cors beachten (start |
|
|
|
|
|
--und done Signale des IP-Cores) |
|
|
|
|
|
--● Die vom FIFO gelesenen Werte und auch das |
|
|
|
|
|
--Format in welchen die Werte im FIFO |
|
|
|
|
|
--gespeichert werden ist float (muss hier nichts |
|
|
|
|
|
--extra beachtet werden) |
|
|
|
|
|
--● Es wird eine Berechnung der Addition |
|
|
|
|
|
--durchgeführt und dann die nächste gestartet bis |
|
|
|
|
|
--alle 1024 Werte aus den FIFOs bearbeitet |
|
|
|
|
|
--wurden |
|
|
|
|
|
|
|
|
task_state <= current_task_state; |
|
|
task_state <= current_task_state; |
|
|
|
|
|
|