Question: Can someone fix my code? I pasted my code below and keep getting these errors. Can someone paste the fixed code once it compiles and

Can someone fix my code? I pasted my code below and keep getting these errors. Can someone paste the fixed code once it compiles and is able to be ModelSimed. Thank you.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Memory is
Port ( Clk : in STD_LOGIC;
Ld1 : in STD_LOGIC;
ReadAddr : in STD_LOGIC_VECTOR(1 downto 0);
WriteAddr : in STD_LOGIC_VECTOR(1 downto 0);
Memin : in STD_LOGIC_VECTOR(5 downto 0);
Memout : out STD_LOGIC_VECTOR(5 downto 0));
end Memory;
architecture Behavioral of Memory is
type memory_array is array (0 to 3) of std_logic_vector(5 downto 0);
signal memory_reg : memory_array :=(others =>(others =>'0'));
begin
process (Clk)
begin
if rising_edge(Clk) then
if Ld1='1' then
memory_reg(to_integer(unsigned(WriteAddr)))= Memin;
end if;
Memout = memory_reg(to_integer(unsigned(ReadAddr)));
end if;
end process;
end Behavioral;
-- Process for selecting output based on readAddr
process(clk)
begin
if rising_edge(clk) then
case readAddr is
when "00"=> Memout = register(0);
when "01"=> Memout = register(1);
when "10"=> Memout = register(2);
when "11"=> Memout = register(3);
when others => Memout ="XXXXXX"; -- Handle invalid addresses
end case;
end if;
end process;
-- Tri-state buffer for output selection
tri_state_select: signal (2 downto 0);
with tri_state_select select Memout =
register(0) when "001",
register(1) when "010",
register(2) when "100",
register(3) when "111",
"ZZZZZZ" when others;
-- Connect tri-state buffers based on readAddr
tri_state_select ="001" when readAddr ="00" else
"010" when readAddr ="01" else
"100" when readAddr ="10" else
"111" when readAddr ="11" else
"000";
end architecture Behavioral;
 Can someone fix my code? I pasted my code below and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!