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

Subversion Repositories plb2wbbridge

[/] [plb2wbbridge/] [trunk/] [systems/] [test_system_sim/] [32bit_on_128bitPLB_syn/] [simulation/] [testbench/] [system_tb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 feddischso
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
 
4
library UNISIM;
5
use UNISIM.VCOMPONENTS.ALL;
6
 
7
 
8
entity system_tb is
9
end system_tb;
10
 
11
architecture STRUCTURE of system_tb is
12
 
13
  constant sys_clk_period     : time    := 10.000000 ns;
14
  constant sys_rst_length     : time    := 160 ns;
15
 
16
  constant SYNCH_PART         : integer := 1;
17
  constant SYNCH_SUBPART      : integer := 2;
18
  constant SYNCH_SUBSUBPART   : integer := 3;
19
 
20
  constant SUBSUBPART_LENGTH  : integer := 10;  -- 10 clock cycles
21
  constant SUBPART_LENGTH     : integer := 5;  -- 7 times SUBSUBPART_LENGTH
22
  constant PART_LENGTH        : integer := 5;  -- 6 times SUBPART_LENGTH
23
 
24
  component system is
25
    port (
26
      sys_clk_pin          : in  std_logic;
27
      sys_rst_pin          : in  std_logic;
28
      to_synch_in_pin      : in  std_logic_vector( 0 to 31 );
29
      from_synch_out_pin   : out std_logic_vector( 0 to 31 )
30
    );
31
  end component;
32
 
33
 
34
   signal sys_clk : std_logic;
35
   signal sys_rst : std_logic := '1';
36
 
37
   signal to_synch_in       : std_logic_vector( 0 to 31 );
38
   signal from_synch_out    : std_logic_vector( 0 to 31 );
39
   signal tb_synch_out      : std_logic_vector( 0 to 31 )   := ( others => '0' );
40
 
41
   procedure SendSynch( signal synch_out : OUT std_logic_vector;
42
                                COMMAND :     integer ) is
43
   begin
44
      synch_out( COMMAND ) <= '1';
45
      wait for sys_clk_period*1;
46
      synch_out( COMMAND ) <= '0';
47
   end procedure SendSynch;
48
 
49
 
50
begin
51
 
52
   to_synch_in <= from_synch_out or tb_synch_out;
53
 
54
 
55
 
56
   dut : system
57
      port map (
58
         sys_clk_pin          => sys_clk,
59
         sys_rst_pin          => sys_rst,
60
         to_synch_in_pin      => to_synch_in,
61
         from_synch_out_pin   => from_synch_out
62
      );
63
 
64
 
65
   process
66
   begin
67
      sys_clk <= '0';
68
      loop
69
         wait for (sys_clk_period/2);
70
         sys_clk <= not sys_clk;
71
      end loop;
72
   end process;
73
 
74
 
75
   process
76
   begin
77
      sys_rst <= '1';
78
      wait for ( sys_rst_length );
79
      sys_rst <= not sys_rst;
80
      wait;
81
   end process;
82
 
83
 
84
   process
85
   begin
86
 
87
    wait until sys_rst = '0';
88
    -- wait until masters a ready
89
    wait for sys_clk_period * 10;
90
 
91
 
92
    while true loop
93
      for i in 0 to PART_LENGTH-1 loop
94
         SendSynch( tb_synch_out, SYNCH_PART );
95
 
96
         for j in 0 to SUBPART_LENGTH-1 loop
97
            SendSynch( tb_synch_out, SYNCH_SUBPART );
98
 
99
            for k in 0 to SUBSUBPART_LENGTH loop
100
               SendSynch( tb_synch_out, SYNCH_SUBSUBPART );
101
               wait for (SUBSUBPART_LENGTH * sys_clk_period );
102
            end loop;
103
 
104
 
105
         end loop;
106
 
107
 
108
      end loop;
109
 
110
   end loop;
111
 
112
   end process;
113
 
114
 
115
 
116
 
117
end architecture STRUCTURE;
118
 

powered by: WebSVN 2.1.0

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