
-- 
-- Definition of  dice_game_0
-- 
--      Tue Mar 29 17:00:53 2005
--      
--      LeonardoSpectrum Level 3, 2002b.21
-- 

library IEEE;
use IEEE.STD_LOGIC_1164.all;

package components is
   component DFF
      port (
         Q : OUT std_logic ;
         D : IN std_logic ;
         CLK : IN std_logic ;
         CLRN : IN std_logic := '1' ;
         PRN : IN std_logic := '1') ;
   end component ;
   component VCC
      port (
         Y : OUT std_logic) ;
   end component ;
end components ;


package body components is
end components ;

library IEEE;
use IEEE.STD_LOGIC_1164.all;
-- Library use clause for technology cells
library altera ;
use altera.all ;

entity dice_game_0 is
   port (
      Rb : IN std_logic ;
      Reset : IN std_logic ;
      CLK : IN std_logic ;
      Sum : IN std_logic_vector (3 DOWNTO 0) ;
      Roll : OUT std_logic ;
      Win : OUT std_logic ;
      Lose : OUT std_logic) ;
end dice_game_0 ;

architecture DiceBehave of dice_game_0 is
   signal a_0, modgen_eq_11_nx13, modgen_eq_11_nx15, Point_3, Point_2, 
      Point_1, Point_0, State_3, State_1, State_0, State_2, nx425, 
      NOT_Nextstate_2, Sp, NOT_nx184, nx416, nx417, nx418, nx419, nx420, 
      nx421, nx422, nx423, nx424, nx426, nx427, nx428, nx429, nx430, nx431, 
      nx432, nx433, nx434, nx435, nx436, nx437, nx438, nx439, nx440, nx441, 
      nx442, nx443, nx444, nx445, nx446, nx447, nx448, nx449, nx450, nx451, 
      nx452, nx453, nx454, Lose_EXMPLR: std_logic ;

begin
   Lose <= Lose_EXMPLR ;
   modgen_eq_11_nx13 <= (not Sum(3) and not Point_3 and not Sum(2) and not 
   Point_2) or (not Sum(3) and not Point_3 and Sum(2) and Point_2) or (
   Sum(3) and Point_3 and not Sum(2) and not Point_2) or (Sum(3) and Point_3
    and Sum(2) and Point_2) ;
   modgen_eq_11_nx15 <= (not Sum(1) and not Point_1 and not Sum(0) and not 
   Point_0) or (not Sum(1) and not Point_1 and Sum(0) and Point_0) or (
   Sum(1) and Point_1 and not Sum(0) and not Point_0) or (Sum(1) and Point_1
    and Sum(0) and Point_0) ;
   a_0 <= (modgen_eq_11_nx13 and modgen_eq_11_nx15) ;
   reg_Point_3 : work.components.DFF port map ( Q=>Point_3, D=>nx447, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_Point_2 : work.components.DFF port map ( Q=>Point_2, D=>nx448, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_Point_1 : work.components.DFF port map ( Q=>Point_1, D=>nx449, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_Point_0 : work.components.DFF port map ( Q=>Point_0, D=>nx450, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_State_3 : work.components.DFF port map ( Q=>State_3, D=>nx451, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_State_1 : work.components.DFF port map ( Q=>State_1, D=>nx453, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_State_0 : work.components.DFF port map ( Q=>State_0, D=>nx454, CLK=>
      CLK, CLRN=>nx425, PRN=>nx425);
   reg_State_2 : work.components.DFF port map ( Q=>State_2, D=>
      NOT_Nextstate_2, CLK=>CLK, CLRN=>nx425, PRN=>nx425);
   ix455 : work.components.VCC port map ( Y=>nx425);
   NOT_Nextstate_2 <= (nx427 and nx445) ;
   Sp <= (NOT_nx184 and nx438) ;
   NOT_nx184 <= (not Sum(3) and not Sum(2) and not Rb) or (Sum(3) and Sum(2)
    and not Rb) or (not Rb and not nx435) ;
   nx416 <= (Sum(3) and Sum(0)) or (not Sum(3) and not Sum(1)) or (Sum(3)
    and Sum(1)) or (Sum(3) and not Sum(2)) or (not Sum(3) and Sum(2)) ;
   nx417 <= (Sum(3) and Sum(2) and not Sum(1) and not Sum(0)) ;
   nx418 <= (nx430 and nx442) ;
   nx419 <= (not State_3 and nx452 and State_1) or (not nx452 and not 
   State_1) or (not Rb) ;
   nx420 <= (Reset and State_3 and not State_1) or (State_1 and not Rb) ;
   nx421 <= (nx437 and nx446) ;
   nx422 <= (not Sum(3) and not Sum(2)) or (Sum(3) and Sum(2)) or (not 
   Sum(0)) or (not Sum(1)) ;
   nx423 <= (nx452 and not State_1 and not NOT_nx184) or (not nx452 and 
   State_1) or (Reset and State_1) ;
   nx424 <= (nx452 and a_0 and not Rb) or (not nx452 and not State_1) ;
   nx426 <= (nx435 and nx439) ;
   nx427 <= (nx419 and nx444) ;
   nx428 <= (nx432 and nx443) ;
   nx429 <= (not State_3 and nx452) ;
   nx430 <= (nx452 and not State_1) ;
   nx431 <= (nx416 and nx440) ;
   nx432 <= (not Sum(3) and Sum(2)) ;
   nx433 <= (not Sum(3) and not Sum(1)) or (not Sum(3) and Sum(2)) ;
   nx434 <= (Sum(3) and Sum(0)) or (Sum(3) and Sum(1)) or (Sum(3) and not 
   Sum(2)) ;
   nx435 <= (Sum(1) and Sum(0)) ;
   nx436 <= (State_3 and State_1) or (not Reset and State_3) or (nx452) ;
   nx437 <= (not a_0 and not Rb) or (not State_3) ;
   nx438 <= (nx452 and State_0 and nx434) or (nx452 and State_0 and nx433) ;
   nx439 <= (not Sum(3) and Sum(2) and not a_0 and not Rb) ;
   nx440 <= (not State_3 and not State_1 and not Rb) ;
   nx441 <= (State_3 and not nx426) or (nx431) or (not nx452) ;
   nx442 <= (not Sum(3) and not Sum(2) and Sum(1) and not State_3) ;
   nx443 <= (State_3 and nx452 and not a_0 and nx435) ;
   nx444 <= (not nx428 and not nx429) or (not nx417 and not nx428) or (
   State_1 and not nx428) ;
   nx445 <= (not nx418 and not Lose_EXMPLR) or (State_3 and not nx418) or (
   Reset and not nx418) ;
   nx446 <= (not Rb and nx422) or (State_1) or (State_3) ;
   nx447 <= (Point_3 and not Sp) or (Sum(3) and Sp) ;
   nx448 <= (Point_2 and not Sp) or (Sum(2) and Sp) ;
   nx449 <= (Point_1 and not Sp) or (Sum(1) and Sp) ;
   nx450 <= (Point_0 and not Sp) or (Sum(0) and Sp) ;
   nx451 <= (nx436 and nx441) ;
   nx452 <= (not State_2) ;
   nx453 <= (nx452 and nx421) or (not nx452 and nx420) ;
   nx454 <= (State_3 and nx424) or (not State_3 and nx423) ;
   Roll <= (nx452 and not State_1 and Rb) or (State_3 and nx452 and Rb) ;
   Win <= (State_3 and State_0) ;
   Lose_EXMPLR <= (nx452 and State_1) ;
end DiceBehave ;

