- -------------------------------------------------------------------------------
- -- Title : Wishbone Ram Behavioral model
- -- Project : FH-Hagenberg/ESD - Semester 2, Advanced Methods of Verification
- -------------------------------------------------------------------------------
- -- File : unitRam-Bhv-ea.vhd
- -- Author : Copyright 2008 Wolfgang Silbermayr
- -- UsrNames : silwol - Wolfgang Silbermayr
- -------------------------------------------------------------------------------
- -- Description:
- -------------------------------------------------------------------------------
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.numeric_std.all;
- use work.global.all;
- entity Ram is
- generic (
- gDataWidth : natural := 32;
- gAddrWidth : natural := 8);
- port (
- clk_i : in std_ulogic;
- rst_i : in std_ulogic;
- adr_i : in std_ulogic_vector(gAddrWidth-1 downto 0);
- dat_i : in std_ulogic_vector(gDataWidth-1 downto 0);
- sel_i : in std_ulogic_vector(gAddrWidth/8-1 downto 0);
- cyc_i : in std_ulogic;
- stb_i : in std_ulogic;
- we_i : in std_ulogic;
- dat_o : out std_ulogic_vector(gDataWidth-1 downto 0);
- ack_o : out std_ulogic);
- end entity Ram;
- architecture Bhv of Ram is
- type mem_array is array(natural range <>)
- of std_ulogic_vector(gDataWidth-1 downto 0);
- begin
- variable mem : mem_array(0 to (1 << gAddrWith)-1);
- ram_behavior : process(clk_i, rst_i) is
- begin
- if rst_i = cActivated then
- ack_o <= cInActivated;
- dat_o <= (others => '0');
- else
- ack_o <= cInActivated;
- dat_o <= (others => 'X');
- if cyc_i = cActivated and stb_i = cActivated then
- -- TODO get nubmer of cycles to wait on
- -- TODO wait number of waitstates
- ack_o <= cActivated;
- if we_i = cInActivated then
- dat_o <= mem(adr_i);
- wait until rising_edge(clk_i);
- dat_o <= (others => 'X');
- else
- wait until rising_edge(clk_i);
- mem(adr_i) <= dat_i;
- end if;
- ack_o <= cInActivated;
- end if;
- end if;
- end process ram_behavior;
- end architecture Bhv;
Undefined
By: ram vhdl | Date: Mar 20 2008 10:11 | Format: None | Expires: never | Size: 2.17 KB | Hits: 1191
Latest pastes
57 minutes ago
10 hours ago
1 days ago
2 days ago
2 days ago