Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Explain the nature of human resource management.

Answered: 1 week ago

Question

Write a note on Quality circles.

Answered: 1 week ago

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

Why is executive onboarding for external hires so difficult?

Answered: 1 week ago

Question

1. What is perception?

Answered: 1 week ago