以下代码可否在写法上简洁更好维护
时间:10-02
整理:3721RD
点击:
case condition is
when "1"=>
if input=A(1) then
output<=B(1);
else
output<=0;
when "2"=>
if input=A(2) then
output<=B(2);
else
output<=0;
when"3"
到when "98"
也是这规律
when "99"=>
if input=A(999) then
output<=B(99);
else
output<=0;
when others=>
output<=0;
end case;
when "1"=>
if input=A(1) then
output<=B(1);
else
output<=0;
when "2"=>
if input=A(2) then
output<=B(2);
else
output<=0;
when"3"
到when "98"
也是这规律
when "99"=>
if input=A(999) then
output<=B(99);
else
output<=0;
when others=>
output<=0;
end case;
设置variable
用 loop语句
可以使用循环
可否用代码表示一下,谢谢.
一,你的case条件有规律吗?如是个counter?
二,你的case条件和输入A有关系吗?
三,我不建议使用循环,综合出来的网表很难debug
四,建议不要写这么大分支的case语句,频率上不去
一,你的case条件有规律吗?如是个counter?
无规律
二,你的case条件和输入A有关系吗?
无关系
三,我不建议使用循环,综合出来的网表很难debug
那如何写代码,易读并好维护,
如果象我发贴的那种写法,拷贝来拷贝去,显得苯拙,且易错.
四,建议不要写这么大分支的case语句,频率上不去/
我只是用0到99来强调这个情况,实际上用不到这么多分支.
求伪码.谢谢.
