Refactor volume_saturator VHDL code for improved readability and structure; update project files for consistent path references and disable unused components in lab3 design.

This commit is contained in:
2025-05-19 16:24:36 +02:00
parent 5f30651763
commit 1b6bae5183
16 changed files with 965 additions and 618 deletions

View File

@@ -1,22 +1,37 @@
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
entity led_controller is
Generic (
LED_WIDTH : positive := 8
ENTITY led_controller IS
GENERIC (
LED_WIDTH : POSITIVE := 8
);
Port (
mute_enable : in std_logic;
filter_enable : in std_logic;
PORT (
mute_enable : IN STD_LOGIC;
filter_enable : IN STD_LOGIC;
led_r : out std_logic_vector(LED_WIDTH-1 downto 0);
led_g : out std_logic_vector(LED_WIDTH-1 downto 0);
led_b : out std_logic_vector(LED_WIDTH-1 downto 0)
led_r : OUT STD_LOGIC_VECTOR(LED_WIDTH - 1 DOWNTO 0);
led_g : OUT STD_LOGIC_VECTOR(LED_WIDTH - 1 DOWNTO 0);
led_b : OUT STD_LOGIC_VECTOR(LED_WIDTH - 1 DOWNTO 0)
);
end led_controller;
END led_controller;
architecture Behavioral of led_controller is
ARCHITECTURE Behavioral OF led_controller IS
begin
-- constant for "ON" and "OFF"
CONSTANT ALL_ON : STD_LOGIC_VECTOR(LED_WIDTH - 1 DOWNTO 0) := (OTHERS => '1');
CONSTANT ALL_OFF : STD_LOGIC_VECTOR(LED_WIDTH - 1 DOWNTO 0) := (OTHERS => '0');
end Behavioral;
BEGIN
-- If mute_enable = '1' Red LEDs on, others off
-- Else if filter_enable='1' Blue LEDs on, others off
-- Else Green LEDs on, others off
led_r <= ALL_ON WHEN mute_enable = '1' ELSE
ALL_OFF;
led_b <= ALL_ON WHEN (mute_enable = '0' AND filter_enable = '1') ELSE
ALL_OFF;
led_g <= ALL_ON WHEN (mute_enable = '0' AND filter_enable = '0') ELSE
ALL_OFF;
END Behavioral;