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

Subversion Repositories ahb_system_generator

[/] [ahb_system_generator/] [trunk/] [src/] [uut_stimulator.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 federico.a
use STD.textio.all;--added for time and strings
2
 
3
library ieee;
4
use ieee.std_logic_arith.all;
5
use ieee.std_logic_misc.all;
6
use ieee.std_logic_unsigned.all;
7
use ieee.std_logic_1164.all;
8
use IEEE.std_logic_textio.all;--added for time and strings
9
 
10
-- Add your library and packages declaration here ...
11
use work.ahb_package.all;
12
 
13
entity uut_stimulator is
14
generic (
15
stim_type: in uut_params_t:= (bits32,retry,master,'0',single,2,4,hprot_posted,2048,1,0,'0');
16
enable: in integer:= 0;
17
eot_enable: in integer:= 0);
18
port(
19
  hclk : in std_logic;
20
  hresetn : in std_logic;
21
  amba_error: in std_logic;
22
  eot_int: in std_logic;
23
  conf: out conf_type_t;
24
  sim_end: out std_logic
25
);
26
end uut_stimulator;
27
 
28
--}} End of automatically maintained section
29
 
30
architecture rtl of uut_stimulator is
31
 
32
signal cycle  : std_logic;
33
signal counter: integer range 0 to 127;
34
 
35
begin
36
 
37
process
38
begin
39
  if hresetn = '0' then
40
    counter <= 1;
41
  else
42
    if(counter > 15) then
43
      assert false report "* Simulator Exit.." severity warning;
44
      sim_end <= '1';
45
      wait;
46
    else
47
      sim_end <= '0';
48
      counter <= counter+1;
49
    end if;
50
  end if;
51
 
52
  if (eot_enable/=1) then
53
    wait for 4000 ns;
54
  else
55
    wait until (eot_int='1' or amba_error='1');--write
56
    wait until (eot_int='1' or amba_error='1');--read
57
  end if;
58
end process;
59
 
60
cycle_pr:process
61
begin
62
  if cycle/='1' then
63
    cycle <= '1';
64
    if (eot_enable/=1) then
65
      wait for 2000 ns;
66
    else
67
      wait until (eot_int='1' or amba_error='1');
68
    end if;
69
  else
70
    cycle <= '0';
71
    if (eot_enable/=1) then
72
      wait for 2000 ns;
73
    else
74
      wait until (eot_int='1' or amba_error='1');
75
    end if;
76
  end if;
77
end process;
78
 
79
process
80
variable hburst: std_logic_vector(2 downto 0);
81
begin
82
if (counter<=16) then
83
 
84
  conf.write <= '0';
85
  wait for 30 ns;
86
  conf.write <= '1';
87
 
88
  conf.addr <= dma_type_addr;
89
 
90
  case stim_type.hburst_cycle is
91
          when '1' =>
92
                hburst := stim_type.hburst_tb;
93
          when others =>
94
                hburst := conv_std_logic_vector(counter,3);
95
          end case;
96
  conf.wdata <= "000000000000000000"&
97
  stim_type.split_tb&stim_type.prior_tb&stim_type.hsize_tb&hburst&stim_type.hprot_tb&cycle&stim_type.locked_request;
98
  wait for 10 ns;
99
 
100
  conf.addr <= dma_extadd_addr;
101
  --conf.wdata(31 downto 12)<=stim_type.high_addr_tb;
102
  case stim_type.ext_addr_incr_tb is
103
          when 1 =>--fixed ext addr
104
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb ,32);
105
          when 2 =>--increasing by 4, page fault if base near end of slave address space
106
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*4 ,32);
107
          when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
108
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*(stim_type.ext_addr_incr_tb-4) ,32);
109
          end case;
110
  wait for 10 ns;--external address
111
 
112
  conf.addr <= dma_intadd_addr;
113
  case stim_type.int_addr_incr_tb is
114
          when 1 =>--fixed int addr
115
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb,32);
116
          when 2 =>--increasing by 4, page fault if base near end of slave address space
117
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*4 ,32);
118
          when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
119
                conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*(stim_type.int_addr_incr_tb-4) ,32);
120
          end case;
121
  wait for 10 ns;--internal address
122
 
123
  conf.addr <= dma_intmod_addr;
124
  conf.wdata <= conv_std_logic_vector(stim_type.intmod_tb ,32);
125
  wait for 10 ns;--modifier  
126
 
127
if enable=1 then
128
  conf.addr <= dma_count_addr;
129
  conf.wdata <= conv_std_logic_vector(counter,32);
130
  wait for 10 ns;--dma count
131
else
132
  wait for 10 ns;--dma count
133
end if;
134
 
135
  conf.write <= '0';
136
  conf.addr <= "0000";
137
  conf.wdata <= (others => '-');
138
 
139
  if (eot_enable/=1) then
140
          wait until cycle'event;
141
  else
142
          wait until (eot_int='1' or amba_error='1');
143
  end if;
144
else
145
  wait;
146
end if;
147
--if counter=16 then wait; end if;
148
 
149
end process;
150
 
151
 
152
assert (amba_error/='1') report "###ERROR in AMBA operation!!!" severity error;
153
 
154
end rtl;

powered by: WebSVN 2.1.0

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