Project

General

Profile

Download (3.69 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc
3

    
4
-- This file is part of VESTs (Vhdl tESTs).
5

    
6
-- VESTs is free software; you can redistribute it and/or modify it
7
-- under the terms of the GNU General Public License as published by the
8
-- Free Software Foundation; either version 2 of the License, or (at
9
-- your option) any later version. 
10

    
11
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
12
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
-- for more details. 
15

    
16
-- You should have received a copy of the GNU General Public License
17
-- along with VESTs; if not, write to the Free Software Foundation,
18
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
19

    
20
-- ---------------------------------------------------------------------
21
--
22
-- $Id: ch_19_tb-jn.vhd,v 1.3 2001-10-26 16:29:36 paw Exp $
23
-- $Revision: 1.3 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
library qsim;
28
library random;
29

    
30
use std.textio.all;
31

    
32
architecture join of test_bench is
33

    
34
  use qsim.qsim_types.all;
35
  use random.random.all;
36

    
37
  constant num_outputs : positive := 4;
38
  constant probabilities : probability_vector(1 to num_outputs - 1)
39
    := ( 0.2, 0.4, 0.1 );
40

    
41
  signal source_arc, join_arc : arc_type;
42
  signal fork_arc : arc_vector(1 to num_outputs);
43
  signal info_detail : info_detail_type := trace;
44

    
45
begin
46

    
47
  source1 : entity qsim.source(behavior)
48
    generic map ( name => "source1",
49
                  distribution => fixed,  mean_inter_arrival_time => 100 ns,
50
                  seed => sample_seeds(1),
51
                  time_unit => ns,
52
                  info_file_name => "source1.dat" )
53
    port map ( out_arc => source_arc,
54
               info_detail => info_detail );
55

    
56
  fork1 : entity qsim.fork(behavior)
57
    generic map ( name => "fork1",
58
                  probabilities => probabilities,
59
                  seed => sample_seeds(2),
60
                  time_unit => ns,
61
                  info_file_name => "fork1.dat" )
62
    port map ( in_arc => source_arc,
63
               out_arc => fork_arc,
64
               info_detail => info_detail );
65

    
66

    
67
  join1 : entity qsim.join(behavior)
68
    generic map ( name => "join1",
69
                  time_unit => ns,
70
                  info_file_name => "join1.dat" )
71
    port map ( in_arc => fork_arc,
72
               out_arc => join_arc,
73
               info_detail => info_detail );
74

    
75

    
76
  sink1 : entity qsim.sink(behavior)
77
    generic map ( name => "sink1",
78
                  time_unit => ns,
79
                  info_file_name => "sink1.dat" )
80
    port map ( in_arc => join_arc,
81
               info_detail => info_detail );
82

    
83

    
84
  source_monitor : process is
85
                             variable L : line;
86
  begin
87
    wait on source_arc;
88
    write(L, string'("source_monitor: at "));
89
    write(L, now, unit => ns);
90
    write(L, string'(", "));
91
    write(L, source_arc.token, ns);
92
    writeline(output, L);
93
  end process source_monitor;
94

    
95

    
96
  forks : for index in 1 to num_outputs generate
97

    
98
    constant index_string : string := integer'image(index);
99

    
100
  begin
101

    
102
    fork_monitor : process
103
      variable L : line;
104
    begin
105
      wait on fork_arc(index);
106
      write(L, string'("fork_monitor(" & index_string & "): at "));
107
      write(L, now, unit => ns);
108
      write(L, string'(", "));
109
      write(L, fork_arc(index).token, ns);
110
      writeline(output, L);
111
    end process fork_monitor;
112

    
113
  end generate forks;
114

    
115

    
116
  sink_monitor : process
117
    variable L : line;
118
  begin
119
    wait on join_arc;
120
    write(L, string'("sink_monitor: at "));
121
    write(L, now, unit => ns);
122
    write(L, string'(", "));
123
    write(L, join_arc.token, ns);
124
    writeline(output, L);
125
  end process sink_monitor;
126

    
127

    
128
end architecture join;
(242-242/267)