运行代码时出现语法错误

时间:2017-07-05 19:17:07

标签: vhdl xilinx-ise

错误在第431,451,452和455行中。

错误: - 第431行。选择.to。不是静态表达式。  第451行.Choice +不是静态表达式。  第452行。选择+不是静态表达式。  第455行。选择time_period_counter不是静态表达式。

我附加的代码很长,但逻辑非常简单。它是关于switch case的语法。

请帮助!!

----------------------------------------------------------------------------------
-- Company: IIST
-- Engineer: Leen Roque Robin
-- 
-- Create Date:    23:14:17 06/22/2017 
-- Design Name: 
-- Module Name:    data - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description:     To create the corresponding output data as per the command received from the command_interface module
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity data_output is
    Port (  --Input signals
               Por              : in std_logic;
               sys_clk          : in std_logic; 
               start_bit        : in std_logic;
               mode_bit1        : in std_logic_vector(2 downto 0);
               mode_bit2        : in std_logic_vector(2 downto 0);
               mode_bit3        : in std_logic_vector(2 downto 0);
               input_data       : in std_logic_vector(7 downto 0);
                card_id         : in std_logic_vector(7 downto 0);

            --Output signals  
                clk             : out std_logic;
               pkt_start        : out std_logic;   
               dataws           : out std_logic;
               data             : out std_logic_vector(15 downto 0)
--             random_flag      :out std_logic
           );           
end data_output;

architecture Behavioral of data_output is
signal count                :   integer:=0;
signal time_period_counter  :   integer:=0;
signal window_counter       :   integer:=0;

constant data_AA55          :   std_logic_vector(15 downto 0):=x"AA55";
constant data_5555          :   std_logic_vector(15 downto 0):=x"5555";

constant word_1             :   std_logic_vector(15 downto 0):=x"F8DD";
constant word_2             :   std_logic_vector(15 downto 0):=x"4259";
signal word_3               :   std_logic_vector(15 downto 0);
constant word_4             :   std_logic_vector(15 downto 0):=x"5231";
signal word_5               :   std_logic_vector(15 downto 0);
signal word_6               :   std_logic_vector(15 downto 0);
signal word_7               :   std_logic_vector(15 downto 0);
signal word_8               :   std_logic_vector(15 downto 0):=x"F8DD";
signal word_9               :   std_logic_vector(15 downto 0):=x"F8DD";
signal word_10              :   std_logic_vector(15 downto 0):=x"F8DD";

