⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sf.txt

📁 一个在单片机平台的电梯模拟程序
💻 TXT
字号:

reg [1:0] cur_state,next_state;
reg per_state;//0 stand for up 1 stand for down 
reg [2:0] cur_floor;
reg [5:0] needstop_floor;
reg [5:0] up;
reg [5:0] down;
reg [2:0] i;//foornumber connect to needstop_floor

input up1,up2,up3,up4,up5;
input down2,down3,down4,down5,down6;
input aim1,aim2,aim3,aim4,aim5,aim6;

output up_state,down_state,close,open,ewait,alarm;

begin
if(cur_state==2'b00)//wait_state
   begin
   //if//((up1||up2||up3||up4||up5||down2||down3||down4||down5||down6)&&(needstop_floor>cur_floor))
   if(i>cur_floor)
     cur_state=2'b01;
   else
   if(i<cur_floor)
     cur_state=2'b10; 
   else
     if(up1||up2||up3||up4||up5)
     cur_state=2'b01;
     else 
     if(down2||down3||down4||down5||down6)
     cur_state=2'b10;
     else
     cur_state=cur_state;
   end
else 
if(cur_state==2'b11)//stop_state
   begin
   if(per_state==1'b0//per_state is up
     if(i>cur_floor)
     cur_state=2'b01;
     else
     if(i<cur_floor)
     cur_state=2'b10; 
     else
     cur_state=2'b11;
   else            //per_state is up
     if(i<cur_floor)
     cur_state=2'b10;
     else
     if(i>cur_floor)
     cur_state=2'b01; 
     else
     cur_state=2'b11;
   end
else
   cur_state=cur_state;
end
    
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
      
   
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -