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

Subversion Repositories nanoblaze

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

Go to most recent revision | 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
 
43
END scratchpad ;
44
 
45
--==============================================================================
46
 
47
ARCHITECTURE RTL OF scratchpad IS
48
 
49
  subtype memoryWordType is signed(dataOut'range);
50
  type memoryArrayType is array (0 to 2**addr'length-1) of memoryWordType;
51
 
52
  signal memoryArray : memoryArrayType;
53
 
54
BEGIN
55
 
56
  process (clock)
57
  begin
58
    if rising_edge(clock) then
59
      if write = '1' then
60
        memoryArray(to_integer(addr)) <= dataIn;
61
      end if;
62
    end if;
63
  end process;
64
 
65
  dataOut <= memoryArray(to_integer(addr));
66
 
67
END ARCHITECTURE RTL;

powered by: WebSVN 2.1.0

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