打印
[VHDL]

求助:关于modelsim下仿真出错

[复制链接]
1144|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
nm2012|  楼主 | 2013-10-17 00:57 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

报的错1g.vhd(9): near "select": expecting FUNCTION or PROCEDURE or IMPURE or PURE
上面这个是原题,然后我写的代码在下面,求各位大神施与援手啊,先谢谢了
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity g1 is
  port(
    clk: in std_logic;
    select: in std_logic_vector(1 downto 0);
    clkout: out std_logic
  );
end entity g1;

architecture g1_1 of g1 is
  signal state: std_logic_vector(20 downto 0);
begin
  statep:process(clk) is
  begin
    if clk'event and clk='1' then
      case select is
      when "10"=>
        if state<="00000000000000000011" then
          state<=state+"00000000000000000001";
        else
          state<="00000000000000000000";
        end if;
      when "11"=>
        if state<="00000000000000110001" then
          state<=state+"00000000000000000001";
        else
          state<="00000000000000000000";
        end if;
      when "01"=>
        if state<="00000000001111100111" then
          state<=state+"00000000000000000001";
        else
          state<="00000000000000000000";
        end if;
      when "00"=>
        if state<="11110100001000111111" then
          state<=state+"00000000000000000001";
        else
          state<="00000000000000000000";
        end if;
      end case;
    end if;
  end process;

  clkoutp:process(state,select) is
  begin
    case select is
    when "10"=>
      if state<="00000000000000000001" then
        clkout<='1';
      else
        clkout<='0';
      end if;
    when "11"=>
      if state<="00000000000000011000" then
        clkout<='1';
      else
        clkout<='0';
      end if;
    when "01"=>
      if state<="00000000000000010011" then
        clkout<='1';
      else
        clkout<='0';
      end if;
    when "00"=>
      if state="00000000000000000000" then
        clkout<='1';
      else
        clkout<='0';
      end if;
    end case;
  end process;
end architecture g1_1;





相关帖子

沙发
nm2012|  楼主 | 2013-10-17 01:29 | 只看该作者
好吧,知道哪错了,居然有些单词不能用来设变量名,select后面加一个t,瞬间通过。。。这是为什么啊

使用特权

评论回复
板凳
ococ| | 2013-10-17 08:48 | 只看该作者
select是VHDL的保留字,跟 signal 这个单词一样,已经有定义了。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

48

主题

212

帖子

0

粉丝