怎样理解下面的if嵌套语句

2020-01-27 13:28发布

本帖最后由 sunboy25 于 2018-7-11 16:21 编辑

process(q(14))
        begin
                if(q(14)'event and q(14)='1') then
                        if second<"111011" then
                                second <= second+1;
                        else
                                second <="000000";
                                if minl < "1001" then
                                        minl <= minl+1;
                                else
                                        minl <= "0000";
                                        if minh < "101" then
                                                minh <= minh+1;
                                        else
                                                minh <="000";
                                                if hourh <"10" then
                                                        if hourl < "1001" then
                                                                hourl <= hourl+1;
                                                        else
                                                                hourl <= "0000";
                                                                hourh <= hourh+1;
                                                        end if;
                                                else if hourh = "10" then
                                                                if hourl <"0011" then
                                                                        hourl <= hourl+1;
                                                                else
                                                              hourl <= "0000";
                                                                        hourh <= "00";
                                                                end if;
                                                        end if;
                                                end if;
                                        end if;
                                end if;
                        end if;
                end if;
        end process;
我想问一下怎样理解上面的if嵌套语句,后面结尾end if需要多少个,是怎样来的,有谁对这样的嵌套语句有好的理解方式的请不吝赐教?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
3条回答
ucx
1楼-- · 2020-01-27 16:12
任何一个if都要有一个end if和其配对。然后这种写法不仅可读性差,而且生成的电路逻辑延时较大。在QUARTUS的早期软件,明确建议在else中不再嵌套if。
sunboy25
2楼-- · 2020-01-27 21:08
谢谢高手指教!
liyang950813
3楼-- · 2020-01-27 21:33
 精彩回答 2  元偷偷看……

一周热门 更多>