Project

General

Profile

Download (5.14 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_ds-qn.vhd,v 1.3 2001-10-26 16:29:36 paw Exp $
23
-- $Revision: 1.3 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
library qsim;
28

    
29
use qsim.qsim_types.all, random.random.all;
30

    
31
architecture queue_net of disk_system is
32

    
33
  constant disk_cache_miss_rate : real := 0.2;
34
  constant num_disks : positive := 2;
35

    
36
  constant disk_cache_fork_probabilities : probability_vector(1 to num_disks)
37
    := ( others => disk_cache_miss_rate / real(num_disks) );
38

    
39
  signal info_detail_control : info_detail_type := none;
40
  signal new_job, cpu_queue_in, cpu_in, cpu_out,
41
    quantum_expired, job_done, requesting_disk,
42
    disk_cache_hit, request_done : arc_type;
43
  signal disk_cache_miss, disk_done : arc_vector(1 to num_disks);
44
  signal cpu_ready : boolean;
45

    
46
begin
47

    
48
  new_jobs : entity source
49
    generic map ( name => "new_jobs",
50
		  distribution => exponential,
51
		  mean_inter_arrival_time => 2 sec,
52
		  seed => sample_seeds(1),
53
		  time_unit => ms,
54
		  info_file_name => "new_jobs.dat" )
55
    port map ( out_arc => new_job,
56
	       info_detail => info_detail_control );
57

    
58
  cpu_join : entity join
59
    generic map ( name => "cpu_join",
60
		  time_unit => ms,
61
		  info_file_name => "cpu_join.dat" )
62
    port map ( in_arc(1) => quantum_expired,
63
	       in_arc(2) => new_job,
64
	       in_arc(3) => request_done,
65
	       out_arc => cpu_queue_in,
66
	       info_detail => info_detail_control );
67

    
68
  cpu_queue : entity queue
69
    generic map ( name => "cpu_queue",
70
		  time_unit => ms,
71
		  info_file_name => "cpu_queue.dat" )
72
    port map ( in_arc => cpu_queue_in,
73
	       out_arc => cpu_in,
74
	       out_ready => cpu_ready,
75
	       info_detail => info_detail_control );
76

    
77
  cpu : entity server
78
    generic map ( name => "cpu",
79
		  distribution => uniform,
80
		  mean_service_time => 50 ms,
81
		  seed => sample_seeds(2),
82
		  time_unit => ms,
83
		  info_file_name => "cpu.dat" )
84
    port map ( in_arc => cpu_in,
85
	       in_ready => cpu_ready,
86
	       out_arc => cpu_out,
87
	       info_detail => info_detail_control );
88

    
89
  cpu_fork : entity fork
90
    generic map ( name => "cpu_fork",
91
		  probabilities => ( 1 => 0.5, 2 => 0.45 ),
92
		  seed => sample_seeds(3),
93
		  time_unit => ms,
94
		  info_file_name => "cpu_fork.dat" )
95
    port map ( in_arc => cpu_out,
96
	       out_arc(1) => quantum_expired,
97
	       out_arc(2) => requesting_disk,
98
	       out_arc(3) => job_done,
99
	       info_detail => info_detail_control );
100

    
101
  job_sink : entity sink
102
    generic map ( name => "job_sink",
103
		  time_unit => ms,
104
		  info_file_name => "job_sink.dat" )
105
    port map ( in_arc => job_done,
106
	       info_detail => info_detail_control );
107

    
108
  disk_cache_fork : entity fork
109
    generic map ( name => "disk_cache_fork",
110
		  probabilities => disk_cache_fork_probabilities,
111
		  seed => sample_seeds(4),
112
		  time_unit => ms,
113
		  info_file_name => "disk_cache_fork.dat" )
114
    port map ( in_arc => requesting_disk,
115
	       out_arc(1 to num_disks) => disk_cache_miss,
116
	       out_arc(num_disks + 1) => disk_cache_hit,
117
	       info_detail => info_detail_control );
118

    
119

    
120
  disk_array : for disk_index in 1 to num_disks generate
121

    
122
    constant disk_index_str : string := integer'image(disk_index);
123

    
124
    signal disk_in : arc_type;
125
    signal disk_ready : boolean;
126

    
127
  begin
128

    
129
    disk_queue : entity queue
130
      generic map ( name => "disk_queue_" & disk_index_str,
131
		    time_unit => ms,
132
		    info_file_name => "disk_queue_" & disk_index_str & ".dat" )
133
      port map ( in_arc => disk_cache_miss(disk_index),
134
	         out_arc => disk_in,
135
	         out_ready => disk_ready,
136
	         info_detail => info_detail_control );
137

    
138
    disk : entity server
139
      generic map ( name => "disk_" & disk_index_str,
140
		    distribution => exponential,
141
		    mean_service_time => 15 ms,
142
		    seed => sample_seeds(4 + disk_index),
143
		    time_unit => ms,
144
		    info_file_name => "disk_" & disk_index_str & ".dat" )
145
      port map ( in_arc => disk_in,
146
	         in_ready => disk_ready,
147
	         out_arc => disk_done(disk_index),
148
	         info_detail => info_detail_control );
149

    
150
  end generate disk_array;
151

    
152

    
153
  disk_cache_join : entity join
154
    generic map ( name => "disk_cache_join",
155
		  time_unit => ms,
156
		  info_file_name => "disk_cache_join.dat" )
157
    port map ( in_arc(1 to num_disks) => disk_done,
158
	       in_arc(num_disks + 1) => disk_cache_hit,
159
	       out_arc => request_done,
160
	       info_detail => info_detail_control );
161

    
162
end architecture queue_net;
(424-424/510)