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

Subversion Repositories nanoblaze

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 fcorthay
--##############################################################################
2
--
3
--  nanoblaze
4
--      Top view of the NanoBlaze processor
5
--
6
--      The processor is compatible with the Xilinx PicoBlaze
7
--      <http://www.picoblaze.info>, but different bit widths can be adapted
8
--      in order to have a larger processor.
9
--
10
--------------------------------------------------------------------------------
11
--
12
--  Versions / Authors
13
--      1.0 Francois Corthay    first implementation
14
--
15
--  Provided under GNU LGPL licence: <http://www.gnu.org/copyleft/lesser.html>
16
--
17
--  by the electronics group of "HES-SO//Valais Wallis", in Switzerland:
18
--  <http://www.hevs.ch/en/rad-instituts/institut-systemes-industriels/>.
19
--
20
--------------------------------------------------------------------------------
21
--
22
--  Usage
23
--      Set the proper values for all generics.
24
--
25
--      Edit an assembler file and compile it as the architecture of "programRom".
26
--
27
--      The "reset" signal is active high.
28
--
29
--------------------------------------------------------------------------------
30
--
31
--  Synthesis results
32
--      A circuit compatible with the PicoBlaze sizes gives the following
33
--      synthesis result on a Xilinx Spartan3-1000:
34
--          Number of Slice Flip Flops:           157 out of  15,360    1%
35
--          Number of 4 input LUTs:               446 out of  15,360    2%
36
--          Number of BRAMs:                        1 out of      24    4%
37
--
38
--##############################################################################
39
 
40
LIBRARY ieee;
41
  USE ieee.std_logic_1164.all;
42
  USE ieee.numeric_std.all;
43
 
44
ENTITY nanoBlaze IS
45
  GENERIC(
46
    addressBitNb           : positive := 8;
47
    registerBitNb          : positive := 8;
48
    programCounterBitNb    : positive := 10;
49
    stackPointerBitNb      : positive := 5;
50
    registerAddressBitNb   : positive := 4;
51
    scratchpadAddressBitNb : natural  := 6
52
  );
53
  PORT(
54
    reset       : IN     std_ulogic;
55
    clock       : IN     std_ulogic;
56
    en          : IN     std_ulogic;
57
    dataAddress : OUT    unsigned(addressBitNb-1 DOWNTO 0);
58
    dataOut     : OUT    std_ulogic_vector(registerBitNb-1 DOWNTO 0);
59
    dataIn      : IN     std_ulogic_vector(registerBitNb-1 DOWNTO 0);
60
    readStrobe  : OUT    std_uLogic;
61
    writeStrobe : OUT    std_uLogic;
62
    int         : IN     std_uLogic;
63
    intAck      : OUT    std_ulogic
64
  );
65
END nanoBlaze ;
66
 
67
--==============================================================================
68
 
69
ARCHITECTURE struct OF nanoBlaze IS
70
 
71
  constant instructionBitNb: positive := 18;
72
  SIGNAL instruction    : std_ulogic_vector(instructionBitNb-1 DOWNTO 0);
73
  SIGNAL logic1         : std_ulogic;
74
  SIGNAL programCounter : unsigned(programCounterBitNb-1 DOWNTO 0);
75
 
76
  COMPONENT nanoProcessor
77
    GENERIC (
78
      addressBitNb           : positive := 8;
79
      registerBitNb          : positive := 8;
80
      registerAddressBitNb   : positive := 4;
81
      programCounterBitNb    : positive := 10;
82
      stackPointerBitNb      : positive := 5;
83
      instructionBitNb       : positive := 18;
84
      scratchpadAddressBitNb : natural  := 4
85
    );
86
    PORT (
87
      reset       : IN  std_uLogic;
88
      clock       : IN  std_uLogic;
89
      en          : IN  std_uLogic;
90
      progCounter : OUT unsigned(programCounterBitNb-1 DOWNTO 0);
91
      instruction : IN  std_ulogic_vector(instructionBitNb-1 DOWNTO 0);
92
      dataAddress : OUT unsigned(addressBitNb-1 DOWNTO 0);
93
      dataOut     : OUT std_ulogic_vector(registerBitNb-1 DOWNTO 0);
94
      dataIn      : IN  std_ulogic_vector(registerBitNb-1 DOWNTO 0);
95
      readStrobe  : OUT std_uLogic;
96
      writeStrobe : OUT std_uLogic;
97
      int         : IN  std_uLogic;
98
      intAck      : OUT std_ulogic
99
    );
100
  END COMPONENT;
101
 
102
  COMPONENT programRom
103
    GENERIC (
104
      addressBitNb : positive := 8;
105
      dataBitNb    : positive := 8
106
    );
107
    PORT (
108
      reset   : IN  std_uLogic;
109
      clock   : IN  std_uLogic;
110
      en      : IN  std_uLogic;
111
      address : IN  unsigned(addressBitNb-1 DOWNTO 0);
112
      dataOut : OUT std_ulogic_vector(dataBitNb-1 DOWNTO 0)
113
    );
114
  END COMPONENT;
115
 
116
BEGIN
117
  logic1 <= '1';
118
 
119
  I_up : nanoProcessor
120
    GENERIC MAP (
121
      addressBitNb           => addressBitNb,
122
      registerBitNb          => registerBitNb,
123
      registerAddressBitNb   => registerAddressBitNb,
124
      programCounterBitNb    => programCounterBitNb,
125
      stackPointerBitNb      => stackPointerBitNb,
126
      instructionBitNb       => instructionBitNb,
127
      scratchpadAddressBitNb => scratchpadAddressBitNb
128
    )
129
    PORT MAP (
130
      reset       => reset,
131
      clock       => clock,
132
      en          => en,
133
      progCounter => programCounter,
134
      instruction => instruction,
135
      dataAddress => dataAddress,
136
      dataOut     => dataOut,
137
      dataIn      => dataIn,
138
      readStrobe  => readStrobe,
139
      writeStrobe => writeStrobe,
140
      int         => int,
141
      intAck      => intAck
142
    );
143
 
144
  I_rom : programRom
145
    GENERIC MAP (
146
      addressBitNb => programCounterBitNb,
147
      dataBitNb    => instructionBitNb
148
    )
149
    PORT MAP (
150
      reset   => reset,
151
      clock   => clock,
152
      en      => logic1,
153
      address => programCounter,
154
      dataOut => instruction
155
    );
156
 
157
END ARCHITECTURE struct;

powered by: WebSVN 2.1.0

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