Morell
Member level 1
Hi everybody
I want to design a 256x8 Memory (RAM) and this is my code:
I think it is correct but I'm not a pro in VHDL.
Pleas comment "CORRECT" if you think it is correct.
Any comments or suggestion would be appreciated.
Tnx alot
I want to design a 256x8 Memory (RAM) and this is my code:
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 entity RAM_256Bytes is Port ( CLK : in STD_LOGIC; R_W : in STD_LOGIC; -- 1 means READ, 0 means WRITE Address : in STD_LOGIC_VECTOR (7 downto 0); Din : in STD_LOGIC_VECTOR (7 downto 0); Dout : out STD_LOGIC_VECTOR (7 downto 0)); end RAM_256Bytes; architecture Behavioral of RAM_256Bytes is --Defining a 2D signal as a type for RAM type RAM_256x8 is array (0 to 255) of std_logic_vector(7 downto 0); --Creating a 2D signal as RAM signal RAM: RAM_256x8; begin Read_Process: Process (CLK,R_W) begin if rising_edge (CLK) then if R_W= '1' then -- Reading has higher priority Dout <= RAM(conv_integer(Address)); elsif R_W = '0' then RAM (conv_integer(Address)) <= Din; end if; end if; end process; end Behavioral;
I think it is correct but I'm not a pro in VHDL.
Pleas comment "CORRECT" if you think it is correct.
Any comments or suggestion would be appreciated.
Tnx alot