Add comments

This commit is contained in:
2025-05-27 17:42:40 +02:00
parent d1cfa6443b
commit 82d76e48d8
15 changed files with 1626 additions and 1047 deletions

View File

@@ -1,20 +1,27 @@
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-- Entity: effect_selector
-- Purpose: Routes joystick input to different audio control parameters based on effect mode
-- Acts as a multiplexer/router for joystick control signals
ENTITY effect_selector IS
GENERIC (
JOYSTICK_LENGHT : INTEGER := 10
JOYSTICK_LENGHT : INTEGER := 10 -- Width of joystick position data (10-bit = 0-1023 range)
);
PORT (
aclk : IN STD_LOGIC;
aresetn : IN STD_LOGIC;
-- Clock and reset signals
aclk : IN STD_LOGIC; -- Main clock input
aresetn : IN STD_LOGIC; -- Active-low asynchronous reset
effect : IN STD_LOGIC;
jstck_x : IN STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0);
jstck_y : IN STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0);
volume : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0);
balance : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0);
lfo_period : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0)
-- Control and input signals
effect : IN STD_LOGIC; -- Effect mode selector (0=volume/balance mode, 1=LFO/balance mode)
jstck_x : IN STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0); -- X-axis joystick position
jstck_y : IN STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0); -- Y-axis joystick position
-- Output control parameters
volume : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0); -- Volume control output
balance : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0); -- Balance control output
lfo_period : OUT STD_LOGIC_VECTOR(JOYSTICK_LENGHT - 1 DOWNTO 0) -- LFO period control output
);
END effect_selector;
@@ -22,27 +29,39 @@ ARCHITECTURE Behavioral OF effect_selector IS
BEGIN
-- Main control logic process
-- Routes joystick axes to appropriate audio control parameters based on selected mode
PROCESS (aclk)
BEGIN
IF rising_edge(aclk) THEN
IF aresetn = '0' THEN
volume <= (OTHERS => '0');
balance <= (OTHERS => '0');
lfo_period <= (OTHERS => '0');
-- Reset all outputs to zero (minimum values)
volume <= (OTHERS => '0'); -- Minimum volume
balance <= (OTHERS => '0'); -- Full left balance
lfo_period <= (OTHERS => '0'); -- Minimum LFO period
ELSE
-- Normal operation: Route joystick inputs based on effect mode
-- X-axis always controls balance regardless of mode
-- This provides consistent left/right audio balance control
balance <= jstck_x;
-- Y-axis control depends on selected effect mode
IF effect = '1' THEN
-- LFO control
-- LFO Mode: Y-axis controls Low Frequency Oscillator period
-- Used for tremolo, vibrato, or other modulation effects
lfo_period <= jstck_y;
-- Volume remains at last set value (not updated in LFO mode)
ELSE
-- volume/balance control
-- Volume/Balance Mode: Y-axis controls overall volume level
-- Traditional audio mixer control mode
volume <= jstck_y;
-- LFO period remains at last set value (not updated in volume mode)
END IF;
END IF;