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

Subversion Repositories nanoblaze

[/] [nanoblaze/] [trunk/] [Circuit/] [scratchpad.vhd] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 fcorthay
--##############################################################################
2
--
3
--  scratchpad
4
--      The scratchpad as defined in version 3
5
--
6
--      This corresponds to a simple RAM.
7
--
8
--------------------------------------------------------------------------------
9
--
10
--  Versions / Authors
11
--      1.0 Francois Corthay    first implementation
12
--
13
--  Provided under GNU LGPL licence: <http://www.gnu.org/copyleft/lesser.html>
14
--
15
--  by the electronics group of "HES-SO//Valais Wallis", in Switzerland:
16
--  <http://www.hevs.ch/en/rad-instituts/institut-systemes-industriels/>.
17
--
18
--------------------------------------------------------------------------------
19
--
20
--  Hierarchy
21
--      Used by "nanoblaze/nanoProcessor".
22
--
23
--##############################################################################
24
 
25
LIBRARY ieee;
26
  USE ieee.std_logic_1164.all;
27
  USE ieee.numeric_std.all;
28
 
29
ENTITY scratchpad IS
30
  GENERIC(
31
    registerBitNb    : positive := 8;
32
    spadAddressBitNb : natural  := 4
33
  );
34
  PORT(
35
    reset   : IN  std_ulogic;
36
    clock   : IN  std_ulogic;
37
    addr    : IN  unsigned(spadAddressBitNb-1 DOWNTO 0);
38
    write   : IN  std_ulogic;
39
    dataIn  : IN  signed(registerBitNb-1 DOWNTO 0);
40
    dataOut : OUT signed(registerBitNb-1 DOWNTO 0 )
41
  );
42
END scratchpad ;
43
 
44
--==============================================================================
45
 
46
ARCHITECTURE RTL OF scratchpad IS
47
 
48
  subtype memoryWordType is signed(dataOut'range);
49
  type memoryArrayType is array (0 to 2**addr'length-1) of memoryWordType;
50
 
51
  signal memoryArray : memoryArrayType;
52
 
53
BEGIN
54
 
55
  process (clock)
56
  begin
57
    if rising_edge(clock) then
58
      if write = '1' then
59
        memoryArray(to_integer(addr)) <= dataIn;
60
      end if;
61
    end if;
62
  end process;
63
 
64
  dataOut <= memoryArray(to_integer(addr));
65
 
66
END ARCHITECTURE RTL;

powered by: WebSVN 2.1.0

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