constant word_11                :   std_logic_vector(15 downto 0):=x"00AA";
constant word_12                :   std_logic_vector(15 downto 0):=x"00AB";
constant word_13                :   std_logic_vector(15 downto 0):=x"00AC";
constant word_14                :   std_logic_vector(15 downto 0):=x"00AD";
constant word_15                :   std_logic_vector(15 downto 0):=x"00AE";
constant word_16                :   std_logic_vector(15 downto 0):=x"00AF";
constant word_17                :   std_logic_vector(15 downto 0):=x"00BA";
constant word_18                :   std_logic_vector(15 downto 0):=x"00BB";
constant word_19                :   std_logic_vector(15 downto 0):=x"00BC";
constant word_20                :   std_logic_vector(15 downto 0):=x"00BD";
constant word_21                :   std_logic_vector(15 downto 0):=x"00BE";
constant word_22                :   std_logic_vector(15 downto 0):=x"00BF";
constant word_23                :   std_logic_vector(15 downto 0):=x"00CA";
constant word_24                :   std_logic_vector(15 downto 0):=x"00CB";
constant word_25                :   std_logic_vector(15 downto 0):=x"00CC";
constant word_26                :   std_logic_vector(15 downto 0):=x"00CD";
constant word_27                :   std_logic_vector(15 downto 0):=x"00CE";
constant word_28                :   std_logic_vector(15 downto 0):=x"00CF";
constant word_29                :   std_logic_vector(15 downto 0):=x"00DA";
constant word_30                :   std_logic_vector(15 downto 0):=x"00DB";
constant word_31                :   std_logic_vector(15 downto 0):=x"00DC";
constant word_32                :   std_logic_vector(15 downto 0):=x"00DD";
constant word_33                :   std_logic_vector(15 downto 0):=x"00DE";
constant word_34                :   std_logic_vector(15 downto 0):=x"00DF";
constant word_35                :   std_logic_vector(15 downto 0):=x"00EA";
constant word_36                :   std_logic_vector(15 downto 0):=x"00EB";
constant word_37                :   std_logic_vector(15 downto 0):=x"00EC";
constant word_38                :   std_logic_vector(15 downto 0):=x"00ED";
constant word_39                :   std_logic_vector(15 downto 0):=x"00EE";
constant word_40                :   std_logic_vector(15 downto 0):=x"00EF";
constant word_41                :   std_logic_vector(15 downto 0):=x"00FA";
constant word_42                :   std_logic_vector(15 downto 0):=x"00FB";
constant word_43                :   std_logic_vector(15 downto 0):=x"00FC";
constant word_44                :   std_logic_vector(15 downto 0):=x"00FD";
constant word_45                :   std_logic_vector(15 downto 0):=x"00FE";
constant word_46                :   std_logic_vector(15 downto 0):=x"00FF";
constant word_47                :   std_logic_vector(15 downto 0):=x"01AA";
constant word_48                :   std_logic_vector(15 downto 0):=x"01AB";
constant word_49                :   std_logic_vector(15 downto 0):=x"01AC";
constant word_50                :   std_logic_vector(15 downto 0):=x"01AD";
constant word_51                :   std_logic_vector(15 downto 0):=x"01AE";
constant word_52                :   std_logic_vector(15 downto 0):=x"01AF";
constant word_53                :   std_logic_vector(15 downto 0):=x"01BA";
constant word_54                :   std_logic_vector(15 downto 0):=x"01BB";
constant word_55                :   std_logic_vector(15 downto 0):=x"01BC";
constant word_56                :   std_logic_vector(15 downto 0):=x"01BD";
constant word_57                :   std_logic_vector(15 downto 0):=x"01BE";
constant word_58                :   std_logic_vector(15 downto 0):=x"01BF";
constant word_59                :   std_logic_vector(15 downto 0):=x"01CA";
constant word_60                :   std_logic_vector(15 downto 0):=x"01CB";
constant word_61                :   std_logic_vector(15 downto 0):=x"01CC";
constant word_62                :   std_logic_vector(15 downto 0):=x"01CD";
constant word_63                :   std_logic_vector(15 downto 0):=x"01CE";
constant word_64                :   std_logic_vector(15 downto 0):=x"01CF";
constant word_65                :   std_logic_vector(15 downto 0):=x"01DA";
constant word_66                :   std_logic_vector(15 downto 0):=x"01DB";
constant word_67                :   std_logic_vector(15 downto 0):=x"01DC";
constant word_68                :   std_logic_vector(15 downto 0):=x"01DD";
constant word_69                :   std_logic_vector(15 downto 0):=x"01DE";
constant word_70                :   std_logic_vector(15 downto 0):=x"01DF";
constant word_71                :   std_logic_vector(15 downto 0):=x"01EA";
constant word_trailer               :   std_logic_vector(15 downto 0):=x"01FF";


signal word_6_7             :   std_logic_vector(31 downto 0);
signal word_8_9             :   std_logic_vector(31 downto 0);




--prf values
signal prf1_value           :   integer:=10417;
signal prf2_value           :   integer:=11161;
signal prf3_value           :   integer:=5581;
signal prf4_value           :   integer:=11161;
--window values
--window for prf1
signal prf1_width1          :   integer:=2816;
signal prf1_width2          :   integer:=3129;
signal prf1_width3          :   integer:=3441;
signal prf1_width4          :   integer:=3754;

--window for prf2
signal prf2_width1          :   integer:=1563;
signal prf2_width2          :   integer:=2813;
signal prf2_width3          :   integer:=4063;
signal prf2_width4          :   integer:=5313;

--window for prf3
signal prf3_width1          :   integer:=1094;
signal prf3_width2          :   integer:=1719;
signal prf3_width3          :   integer:=2344;
signal prf3_width4          :   integer:=2969;

--window for prf4
signal prf4_width1          :   integer:=1094;
signal prf4_width2          :   integer:=1719;
signal prf4_width3          :   integer:=2344;
signal prf4_width4          :   integer:=2969;

signal sample_data          :   std_logic_vector(15 downto 0);
signal test_sample          :   std_logic_vector(7 downto 0);
signal random_flag          :   std_logic;
signal data_in                  :  std_logic_vector(15 downto 0);   
signal counter                  :  std_logic_vector(15 downto 0);   

