在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2219|回复: 2

[求助] Verilog 程序理解问题 关于状态机

[复制链接]
发表于 2015-4-30 17:23:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

x
程序是用状态机实现16位编码module multiplication(mux,pmux,reset,clk,out,mid,done);

input [15:0]mux,pmux;
    input clk,reset;
    output [31:0]out,mid;
    output done;
    reg [31:0]out,mid;
    reg done;
    integer count;
    reg [1:0]pstate,nstate;
    parameter  idle=2'b00,add=2'b01,shift=2'b10;


    always@(posedge clk)

      if(!reset) begin
                    pstate=idle;

        end
          else  begin
           
    pstate = nstate;

end
    always@(pstate)
begin
             case(pstate)
                 idle:  
                    begin
                        out=0;
                        done=0;
                        count=0;
                        mid[15:0]=mux;
                        mid[31:16]=16'b0;
                        nstate=add;
                     end
                add:
                     begin
                          if(pmux[count])
                                 out=out+mid;
                                 nstate=shift;////////////这里
                     end
                  shift:
                     begin
                         count=count+1;
                         mid={mid[30:0],1'b0};
                          if(count==16)
                                begin
                                   nstate=idle;
                                   done=1;
                               end
                        else
                               nstate=add;
                    end
                 default:
                      nstate=idle;
          endcase
end
endmodule

想请教一下,当红色if语句不满足时,状态是否转移?程序怎么继续下去
发表于 2015-4-30 18:57:52 | 显示全部楼层
你这个if下面没有begin end,只能作用一条语句,无路如何都会跳转啊
 楼主| 发表于 2015-4-30 20:38:06 | 显示全部楼层
回复 2# richardxingxing


   懂了,谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-2-23 12:35 , Processed in 0.029401 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表