Project

General

Profile

Download (3.67 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_05_fg_05_19.vhd,v 1.2 2001-10-26 16:29:34 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
entity fg_05_19 is
28
end entity fg_05_19;
29

    
30

    
31
architecture test of fg_05_19 is
32

    
33
  constant scheduling_delay : delay_length := 5 ns;
34

    
35
  subtype request_type is natural range 0 to 20;
36
  type server_status_type is (ready, busy);
37

    
38
  signal first_priority_request,
39
    first_normal_request,
40
    reset_request : request_type := 0;
41
  signal functional_request, equivalent_request : request_type;
42
  signal priority_waiting : boolean := false;
43
  signal server_status : server_status_type := busy;
44

    
45
begin
46

    
47
  functional_scheduler : block is
48
                                 port ( request : out request_type );
49
                               port map ( request => functional_request );
50
  begin
51

    
52
    -- code from book
53

    
54
    scheduler :
55
      request <= first_priority_request after scheduling_delay
56
                 when priority_waiting and server_status = ready else
57
                 first_normal_request after scheduling_delay
58
                 when not priority_waiting and server_status = ready else
59
                 unaffected
60
                 when server_status = busy else
61
                 reset_request after scheduling_delay;
62

    
63
    -- end code from book
64

    
65
  end block functional_scheduler;
66

    
67
  --------------------------------------------------
68

    
69
  equivalent_scheduler : block is
70
                                 port ( request : out request_type );
71
                               port map ( request => equivalent_request );
72
  begin
73

    
74
    -- code from book
75

    
76
    scheduler : process is
77
    begin
78
      if priority_waiting and server_status = ready then
79
        request <= first_priority_request after scheduling_delay;
80
      elsif not priority_waiting and server_status = ready then
81
        request <= first_normal_request after scheduling_delay;
82
      elsif server_status = busy then
83
        null;
84
      else
85
        request <= reset_request after scheduling_delay;
86
      end if;
87
      wait on first_priority_request, priority_waiting, server_status,
88
        first_normal_request, reset_request;
89
    end process scheduler;
90

    
91
    -- end code from book
92

    
93
  end block equivalent_scheduler;
94

    
95
  --------------------------------------------------
96

    
97
  stimulus : process is
98
  begin
99
    first_priority_request <= 10;	wait for 20 ns;
100
    first_normal_request <= 5;		wait for 20 ns;
101
    server_status <= ready;		wait for 20 ns;
102
    server_status <= busy;		wait for 20 ns;
103
    priority_waiting <= true;		wait for 20 ns;
104
    server_status <= ready;		wait for 20 ns;
105
    first_normal_request <= 7;		wait for 20 ns;
106
    first_priority_request <= 12;	wait for 20 ns;
107

    
108
    wait;
109
  end process stimulus;
110

    
111
  verifier :
112
    assert functional_request = equivalent_request
113
      report "Functional and equivalent models give different results";
114

    
115
end architecture test;
(31-31/171)