--------------------------------------------------------------------------
-- Project: JIPS, a portable 32-bit RISC CPU written in VHDL
-- This file: Types, constants and functions for JIPS
--
-- Copyright (C) 2008 J. Ahrensfeld
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- For questions and ideas, please contact the author at jens@jayfield.org
--
--------------------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.MATH_REAL.ALL;

library work;
use work.mips_types.all;
use work.mips_util_pkg.all;

--------------------------------------------------------------------------
package tlb_types is


-- 	constant TLB_PAGE_SIZE		: positive := 4096;
-- 	constant TLB_NUM_ASIDS		: positive := 64;
-- 	constant TLB_NUM_ENTRIES	: positive := 32;
	
	--Types
-- 	type tlb_flags_t is record	
-- 		N				: std_logic;
-- 		D				: std_logic;
-- 		V				: std_logic;
-- 	end record;
-- 
-- 	type tlb_entry_lo_t is record	
-- 		PFN				: unsigned (31 downto lg2(TLB_PAGE_SIZE));
-- 		N				: std_logic;
-- 		D				: std_logic;
-- 		V				: std_logic;
-- 	end record;
-- 	
-- 	type tlb_entry_hi_t is record	
-- 		VPN				: unsigned (31 downto lg2(TLB_PAGE_SIZE));
-- 		ASID			: unsigned (lg2(TLB_NUM_ASIDS)-1 downto 0);
-- 		G				: std_logic;
-- 	end record;

	-- Functions
	function "or" (a, b : tlb_flags_t) return tlb_flags_t;

end tlb_types;

--------------------------------------------------------------------------
package body tlb_types is

	function "or" (a, b : tlb_flags_t) return tlb_flags_t is
	variable result : tlb_flags_t;
	begin
		result.N				:= a.N or b.N;
		result.D				:= a.D or b.D;
		result.V				:= a.V or b.V;
		
		return result;
		
	end "or";

end tlb_types;

--------------------------------------------------------------------------

