Compare commits

...
12 Commits
Author SHA1 Message Date
meyerko91320 8a916271e1 update 2026-11-19 11:43:03 +01:00
meyerko91320 86a615148a update 2026-11-19 11:41:36 +01:00
meyerko91320 8e74022cc6 update 2026-11-19 11:39:37 +01:00
meyerko91320 3656fa9f90 update 2026-11-19 11:35:26 +01:00
meyerko91320 b80e089211 update 2026-11-19 11:24:04 +01:00
meyerko91320 b992b5cdd2 update 2026-11-19 11:17:24 +01:00
meyerko91320 93f7eea2fe update 2026-11-19 10:47:26 +01:00
meyerko91320 5ec9d4c9b8 update 2026-11-19 10:27:52 +01:00
meyerko91320 a9fe0df1f2 update 2026-11-19 10:10:19 +01:00
meyerko91320 14ad651f01 Änderungen an add.c 2026-11-19 09:34:49 +01:00
meyerko91320 95b1b3d0ca test.txt entfernt 2026-11-19 08:44:07 +01:00
meyerko91320 67e19280dd Test Commit 2026-11-19 08:41:35 +01:00
4 changed files with 182 additions and 19 deletions

No files matched your search

+94 -13
View File
@@ -26,11 +26,43 @@ entity add is
end entity add; end entity add;
architecture rtl of add is architecture rtl of add is
component float_add is -- #
port ( -- #
A : in std_logic_vector( 31 downto 0 ); -- #
B : in std_logic_vector( 31 downto 0 ); -- #
clk : in std_logic; -- #
reset : in std_logic; -- #
start : in std_logic; -- #
done : out std_logic; -- #
sum : out std_logic_vector( 31 downto 0 ) -- #
); -- #
end component float_add; -- #
signal current_task_state : work.task.State; signal current_task_state : work.task.State;
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;
type AddState is ( ADD_IDLE, ADD_WAIT_DONE, ADD_WRITE, ADD_FINISH ); -- #
signal current_add_state : AddState; -- #
signal add_start : std_logic; -- #
signal add_done : std_logic; -- #
signal add_sum : std_logic_vector( 31 downto 0 ); -- #
begin begin
float_add_inst : float_add -- #
port map ( -- #
A => signal_a_readdata, -- #
B => signal_b_readdata, -- #
clk => clk, -- #
reset => reset, -- #
start => add_start, -- #
done => add_done, -- #
sum => add_sum -- #
); -- #
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;
@@ -54,24 +86,73 @@ begin
begin begin
if ( reset = '1' ) then if ( reset = '1' ) then
current_task_state <= work.task.TASK_IDLE; current_task_state <= work.task.TASK_IDLE;
index <= 0; current_add_state <= ADD_IDLE; -- #
index <= 0;
signal_a_read <= '0'; -- #
signal_b_read <= '0'; -- #
signal_write <= '0'; -- #
signal_writedata <= ( others => '0' ); -- #
add_start <= '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
when work.task.TASK_IDLE => signal_a_read <= '0'; -- #
index <= 0; signal_b_read <= '0'; -- #
signal_write <= '0'; signal_write <= '0'; -- #
when work.task.TASK_RUNNING =>
index <= index + 1; case current_task_state is -- #
signal_write <= '1'; when work.task.TASK_IDLE =>
signal_writedata <= ( others => '0' ); index <= 0;
when work.task.TASK_DONE => current_add_state <= ADD_IDLE; -- #
index <= 0; add_start <= '0'; -- #
signal_write <= '0'; signal_write <= '0';
when work.task.TASK_RUNNING =>
case current_add_state is -- #
when ADD_IDLE => -- #
add_start <= '1'; -- #
current_add_state <= ADD_WAIT_DONE; -- #
when ADD_WAIT_DONE => -- #
if ( add_done = '1' ) then -- #
add_start <= '0'; -- #
signal_write <= '1'; -- #
signal_writedata <= add_sum; -- #
signal_a_read <= '1'; -- #
signal_b_read <= '1'; -- #
current_add_state <= ADD_WRITE; -- #
end if; -- #
when ADD_WRITE => -- #
if ( index < work.task.STREAM_LEN - 2 ) then -- #
index <= index + 1; -- #
current_add_state <= ADD_IDLE; -- #
else -- #
current_add_state <= ADD_FINISH; -- #
end if; -- #
when ADD_FINISH => -- #
add_start <= '1'; -- #
if ( add_done = '1' ) then -- #
add_start <= '0'; -- #
signal_write <= '1'; -- #
signal_writedata <= add_sum; -- #
index <= work.task.STREAM_LEN - 1; -- #
end if; -- #
when others => -- #
current_add_state <= ADD_IDLE; -- #
end case; -- #
when work.task.TASK_DONE =>
index <= 0;
current_add_state <= ADD_IDLE; -- #
add_start <= '0'; -- #
signal_write <= '0';
end case; end case;
end if; end if;
end process sync; end process sync;
task_state <= current_task_state; task_state <= current_task_state;
end architecture rtl; end architecture rtl;
+22 -1
View File
@@ -4,7 +4,28 @@
int task_add_run( void * task ) { int task_add_run( void * task ) {
// TODO float_word a;
float_word b;
float_word c;
task_base_config * config = (task_base_config *) task;
for (uint32_t i= 0; i < DATA_CHANNEL_DEPTH; ++i)
{
data_channel_read(config->sources[0], &a.word);
data_channel_read(config->sources[1], &b.word);
c.value = a.value + b.value;
data_channel_write(config->sink, c.word);
}
return 0; return 0;
} }
+36 -3
View File
@@ -4,9 +4,42 @@
#include "system/float_word.h" #include "system/float_word.h"
int task_rand_run( void * task ) { int task_rand_run( void * task ) {
rand_config * config = (rand_config *) task;
uint32_t sink = config->base.sink;
data_channel_clear( sink );
// TODO // Startwert (Seed) als 32-Bit Bitmuster laden
float_word current;
current.value = config->seed;
uint32_t lfsr = current.word;
for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i ) {
// 1. Feedback-Bit berechnen (XOR der Taps an Bit 31, 21, 1 und 0)
uint32_t bit31 = (lfsr >> 31) & 1;
uint32_t bit21 = (lfsr >> 21) & 1;
uint32_t bit1 = (lfsr >> 1) & 1;
uint32_t bit0 = (lfsr >> 0) & 1;
uint32_t feedback = bit31 ^ bit21 ^ bit1 ^ bit0;
// 2. Register um 1 nach links schieben und Feedback rechts einspeisen
lfsr = (lfsr << 1) | feedback;
// 3. Kopie anlegen und Exponentenbereich auf dieser Kopie anpassen
float_word res;
res.word = lfsr;
if ( (res.word >> 30) & 1 ) {
// Wenn Bit 30 == 1: Bits 29..24 auf 0 setzen
res.word &= ~(0b00111111 << 24);
} else {
// Wenn Bit 30 == 0: Bits 29..25 auf 1 setzen
res.word |= (0b00011111 << 25);
}
// 4. Fertigen Wert in den Datenkanal schreiben
data_channel_write( sink, res.word );
}
return 0; return 0;
} }
+30 -2
View File
@@ -1,10 +1,38 @@
#include "system/task_sine.h" #include "system/task_sine.h"
#include "system/hardware_task.h"
#include "system/sine_config.h"
#include "system/data_channel.h" #include "system/data_channel.h"
#include "system/float_word.h" #include "system/float_word.h"
#include <math.h>
#include <stdio.h>
#include <limits.h>
#include <system.h>
int task_sine_run( void * data ) { int task_sine_run( void * data ) {
// TODO sine_config * task = ( sine_config * ) data;
uint32_t data_channel_base = task->base.sink;
data_channel_clear( data_channel_base );
for ( uint32_t i = 0; i < DATA_CHANNEL_DEPTH; ++i ) {
float_word res;
//
res.value = task->amplitude * // AMPLITUDE DER WELLE FESTLEGEN
sinf(
( 2.0f * M_PI * i ) // 1. UMRECHNUNG IN BOGENMAß
/ ( float )task->samples_per_periode // 2. ANZAHL DER SAMPLES PRO PERIODE
+ task->phase // PHASENVERSCHIEBUNG ADDIEREN
);
//
data_channel_write( data_channel_base, res.word );
}
return 0; return 0;
} }