--Random Sequence generation
Component random_data_generator
Port(--Input signals
        por             :   in std_logic;
        sys_clk         :   in std_logic;
        random_flag     :   in std_logic;
        --Output signals
        random_data     :   out std_logic_vector(15 downto 0)

);
end component;

begin

A:  random_data_generator port map (por,sys_clk,random_flag,data_in);

    process(por,sys_clk)
    begin
    if(por='0') then
        time_period_counter     <= 0;
        window_counter          <= 0;

        word_3                      <=  (others=>'0');
        word_5                      <=  (others=>'0');
        word_6_7                        <= (others=>'0');
        word_8_9                        <= (others=>'0');       
--      word_6                      <=  (others=>'0');
--      word_7                      <=  (others=>'0');
--      word_8                      <= (others=>'0');
--      word_9                      <=  (others=>'0');
        word_10                     <=  (others=>'0');

    elsif(falling_edge(sys_clk)) then
    --Finding word 3
    case card_id is
        when x"01"  =>  word_3  <=  x"F0F0";
        when x"02"  =>  word_3  <=  x"F00F";
        when x"03"  =>  word_3  <=  x"0FF0";
        when x"04"  =>  word_3  <=  x"0F0F";
        when others => word_3   <= x"0000";
    end case;
    --Finding word 10
    if(mode_bit3 = "011") then
        word_10(10 downto 8)    <=  "111";
    end if;
    if(mode_bit1 = "000") then
        word_10(3 downto 0) <=  "0000";
    elsif(mode_bit1 = "001") then
        word_10(3 downto 0) <=  "0001";
    elsif(mode_bit1 = "010") then
        word_10(3 downto 0) <=  "0010";
    elsif(mode_bit1 = "011") then
        word_10(3 downto 0) <=  "0011";
    end if;

    --Checking PRF
    case mode_bit1 is
        when "000"  =>  time_period_counter <= prf1_value;
            --Checking receive window
            case mode_bit2 is
                when "000"  => window_counter <= prf1_width1;
                when "001"  => window_counter <= prf1_width2;
                when "010"  => window_counter <= prf1_width3;
                when "011"  => window_counter <= prf1_width4;
                when others => window_counter <= prf1_width1;
            end case;

        when "001"  =>  time_period_counter <= prf2_value;
            case mode_bit2 is
                when "000"  => window_counter <= prf2_width1;
                when "001"  => window_counter <= prf2_width2;
                when "010"  => window_counter <= prf2_width3;
                when "011"  => window_counter <= prf2_width4;
                when others => window_counter <= prf2_width1;
            end case;

        when "010"  =>  time_period_counter <= prf3_value;
            case mode_bit2 is
                when "000"  => window_counter <= prf3_width1;
                when "001"  => window_counter <= prf3_width2;
                when "010"  => window_counter <= prf3_width3;
                when "011"  => window_counter <= prf3_width4;
                when others => window_counter <= prf3_width1;
            end case;

        when "011"  =>  time_period_counter <= prf4_value;
            case mode_bit2 is
                when "000"  => window_counter <= prf4_width1;
                when "001"  => window_counter <= prf4_width2;
                when "010"  => window_counter <= prf4_width3;
                when "011"  => window_counter <= prf4_width4;
                when others => window_counter <= prf4_width1;
            end case;
        when others =>  time_period_counter <=  prf1_value;
                        window_counter      <=  0;
        end case;
    end if;

    if(por='0') then
        test_sample     <= (others=>'0');
        sample_data     <= (others=>'0');
        pkt_start       <=  '0';
        dataws          <=  '0';
        count               <=  0;
        counter         <=  x"0000";
    elsif(falling_edge(sys_clk)) then

    if(start_bit='1') then
        count   <=  count+1;
        case count is
            when 1 to 2 =>  pkt_start   <=  '1';
                                dataws      <=  '0';
            when 3  =>  pkt_start   <=  '0';
                            dataws      <=  '0';
            when 4  =>  dataws      <=  '1';
                            word_5      <=  word_5+'1';
                            word_6_7        <=  word_6_7+'1';
                            word_8_9        <=  word_8_9+'1';                           
                            sample_data <= word_1;
            when 5  =>  dataws      <=  '1';
                            sample_data <= word_2;
            when 6  =>  dataws      <=  '1';
                            sample_data <= word_3;
            when 7  =>  dataws      <=  '1';
                            sample_data <= word_4;
            when 8  =>  dataws      <=  '1';
                            sample_data <= word_5;
            when 9  =>  dataws      <=  '1';
                            sample_data <= word_6_7(31 downto 16);
            when 10 =>  dataws      <=  '1';
                            sample_data <= word_6_7(15 downto 0);
            when 11 =>  dataws      <=  '1';
                            sample_data <= word_8_9(31 downto 16);
            when 12 =>  dataws      <=  '1';
                            sample_data <= word_8_9(15 downto 0);
            when 13 =>  dataws      <=  '1';
                            sample_data <= word_10;
            when 14 =>  dataws      <=  '1';
                            sample_data <= word_11;
            when 15 =>  dataws      <=  '1';
                            sample_data <= word_12;
            when 16 =>  dataws      <=  '1';
                            sample_data <= word_13;
            when 17 =>  dataws      <=  '1';
                            sample_data <= word_14;
            when 18 =>  dataws      <=  '1';
                            sample_data <= word_15;
            when 19 =>  dataws      <=  '1';
                            sample_data <= word_16;
            when 20 =>  dataws      <=  '1';
                            sample_data <= word_17;
            when 21 =>  dataws      <=  '1';
                            sample_data <= word_18;
            when 22 =>  dataws      <=  '1';
                            sample_data <= word_19;
            when 23 =>  dataws      <=  '1';
                            sample_data <= word_20;
            when 24 =>  dataws      <=  '1';
                            sample_data <= word_21;
            when 25 =>  dataws      <=  '1';
                            sample_data <= word_22;
            when 26 =>  dataws      <=  '1';
                            sample_data <= word_23;
            when 27 =>  dataws      <=  '1';
                            sample_data <= word_24;
            when 28 =>  dataws      <=  '1';
                            sample_data <= word_25;
            when 29 =>  dataws      <=  '1';
                            sample_data <= word_26;
            when 30 =>  dataws      <=  '1';
                            sample_data <= word_27;
            when 31 =>  dataws      <=  '1';
                            sample_data <= word_28;
            when 32 =>  dataws      <=  '1';
                            sample_data <= word_29;
            when 33 =>  dataws      <=  '1';
                            sample_data <= word_30;
            when 34 =>  dataws      <=  '1';
                            sample_data <= word_31;
            when 35 =>  dataws      <=  '1';
                            sample_data <= word_32;
            when 36 =>  dataws      <=  '1';
                            sample_data <= word_33;
            when 37 =>  dataws      <=  '1';
                            sample_data <= word_34;
            when 38 =>  dataws      <=  '1';
                            sample_data <= word_35;
            when 39 =>  dataws      <=  '1';
                            sample_data <= word_36;
            when 40 =>  dataws      <=  '1';
                            sample_data <= word_37;
            when 41 =>  dataws      <=  '1';
                            sample_data <= word_38;
            when 42 =>  dataws      <=  '1';
                            sample_data <= word_39;
            when 43 =>  dataws      <=  '1';
                            sample_data <= word_40;
            when 44 =>  dataws      <=  '1';
                            sample_data <= word_41;
            when 45 =>  dataws      <=  '1';
                            sample_data <= word_42;
            when 46 =>  dataws      <=  '1';
                            sample_data <= word_43;
            when 47 =>  dataws      <=  '1';
                            sample_data <= word_44;
            when 48 =>  dataws      <=  '1';
                            sample_data <= word_45;
            when 49 =>  dataws      <=  '1';
                            sample_data <= word_46;
            when 50 =>  dataws      <=  '1';
                            sample_data <= word_47;
            when 51 =>  dataws      <=  '1';
                            sample_data <= word_48;
            when 52 =>  dataws      <=  '1';
                            sample_data <= word_49;
            when 53 =>  dataws      <=  '1';
                            sample_data <= word_50;
            when 54 =>  dataws      <=  '1';
                            sample_data <= word_51;
            when 55 =>  dataws      <=  '1';
                            sample_data <= word_52;
            when 56 =>  dataws      <=  '1';
                            sample_data <= word_53;
            when 57 =>  dataws      <=  '1';
                            sample_data <= word_54;
            when 58 =>  dataws      <=  '1';
                            sample_data <= word_55;
            when 59 =>  dataws      <=  '1';
                            sample_data <= word_56;
            when 60 =>  dataws      <=  '1';
                            sample_data <= word_57;
            when 61 =>  dataws      <=  '1';
                            sample_data <= word_58;
            when 62 =>  dataws      <=  '1';
                            sample_data <= word_59;
            when 63 =>  dataws      <=  '1';
                            sample_data <= word_60;
            when 64 =>  dataws      <=  '1';
                            sample_data <= word_61;
            when 65 =>  dataws      <=  '1';
                            sample_data <= word_62;
            when 66 =>  dataws      <=  '1';
                            sample_data <= word_63;
            when 67 =>  dataws      <=  '1';
                            sample_data <= word_64;
            when 68 =>  dataws      <=  '1';
                            sample_data <= word_65;
            when 69 =>  dataws      <=  '1';
                            sample_data <= word_66;
            when 70 =>  dataws      <=  '1';
                            sample_data <= word_67;
            when 71 =>  dataws      <=  '1';
                            sample_data <= word_68;
            when 72 =>  dataws      <=  '1';
                            sample_data <= word_69;
            when 73 =>  dataws      <=  '1';
                            sample_data <= word_70;
            when 74 =>  dataws      <=  '1';
                            sample_data <= word_71;

            when 75 to window_counter+3 =>  dataws      <=  '1';
                                                        case mode_bit3 is
                                                            --Upcounter
                                                            when "000"  =>  counter     <=  counter +'1';
                                                                                sample_data <=  counter;
                                                            --Downcounter
                                                            when "001"  =>  counter     <=  counter -'1';
                                                                                sample_data <=  counter;
                                                            --Constant AA55
                                                            when "010"  =>  sample_data <=  data_AA55;
                                                            --Stretch Mode
                                                            when "011"  =>  test_sample <=  test_sample +'1';
                                                                                sample_data <=  test_sample & test_sample;
                                                            --Fixed Mode
                                                            when "100"  =>  sample_data <=  input_data & input_data;
                                                            --Random Sequence
                                                            when "111"  =>  random_flag <=  '1';
                                                                                sample_data <=  data_in;
                                                            when others =>  sample_data <=  (others=>'0');
                                                        end case;
            when window_counter+4       =>  sample_data <=  word_trailer;
            when window_counter+5   =>  dataws      <=  '0';
                                                random_flag <=  '0';
                                                sample_data <=  (others=>'0');
            when time_period_counter    => count            <=   0;
            when others                     =>  dataws      <= '0';
                                                    sample_data <=  (others=>'0');  
        end case;                                                                           

        end if;
