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_08_fg_08_06.vhd,v 1.1.1.1 2001-08-22 18:20:48 paw Exp $ 23-- $Revision: 1.1.1.1 $ 24-- 25-- --------------------------------------------------------------------- 26 27package cpu_types is 28 29 constant word_size : positive := 16; 30 constant address_size : positive := 24; 31 32 subtype word is bit_vector(word_size - 1 downto 0); 33 subtype address is bit_vector(address_size - 1 downto 0); 34 35 type status_value is ( halted, idle, fetch, mem_read, mem_write, 36 io_read, io_write, int_ack ); 37 38 subtype opcode is bit_vector(5 downto 0); 39 40 function extract_opcode ( instr_word : word ) return opcode; 41 42 constant op_nop : opcode := "000000"; 43 constant op_breq : opcode := "000001"; 44 constant op_brne : opcode := "000010"; 45 constant op_add : opcode := "000011"; 46 -- . . . 47 48end package cpu_types; 49 50 51 52-- not in book 53 54package body cpu_types is 55 56 function extract_opcode ( instr_word : word ) return opcode is 57 begin 58 return work.cpu_types.op_nop; 59 end function extract_opcode; 60 61end package body cpu_types; 62 63-- end not in book 64