-------------------------------------------------------------------------- -------------------------------------------------------------------------- -- File Name : bit_types.v -- File type : VHDL package description -- Introduction : Data types using mcc defined primitives -- Date Created : October 22, 1990. -- -- Author : Jayanta Roy -- Affiliation : University of Cincinnati, -- Department of Computer Engg. -- -- This document was created as a part of the project funded by -- the Defense Advanced Research Projects Agency under order no. -- 7056 monitored by the Federal Bureau of Investigation under -- contract no. J-FBI-89-094 and by the University of Cincinnati -- Research Council. -- -- Use of this document is strictly prohibited to those members of -- the community who do not beleive in sharing their efforts with -- others. Duplication and distribution is limited to specific -- request to the author. -- -- Copyright (C) 1990 -- University of Cincinnati, The Ohio Board of Regents -- Jayanta Roy and Ranga Vemuri -- All Rights Reserved -- -------------------------------------------------------------------------- -------------------------------------------------------------------------- package bit_types is type bit_code is ('Z', '0', '1', 'X'); type bit_code_vector is array (natural range <>) of bit_code; function resolve_bit_code(inputs: in bit_code_vector) return bit_code; subtype res_MVL is resolve_bit_code bit_code; type res_MVL_Vector is array(natural range <>) of res_MVL; end bit_types; -- library mcc; -- use mcc.C_Interface.all; package body bit_types is function resolve_bit_code(inputs: in bit_code_vector) return bit_code is variable saved_value : bit_code := 'Z'; begin -- for p in inputs'range loop -- C_Procedure("printf","input(%d) = %d\n",p,inputs(p)); -- end loop; for i in inputs'range loop if inputs(i) = 'X' then -- If we ever get an 'X', then the result will be an 'X', -- so go ahead and return. return 'X'; elsif saved_value = 'Z' then -- Any value will override a value of 'Z'. So just save the new value. saved_value := inputs(i); elsif saved_value /= inputs(i) then if inputs(i) /= 'Z' then -- There are conflicting values. return 'X'; end if; end if; end loop; return saved_value; end; end bit_types;