end if;     





--  --Upcounter
--          if(start_bit='1' and mode_bit3="000") then 
--          count       <=  count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws      <=  '1';
--              sample_data <= sample_data +'1';
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              sample_data <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;
--      
--  --Downcounter
--      if(start_bit='1' and mode_bit3="001") then 
--          count       <=  count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws      <=  '1';
--              sample_data <= sample_data -'1';
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              sample_data <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;
--  
--  --AA55
--      if(start_bit='1' and mode_bit3="010") then 
--          count   <=  count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws      <=  '1';
--              sample_data <=  data_AA55;
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              sample_data <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;
--      
--  --Stretch mode
--      if(start_bit='1' and mode_bit3="011") then 
--          count<=count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws      <=  '1';
--              test_sample <=  test_sample +'1';
--              sample_data <=  test_sample & test_sample;
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              sample_data <= (others=>'0');
--              test_sample <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;
--      
--      --Fixed mode
--      if(start_bit='1' and mode_bit3="100") then 
--          count<=count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws      <=  '1';
--              sample_data <=  input_data & input_data;
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              sample_data <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;
--      
--      --Random sequence generator
--      if(start_bit='1' and mode_bit3="111") then
--          count<=count+1;
--          if(count=1) then
--              pkt_start   <=  '1';
--              dataws      <=  '0';
--          elsif(count=3) then
--              pkt_start   <=  '0';
--          elsif(count>=3 and count<(window_counter+4)) then
--              dataws          <=  '1';
--              random_flag     <=  '1';
--              sample_data     <=  data_in;
--          elsif(count=(window_counter+4)) then
--              dataws      <=  '0';
--              random_flag <=  '0';
--              sample_data <= (others=>'0');
--          elsif(count=time_period_counter) then
--              count       <=  0;
--          end if;
--      end if;

--  end if;     


end process;   
data    <=  sample_data;
end Behavioral;

1 个答案:

答案 0 :(得分:0)

在VHDL中,您不能像使用的那样在case语句中使用变量作为选择。它必须是静态表达式,例如"001"34,而不是像time_period_counter那样的信号。