/*=======================================================================*/ /*IMLIG,1998.01.07,timer8.sfl,timer example (source PARTHENON WWW page) */ /*=======================================================================*/ /*-----------------------------------------------------------------------*/ /*interface declaration of 8-bit decrementor dec8 (submodule) */ /*-----------------------------------------------------------------------*/ declare dec8 { input in<8>; output out<8>; instrin do; instr_arg do(in); }/*dec8*/ /*-----------------------------------------------------------------------*/ /*circuit definition of 8-bit decrementor dec8 */ /*-----------------------------------------------------------------------*/ circuit dec8 { input in<8>; output out<8>; instrin do; instruct do out= in+ 0xff; /*two's complement: in-0x01= in+^0x01+1*/ }/*dec8*/ /*-----------------------------------------------------------------------*/ /*module definition of timer8 (top module) */ /*-----------------------------------------------------------------------*/ module timer8{ /*-----------------------------*/ /*facility declaration (F1..F4)*/ /*-----------------------------*/ /*I/O facilities (F1)*/ instrin SET, RESET; input INIT<8>; instrout EXPIRE, ENABLE; output COUNT<8>; /*internal facilities (F2)*/ reg REMAINED<8>; dec8 DEC; /*argument binding (F3)*/ instr_arg ENABLE(COUNT); /*state-machines (F4)*/ stage_name MAIN { task RUN(REMAINED); } /*----------------------------*/ /*behavior definition (B1..B3)*/ /*----------------------------*/ /*core behavior (B1)*/ par { ; /*empty statement*/ } /*control related behavior (B2)*/ instruct SET par { generate MAIN.RUN(INIT); } /*state-machine behavior (B3)*/ stage MAIN { state_name DOWN, ASSERT; first_state DOWN; /*core behavior (B3.1)*/ if (^RESET) par { ENABLE(REMAINED); } /*state behavior (B3.2)*/ state DOWN any { RESET | SET : finish; else : par { REMAINED:= DEC.do(REMAINED).out; if(DEC.out== 0x00) goto ASSERT; } }/*DOWN*/ state ASSERT any { RESET | SET : par { goto DOWN; finish; } else : EXPIRE(); }/*ASSERT*/ }/*MAIN*/ }/*timer8/