{ ===================================================== }
{    74LP139                                            }
{ ===================================================== }
logicname 74LP139

{ ----------------------------------------------------- }
{    手続き譜                                           }
{ ----------------------------------------------------- }
procedure dec2to4
input  G;
input  D[2];
output Y[4];
bitn   y[4];

   if (G)
      y=0b0000;
   else
      switch(D)
         case 0: y=0b0001;
         case 1: y=0b0010;
         case 2: y=0b0100;
         case 3: y=0b1000;
      endswitch
   endif

   Y=!y;
endp

{ ----------------------------------------------------- }
{    実効譜                                             }
{ ----------------------------------------------------- }
entity TTL
input  GA,GB;
input  DA[2],DB[2];
output YA[4],YB[4];

   YA=dec2to4(GA,DA);
   YB=dec2to4(GB,DB);

ende

{ ----------------------------------------------------- }
{    機能実行譜                                         }
{ ----------------------------------------------------- }
entity sim
output GA,GB;
output DA[2],DB[2];
output YA[4],YB[4];
bitr   tc[4];

   part TTL(GA,GB,DA,DB,YA,YB)

   tc=tc+1;

   GA=tc.2;
   GB=!tc.2;
   DA=tc.0:1;
   DB=tc.0:1;

ende

endlogic