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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1688|回复: 0

[讨论] VHDL思路。。大家有什么好想法!!

[复制链接]
发表于 2015-6-1 22:17:15 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 BYbread 于 2015-6-1 22:22 编辑

我现在要做一个低通,高通可切换的滤波器,用FPGA控制电子开关来选择滤波器的电阻网络。滤波器将1k-20kHz等分成20个截止频率的电阻网络(5个电子开关,每个电子开关有四个电阻网络),用按键选择,按键包括选择切换、确定和返回。我想做一个两级菜单,并定义了一个枚举类型,用状态机做出了。后来发现有40个状态,太多了。大家有什么好想法!!!
现在用case语句,只列举了5种情况,只有个想法,还没写完。





  1. type state0 is (s00,s01,s10,s11,                       --s00低通        s01高通                s10:40dB        s11:60dB
  2.          s000,s001,s002,s003,s004,                --低通5档
  3.         s010,s011,s012,s013,s014,                --高通5档
  4.          s100,s101,s102,s103,s104,                --40dB 5档   步进10dB
  5.          s110,s111,s112,s113,s114,s115,s116);        --60dB 7档   步进10dB

  6. signal current0:state0;               
  7. signal current1:state0;      --输出的状态

  8. begin
  9.   process (clk,reset) is
  10.   begin
  11.     if reset='0'  then
  12.           current0<=s00;
  13.           current1<=s000;

  14.           keycode<=x"00";
  15.     elsif rising_edge(clk) then
  16.           case current0 is
  17.                                    
  18. when s00=> if sel='0' then current0 <= s01;                --低通->高通
  19. elsif enter='0' then current0 <= s000;        --低通->滤波器选择
  20. elsif back='0' then current0 <= s00;                --返回首层
  21. end if;

  22. when s01=> if sel='0' then current0 <= s10;                --低通->高通
  23. elsif enter='0' then current0 <= s010;        --高通->滤波器选择
  24. elsif back='0' then current0 <= s00;                --返回首层
  25. end if;
  26.                                    
  27. when s10=> if sel='0' then current0 <= s11;                --40dB->60dB                                                                                                elsif enter='0' then current0 <= s100;        --40dB选择
  28. elsif back='0' then current0 <= s00;                --返回首层        
  29. end if;                                   
  30.                
  31. when s11=>if sel='0' then current0 <= s00;                --40dB<-60dB                                                                                                elsif enter='0' then current0 <= s110;        --40dB选择
  32. elsif back='0' then current0 <= s00;                --返回首层        
  33. end if;        
  34.                                    
  35. when s000=> if sel='0' then current0 <= s001;        --低通0->1
  36. elsif enter='0' then current1 <= s000;        --确定低通0
  37.        current0 <= s00;
  38. elsif back='0' then current0 <= s00;        --返回滤波器选择        
  39. end if;                        
  40.                                        
  41. when s001=> if sel='0' then current0 <= s002;        --低通0->1
  42. elsif enter='0' then current1 <= s001;        --确定低通1
  43. elsif back='0' then current0 <= s00;        --返回滤波器选择        
  44. end if;

  45. when s002=> if sel='0' then current0 <= s003;        --低通0->1
  46. elsif enter='0' then current1 <= s002;        --确定低通2
  47. elsif back='0' then current0 <= s00;        --返回滤波器选择        
  48. end if;

  49. when s003=> if sel='0' then current0 <= s004;        --低通0->1
  50. elsif enter='0' then current1 <= s003;        --确定低通3
  51. elsif back='0' then current0 <= s00;        --返回滤波器选择        
  52. end if;

  53. when s004=> if sel='0' then current0 <= s000;        --低通0->1
  54. elsif enter='0' then current1 <= s004;        --确定低通4
  55. elsif back='0' then current0 <= s00;        --返回滤波器选择        
  56. end if;               
  57.                
  58. when others => null;
  59.                                        
  60.           end case ;  

  61.          end if;
  62.         end process;


复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-4-27 21:02 , Processed in 0.020159 second(s), 6 queries , Gzip On, Redis On.

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