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

Subversion Repositories nanoblaze

[/] [nanoblaze/] [trunk/] [Testbench/] [nanoblaze_tb.vhd] - Blame information for rev 10

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

Line No. Rev Author Line
1 5 fcorthay
--##############################################################################
2
--
3
--  nanoblaze_tb
4
--      Testbench for the NanoBlaze processor
5
--
6
--      Instanciates the processor and a stimulus generator.
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
--  Usage
21
--      Set the proper values for all generics.
22
--
23
--      For the processor ROM, use the assembler file "nanoTest.asm".
24
--
25
--##############################################################################
26
 
27
LIBRARY ieee;
28
  USE ieee.std_logic_1164.all;
29
  USE ieee.numeric_std.all;
30
 
31
ENTITY nanoBlaze_tb IS
32
END nanoBlaze_tb ;
33
 
34
--==============================================================================
35
 
36
ARCHITECTURE struct OF nanoBlaze_tb IS
37
 
38
  -- Values for the generic parameters
39
  constant addressBitNb: positive := 8;
40
  constant dataBitNb: positive := 8;
41
  constant programCounterBitNb: positive := 10;
42
  constant stackPointerBitNb: positive := 5;
43
  constant registerAddressBitNb: positive := 4;
44
  constant portAddressBitNb: positive := 8;
45
  constant scratchpadAddressBitNb: positive := 4;
46
 
47
  SIGNAL reset       : std_ulogic;
48
  SIGNAL clock       : std_ulogic;
49
  SIGNAL en          : std_ulogic;
50
  SIGNAL dataAddress : unsigned( addressBitNb-1 DOWNTO 0 );
51
  SIGNAL dataOut     : std_ulogic_vector(dataBitNb-1 DOWNTO 0);
52
  SIGNAL dataIn      : std_ulogic_vector(dataBitNb-1 DOWNTO 0);
53
  SIGNAL readStrobe  : std_uLogic;
54
  SIGNAL writeStrobe : std_uLogic;
55
  SIGNAL int         : std_uLogic;
56
  SIGNAL intAck      : std_ulogic;
57
 
58
  COMPONENT nanoBlaze
59
    GENERIC (
60
      addressBitNb           : positive := 8;
61
      registerBitNb          : positive := 8;
62
      programCounterBitNb    : positive := 10;
63
      stackPointerBitNb      : positive := 5;
64
      registerAddressBitNb   : positive := 4;
65
      scratchpadAddressBitNb : natural  := 6
66
    );
67
    PORT (
68
      reset       : IN  std_ulogic;
69
      clock       : IN  std_ulogic;
70
      en          : IN  std_ulogic;
71
      dataAddress : OUT unsigned(addressBitNb-1 DOWNTO 0);
72
      dataOut     : OUT std_ulogic_vector(registerBitNb-1 DOWNTO 0);
73
      dataIn      : IN  std_ulogic_vector(registerBitNb-1 DOWNTO 0);
74
      readStrobe  : OUT std_uLogic;
75
      writeStrobe : OUT std_uLogic;
76
      int         : IN  std_uLogic;
77
      intAck      : OUT std_ulogic
78
    );
79
  END COMPONENT;
80
 
81
  COMPONENT nanoBlaze_tester
82
    GENERIC (
83
      addressBitNb : positive := 8;
84
      dataBitNb    : positive := 8
85
    );
86
    PORT (
87
      reset       : OUT std_ulogic
88
      clock       : OUT std_uLogic;
89
      en          : OUT std_uLogic;
90
      dataAddress : IN  unsigned(addressBitNb-1 DOWNTO 0);
91
      dataOut     : IN  std_ulogic_vector(dataBitNb-1 DOWNTO 0);
92
      dataIn      : OUT std_ulogic_vector(dataBitNb-1 DOWNTO 0);
93
      readStrobe  : IN  std_uLogic;
94
      writeStrobe : IN  std_uLogic;
95
      int         : OUT std_uLogic;
96
      intAck      : IN  std_uLogic;
97
    );
98
  END COMPONENT;
99
 
100
BEGIN
101
 
102
  I_DUT : nanoBlaze
103
    GENERIC MAP (
104
      addressBitNb           => addressBitNb,
105
      registerBitNb          => dataBitNb,
106
      programCounterBitNb    => programCounterBitNb,
107
      stackPointerBitNb      => stackPointerBitNb,
108
      registerAddressBitNb   => registerAddressBitNb,
109
      scratchpadAddressBitNb => scratchpadAddressBitNb
110
    )
111
    PORT MAP (
112
      clock       => clock,
113
      dataIn      => dataIn,
114
      en          => en,
115
      int         => int,
116
      reset       => reset,
117
      dataAddress => dataAddress,
118
      dataOut     => dataOut,
119
      intAck      => intAck,
120
      readStrobe  => readStrobe,
121
      writeStrobe => writeStrobe
122
    );
123
 
124
  I_tb : nanoBlaze_tester
125
    GENERIC MAP (
126
      addressBitNb => addressBitNb,
127
      dataBitNb    => dataBitNb
128
    )
129
    PORT MAP (
130
      dataAddress => dataAddress,
131
      dataOut     => dataOut,
132
      intAck      => intAck,
133
      readStrobe  => readStrobe,
134
      writeStrobe => writeStrobe,
135
      clock       => clock,
136
      dataIn      => dataIn,
137
      en          => en,
138
      int         => int,
139
      reset       => reset
140
    );
141
 
142
END ARCHITECTURE struct;

powered by: WebSVN 2.1.0

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