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

Subversion Repositories mcu8

[/] [mcu8/] [trunk/] [src/] [processor_tb.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimo
LIBRARY ieee;
2
USE ieee.std_logic_1164.all;
3
use work.cpu_types.all;
4
 
5
ENTITY processor_tb IS
6
END processor_tb;
7
 
8
ARCHITECTURE testbench OF processor_tb IS
9
 
10
  SIGNAL clk : STD_LOGIC := 'X';
11
  SIGNAL nreset : STD_LOGIC := 'X';
12
  SIGNAL one_step, go_step : STD_LOGIC := 'X';
13
  signal zflag, cflag : STD_LOGIC := 'X';
14
  signal a, b : STD_LOGIC_VECTOR(d_bus_width-1 DOWNTO 0) := (OTHERS => 'X');
15
  signal datmem_nrd, datmem_nwr : STD_LOGIC := 'X';
16
  signal datmem_adr : STD_LOGIC_VECTOR(a_bus_width-1 DOWNTO 0) := (OTHERS => 'X');
17
  signal datmem_data_in, datmem_data_out : STD_LOGIC_VECTOR(d_bus_width-1 DOWNTO 0) := (OTHERS => 'X');
18
  signal prog_adr : std_logic_vector(a_bus_width-1 DOWNTO 0) := (OTHERS => 'X');
19
  SIGNAL prog_data : STD_LOGIC_VECTOR(d_bus_width-1 DOWNTO 0) := (OTHERS => 'X');
20
 
21
  COMPONENT cpu
22
    PORT( prog_adr        : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
23
          prog_data       : IN  STD_LOGIC_VECTOR (7 DOWNTO 0);
24
          datmem_data_in  : IN  STD_LOGIC_VECTOR (7 DOWNTO 0);
25
          datmem_data_out : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
26
          datmem_nrd      : OUT STD_LOGIC;
27
          datmem_nwr      : OUT STD_LOGIC;
28
          datmem_adr      : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
29
          a               : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
30
          b               : OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
31
          cflag           : OUT STD_LOGIC;
32
          zflag           : OUT STD_LOGIC;
33
          clk             : IN  STD_LOGIC;
34
          nreset          : IN  STD_LOGIC;
35
          nreset_int      : in std_logic;
36
          go_step         : IN  STD_LOGIC;
37
          one_step        : IN  STD_LOGIC );
38
  END COMPONENT;
39
 
40
  COMPONENT ram
41
    port( addr : IN a_bus;
42
          data_in : in d_bus;
43
          data_out : OUT d_bus;
44
          ce_nwr : in STD_LOGIC ;
45
          ce_nrd : in STD_LOGIC );
46
  END component;
47
 
48
  COMPONENT rom
49
    port( addr : IN a_bus;
50
          data : out d_bus );
51
  END COMPONENT;
52
 
53
for all: cpu USE ENTITY work.processor_E(rtl_A);
54 7 dimo
--for all: cpu use entity work.processor_E(structure); --vasco's cpu processor.model.vhdl
55 2 dimo
 
56
BEGIN
57
 
58
u_cpu: cpu
59
  PORT MAP( prog_adr => prog_adr, prog_data => prog_data, datmem_data_in => datmem_data_in, datmem_data_out => datmem_data_out,
60
            datmem_nrd => datmem_nrd, datmem_nwr => datmem_nwr, datmem_adr => datmem_adr, a => a, b => b, cflag => cflag,
61
            zflag => zflag, clk => clk, nreset_int => nreset, nreset => nreset, go_step => go_step, one_step => one_step);
62
 
63
u_ram: ram
64
  PORT MAP(addr => datmem_adr, data_in => datmem_data_out, data_out => datmem_data_in , ce_nwr => datmem_nwr, ce_nrd => datmem_nrd);
65
 
66
u_rom: rom
67
  port map(addr => prog_adr, data => prog_data);
68
 
69
clk_p: PROCESS
70
  BEGIN
71
    clk <= '1';
72
    WAIT FOR 500 ns;
73
    clk <= '0';
74
    WAIT for 500 ns;
75
  END process;
76
 
77
init:PROCESS
78
  begin
79
    go_step <= '0';
80
    one_step <= '0';
81
    nreset <= '0', '1' AFTER 200000 ns; --200 us
82
    wait;
83
  END process;
84
 
85
END testbench;

powered by: WebSVN 2.1.0

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