博客首页 | 排行榜 |

XuWenbo的博客

个人档案
博文分类
状态机的写法  2008-03-22 22:33
状态机要写成3段式的(这是最标准的写法),即
         ……
        //build the state flops  
always @(posedge clk or negedge rst_n)          
         ……
             current_state <= next_state;
         ……
//state machine
         always @ (current_state or ...)
         ……
         case(current_state)
               ……
               S1:
                  if ...
                    next_state = S2;
               ……
         ……
        //outputs logic block
always @(current_state  or …)
            //default value
                a  =  1’b0;
                b  =  1’b0;
                c  =  1’b0;
                ……
               case(current_state)
                     S1:
                         a  =  1'b0;  
                     S2:
                         b  = 1'b1;
                     S3:
                         c  = 1'b1;
                     default:
                     ……
              endcase
              ……
类别:学习 |
上一篇:multicast的原理和应用 | 下一篇:RAM等相关知识
以下网友评论只代表其个人观点,不代表本网站的观点或立场