下面是关于决断信号的完整的例子:


  Package Resolved_Bit4 is
   type Bit4 is ( X , 0 , 1 , Z );
   type Bit4_Vector is array(Integer range <>) of Bit4;
   function Wired_Or (Input: Bit4_Vector) return Bit4;   --决断函数
   subtype Resolved_Wire is Wired_Or Bit4;         --决断类型
   signal Resolved_Signal: Resolved_Wire;          --决断信号
  end Resolved_Bit4;

 
  package body Resolved_Bit4 is
   function Wired_Or (Input: Bit4_Vactor) return Bit4 is  -- 决断函数的体
              -- 在调用该函数时,将各信号源所得到的值组成一个数组送入该函数的输入参数Input。
    variable result: Bit4 := 0 ;
   begin
     for I in Input'Range loop
              -- Input'Range即输入参数一维数组的元素个数,即信号源的个数。
              
-- 决断结果不应受输入信号值的次序影响。
      if Input(I) = 1 then Result := 1 ; exit;
              --只要由一个信号源的值为 1 ,则决断结果为 1 。
      elsif Input(I) = X then Result := X ;
      else       -- Input(I)的值为 Z 或 0

       null;     -- 若各位的值均为 Z 或 0 ,决断结果为 0 。
      end if;
     end loop;
     return
Result;  --返回决断结果。
   end Wired_Or;
  end Resolved_Bit4;
  读者可以使用四个值中各个不同的两个值的组合执行这个函数,看如何得到最后的值。
   use Resolved_Bit4.all;
   entity Exam is
     port(A, B, C, D: in Bit4; F: out Wired_Or Bit4);
   end Exam;


   architecture Archi of Exam is
   begin
     Source_1: F <= A and B;
     Source_2: F <= C and D;
   end Archi;

  
在模拟时,两个赋值语句同时执行,得到两个值,例如 0 和 1 。于是模拟工具自动调用决断函数,将数组"01"或"10"带入函数的输入参数Input中,得到返回值 1 ,作为F的最后值。