原创 电梯状态机设计--Protel99SE自带CUPL语言设计

2007-1-16 00:10 4545 7 7 分类: FPGA/CPLD

Name        PLDDesign3            ;
Partno                           ;
Revision    1                    ;
Date        3/12/02              ;
Designer    HotPower             ;
Company     Protel International ;
Assembly                         ;
Location                         ;
Device      g16v8                ;
Format      j                    ;


/*********************************************************************/
/* This PLD design (Revision 1) created on 3/12/02                   */
/*      for                   Protel International                   */
/*      and is stored as      PLDDesign                              */
/*********************************************************************/


/** Inputs  **/
Pin[1, 11] = [clk, oe];
Pin[2, 3, 4] = [l1call, l2call, l3call];
Pin[5, 6, 7] = [arr1, arr2, arr3];
Pin[8, 9] = [emerg_stop, emerg_bell];


/** Outputs **/
Pin[12] = [door];
Pin[13, 14] = [motorup, motordn];
Pin[15, 16] = [f1_dira, f1_dirb];


Pin[17, 18] = [motionu, motiond];
Pin[19] = [bell];


/**  reduction level flags  **/
min door.d    = 2;
min f1_dira.d = 2;
min f1_dirb.d = 2;


/** internal node **/
up = !f1_dira;
dn =  f1_dira;


1floor = !f1_dira & !f1_dirb;
2floor = !1floor  & !3floor;
3floor =  f1_dira &  f1_dirb;


/** Logic Equations **/
motorup =  motionu & !emerg_stop
        & !f1_dira & (!arr2 # !arr3 # arr2 & !l2call);


motordn =  motiond & !emerg_stop
        & !f1_dira & (!arr1 # !arr2 # arr2 & !l2call);


   bell =  emerg_stop
        #  emerg_bell;


/** State Definitions **/
fld control = [!door, motionu, motiond, f1_dira, f1_dirb];


$define open1    'b'10000 /** 'h'10 **/
$define close1   'b'00000 /** 'h'00 **/
$define up1      'b'01000 /** 'h'08 **/
$define open2u   'b'10001 /** 'h'11 **/
$define open2d   'b'10010 /** 'h'12 **/
$define close2u  'b'00001 /** 'h'01 **/
$define close2d  'b'00010 /** 'h'02 **/
$define up2      'b'01001 /** 'h'09 **/
$define dn2      'b'00110 /** 'h'06 **/
$define open3    'b'10011 /** 'h'13 **/
$define close3   'b'00011 /** 'h'03 **/
$define dn3      'b'00111 /** 'h'07 **/


sequence control{


present open1:
        if l2call # l3call next up1;
        default next close1;


present close1:
        if l2call # l3call next up1;
        if l1call next open1;
        default next close1;


present up1:
        if arr2 & !l2call next up2;
        if arr2 &  l2call next open2u;
        default next up1;


present open2u:
        if l3call next up2;
        default next close2u;


present open2d:
        if l1call next dn2;
        default next close2d;


present close2u:
        if l3call next up2;
        if l2call next open2u;
        default next close2d;


present close2d:
        if l1call next dn2;
        if l2call next open2d;
        default next close2u;


present up2:
        if arr3 next open3;
        default next up2;


present dn2:
        if arr1 next open1;
        default next dn2;


present open3:
        if l1call # l2call next dn3;
        default next close3;


present close3:
        if l1call # l2call next dn3;
        if l3call next open3;
        default next close3;


present dn3:
        if arr2 & !l2call next dn2;
        if arr2 &  l2call next open2d;
        default next dn3;


}

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
7
关闭 站长推荐上一条 /3 下一条