搜索
bottom↓
回复: 7

【求助】state machine 里的condition看不太明白

[复制链接]

出0入0汤圆

发表于 2012-11-27 11:47:20 | 显示全部楼层 |阅读模式
(!current_state).(!current_state).(current_state).(!stb).(always1)
+ (!current_state).(current_state).(!current_state).(!current_state).(!current_state).(!delay_counter[0])
+ (!current_state).(current_state).(!current_state).(!current_state).(!current_state).(delay_counter[0]).(delay_counter[1])
+ (!current_state).(current_state).(!current_state).(!current_state).(current_state).(!delay_counter[0])
+ (!current_state).(current_state).(!current_state).(!current_state).(current_state).(delay_counter[0]).(!delay_counter[1]).(!stb)
+ (!current_state).(current_state).(!current_state).(!current_state).(current_state).(delay_counter[0]).(!delay_counter[1]).(stb).(!ep6_ff)
+ (!current_state).(current_state).(!current_state).(!current_state).(current_state).(delay_counter[0]).(delay_counter[1])
+ (!current_state).(current_state).(!current_state).(current_state)
+ (!current_state).(current_state).(current_state).(!current_state).(!current_state).(!delay_counter[0])
+ (!current_state).(current_state).(current_state).(!current_state).(!current_state).(delay_counter[0]).(!delay_counter[1]).(stb)
+ (!current_state).(current_state).(current_state).(!current_state).(!current_state).(delay_counter[0]).(delay_counter[1])
+ (!current_state).(current_state).(current_state).(!current_state).(current_state)
+ (!current_state).(current_state).(current_state).(current_state)
+ (current_state).(!current_state).(current_state).(!stb).(always1)
+ (current_state).(current_state)


阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

 楼主| 发表于 2012-11-27 11:48:03 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2012-11-27 16:50:35 | 显示全部楼层
  1.             case(current_state)
  2.                 S0: //idle
  3.                 begin
  4.                         pktend <= 1'B1;
  5.                     fd_oe <= 1'B0;
  6.                     sloe <= 1'B1;
  7.                     slrd <= 1'B1;
  8.                     slwr <= 1'B1;
  9.                     delay_counter <= 2'd0;
  10.                   //  timer_start <= 1'B1;
  11.                                 if (stb == 1'B1)     // FPGA send ask
  12.                     begin
  13.                         if (ep6_ff == 1'B1)   //EP6IN
  14.                         begin
  15.                                         fifoaddr <= 2'B10;
  16.                             next_state <= S1;
  17.                         end
  18.                         end
  19.                     //else if (ep2_ef==1'B1 && timer_ov==1'B1)  //EP2OUT
  20.                                         else if (ep2_ef==1'B1 )  //EP2OUT
  21.                     begin //接收
  22.                                 fifoaddr <= 2'B00;
  23.                         next_state <= S4;
  24.                     end
  25.                         end

  26.                 //write
  27.                 //////////////////////////////////////////////////////////////-
  28.                 S1: //写FIFO发送数据               
  29.                 begin
  30.                     sloe <= 1'B0;
  31.                     slwr <= 1'B0;
  32.                     fd_oe <= 1'B1;
  33.                     fd_o <= dat_i;
  34.                     if (delay_counter == 2'd1)
  35.                     begin
  36.                         delay_counter <= 2'd0;
  37.                         next_state <= S2;
  38.                     end
  39.                     else
  40.                         delay_counter <= delay_counter+1'B1;
  41.                         end
  42.                 S2: //slrd active 40ns
  43.                 begin
  44.                     sloe <= 1'B1;
  45.                     slwr <= 1'B1;
  46.                     if (delay_counter == 2'd2)
  47.                     begin
  48.                         delay_counter <= 2'd0;
  49.                         ack <= 1'B1;       // usb receive response
  50.                         pktend <= 1'B0;
  51.                         next_state <= S3;
  52.                     end
  53.                     else
  54.                         delay_counter <= delay_counter+1'B1;
  55.                         end
  56.                 S3:
  57.                 begin
  58.                     if (stb == 1'B0)
  59.                     begin
  60.                         ack <= 1'B0;
  61.                         next_state <= S0;
  62.                     end
  63.                         end

  64.                 //read
  65.                 //////////////////////////////////////////////////////////////-
  66.                 S4:
  67.                 begin
  68.                     sloe <= 1'B0;
  69.                     slrd <= 1'B0;
  70.                     fd_oe <= 1'B0;
  71.                     if (delay_counter == 2'd1)
  72.                     begin
  73.                         delay_counter <= 2'd0;
  74.                         dat_o <= fd_i;
  75.                         ntf <= 1'B1;           //usb send ask         
  76.                         next_state <= S5;
  77.                     end
  78.                     else
  79.                         delay_counter <= delay_counter+1'B1;
  80.                         end
  81.                 S5:
  82.                 begin
  83.                     slrd <= 1'B1;
  84.                     sloe <= 1'B1;
  85.                     if (delay_counter == 2'd2)
  86.                     begin
  87.                         if (nck == 1'B1)   //FPGA receive response
  88.                         begin
  89.                             ntf <= 1'B0;
  90.                             delay_counter <= 2'd0;
  91.                             next_state <= S0;
  92.                         end
  93.                     end
  94.                     else
  95.                         delay_counter <= delay_counter+1'B1;
  96.                         end
  97.                 default:
  98.                     next_state <= S0;
  99.             endcase
复制代码

出0入0汤圆

 楼主| 发表于 2012-11-27 16:51:39 | 显示全部楼层
就是这个状态机 一直在s4和s5之间循环。s5怎么会跳到s4 呢?想不通!

出0入0汤圆

 楼主| 发表于 2012-11-27 16:58:11 | 显示全部楼层
之前贴出来的那个condition就是s5转到s4的

出0入0汤圆

发表于 2012-11-27 18:27:33 | 显示全部楼层
simpleh 发表于 2012-11-27 16:51
就是这个状态机 一直在s4和s5之间循环。s5怎么会跳到s4 呢?想不通!

先跳到S1再跳到S4

出0入0汤圆

 楼主| 发表于 2012-11-29 10:17:53 | 显示全部楼层
浮云残雪 发表于 2012-11-27 18:27
先跳到S1再跳到S4

我本来是S0-S4-S5-S0-S1-S2-S3-S0这个顺序,可是仿真的时候就是从S5跳到S4。。就卡住了

出0入0汤圆

发表于 2012-12-1 09:34:12 | 显示全部楼层
simpleh 发表于 2012-11-29 10:17
我本来是S0-S4-S5-S0-S1-S2-S3-S0这个顺序,可是仿真的时候就是从S5跳到S4。。就卡住了 ...

不了解了。我抽空再详细看看。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-27 09:01

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表