Project

General

Profile

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

    
27
entity fg_07_12 is
28
end entity fg_07_12;
29

    
30

    
31

    
32
architecture test of fg_07_12 is
33

    
34
  -- code from book
35

    
36
  procedure find_first_set ( v : in bit_vector;
37
                             found : out boolean;
38
                             first_set_index : out natural ) is
39
  begin
40
    for index in v'range loop
41
      if v(index) = '1' then
42
        found := true;
43
        first_set_index := index;
44
        return;
45
      end if;
46
    end loop;
47
    found := false;
48
  end procedure find_first_set;
49

    
50
  -- end code from book
51

    
52
begin
53

    
54
  stimulus : process is
55

    
56
                       -- code from book (in text)
57

    
58
                       variable int_req : bit_vector (7 downto 0);
59
                     variable top_priority : natural;
60
                     variable int_pending : boolean;
61
                     -- . . .
62

    
63
                     -- end code from book
64

    
65
                     constant block_count : natural := 16;
66

    
67
                     -- code from book (in text)
68

    
69
                     variable free_block_map : bit_vector(0 to block_count-1);
70
                     variable first_free_block : natural;
71
                     variable free_block_found : boolean;
72
                     -- . . .
73

    
74
                     -- end code from book
75

    
76
  begin
77
    int_req := "00010000";
78

    
79
    -- code from book (in text)
80

    
81
    find_first_set ( int_req, int_pending, top_priority );
82

    
83
    -- end code from book
84

    
85
    free_block_map := (others => '0');
86

    
87
    -- code from book (in text)
88

    
89
    find_first_set ( free_block_map, free_block_found, first_free_block );
90

    
91
    -- end code from book
92

    
93
    wait;
94
  end process stimulus;
95

    
96
end architecture test;
(40-40/171)