OpenCores
URL https://opencores.org/ocsvn/copyblaze/copyblaze/trunk

Subversion Repositories copyblaze

[/] [copyblaze/] [trunk/] [copyblaze/] [rtl/] [vhdl/] [cpu/] [cp_ScratchPad.vhd] - Blame information for rev 71

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ameziti
--------------------------------------------------------------------------------
2
-- Company: 
3
--
4
-- File: cp_ScratchPad.vhd
5
--
6
-- Description:
7
--      projet copyblaze
8
--      Scratch Pad Memory 
9
--
10
-- File history:
11
-- v1.0: 10/10/11: Creation
12
--
13
-- Targeted device: ProAsic A3P250 VQFP100
14
-- Author: AbdAllah Meziti
15
--------------------------------------------------------------------------------
16
 
17
library ieee;
18
use ieee.std_logic_1164.all;
19
use ieee.numeric_std.all;
20
 
21
use     work.Usefull_Pkg.all;           -- Usefull Package
22
 
23
--------------------------------------------------------------------------------
24
-- Entity: cp_ScratchPad
25
--
26
-- Description:
27
--      
28
--      REMARQUE:
29
--
30
--      
31
-- History:
32
-- 10/10/11 AM: Creation
33
-- ---------------------
34
-- xx/xx/xx AM: 
35
--                              
36
--------------------------------------------------------------------------------
37
entity cp_ScratchPad is
38
        generic
39
        (
40
                GEN_WIDTH_DATA          : positive := 8;
41
                GEN_DEPTH_SCRATCH       : positive := 64
42
        );
43
        port (
44
        --------------------------------------------------------------------------------
45
        -- Signaux Systeme
46
        --------------------------------------------------------------------------------
47
                Clk_i                           : in std_ulogic;        --      signal d'horloge générale
48
                Rst_i_n                         : in std_ulogic;        --      signal de reset générale
49
 
50
        --------------------------------------------------------------------------------
51
        -- Signaux Fonctionels
52
        --------------------------------------------------------------------------------
53
                Ptr_i                           : in std_ulogic_vector(log2(GEN_DEPTH_SCRATCH)-1 downto 0);
54
 
55
                Write_i                         : in std_ulogic;
56
                Data_i                          : in std_ulogic_vector(GEN_WIDTH_DATA-1 downto 0);       -- 
57
 
58
                Data_o                          : out std_ulogic_vector(GEN_WIDTH_DATA-1 downto 0)
59
        );
60
end cp_ScratchPad;
61
 
62
--------------------------------------------------------------------------------
63
-- Architecture: RTL
64
-- of entity : cp_ScratchPad
65
--------------------------------------------------------------------------------
66
architecture rtl of cp_ScratchPad is
67
 
68
        --------------------------------------------------------------------------------
69
        -- Définition des fonctions
70
        --------------------------------------------------------------------------------
71
 
72
 
73
 
74
        --------------------------------------------------------------------------------
75
        -- Définition des constantes
76
        --------------------------------------------------------------------------------
77
 
78
        --------------------------------------------------------------------------------
79
        -- Définition des signaux interne
80
        --------------------------------------------------------------------------------
81
        type RAM_TYPE is array (0 to GEN_DEPTH_SCRATCH-1) of std_ulogic_vector(GEN_WIDTH_DATA-1 downto 0);
82
 
83
        signal iScratchPadMem   : RAM_TYPE;
84
        --------------------------------------------------------------------------------
85
        -- Déclaration des composants
86
        --------------------------------------------------------------------------------
87
 
88
begin
89
 
90
        --------------------------------------------------------------------------------
91
        -- Process : ScratchPad_Proc
92
        -- Description: ScratchPad Memory
93
        --------------------------------------------------------------------------------
94
        ScratchPad_Proc : process(Rst_i_n, Clk_i)
95
        begin
96
                if ( Rst_i_n = '0' ) then
97
                        for i in 0 to GEN_DEPTH_SCRATCH-1 loop
98
                                iScratchPadMem(i)       <= (others=>'0');
99
                        end loop;
100
 
101
                elsif ( rising_edge(Clk_i) ) then
102
                        if ( Write_i = '1' ) then
103
                                iScratchPadMem( to_integer(unsigned(Ptr_i)) )   <= Data_i;
104
                        end if;
105
                end if;
106
        end process ScratchPad_Proc;
107
 
108
        Data_o  <=      iScratchPadMem( to_integer(unsigned(Ptr_i)) );
109
 
110
end rtl;
111
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.