Need your help!!!!!!!!!!!!!!!!!!!!!!!

Status
Not open for further replies.

lchtan

Newbie level 3
Joined
Jul 5, 2007
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,335
I'm encountering some difficulties in my programming VHDL, the system(Quartus II Version6.1) points there're syntax error in my code, but I don't know where is the mistakes. Please help me ,thanks!!!!!

Error (10500): VHDL syntax error at test.vhd(29) near text "<="; expecting "then"
Error (10500): VHDL syntax error at test.vhd(36) near text "<="; expecting "then"
Error (10500): VHDL syntax error at test.vhd(43) near text "<="; expecting "then"
Error (10500): VHDL syntax error at test.vhd(50) near text "<="; expecting "then"
Error (10500): VHDL syntax error at test.vhd(57) near text "<="; expecting "then"
Error (10500): VHDL syntax error at test.vhd(64) near text "<="; expecting "then"




my code is as follows:

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

ENTITY first IS

PORT
(
SECTOR1 : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
COUNT : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
A : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
B : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
--C : IN STD_LOGIC_VECTOR(12 DOWNTO 0);
PWM_CSR : OUT STD_LOGIC_VECTOR(5 DOWNTO 0)
);

END first;

ARCHITECTURE rtl OF first IS

BEGIN
CMP1ROCESS(SECTOR1, COUNT, A, B)
BEGIN
CASE SECTOR1 IS
WHEN "001" => IF COUNT<=A THEN
PWM_CSR<="100001";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="110000";
ELSE
PWM_CSR<="100100";
END IF;
WHEN "010" => IF COUNT<=A THEN
PWM_CSR<="110000";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="011000";
ELSE
PWM_CSR<="010010";
END IF;
WHEN "011" => IF COUNT<=A THEN
PWM_CSR<="011000";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="001100";
ELSE
PWM_CSR<="001001";
END IF;
WHEN "100" => IF COUNT<=A THEN
PWM_CSR<="001100";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="000110";
ELSE
PWM_CSR<="100100";
END IF;
WHEN "101" => IF COUNT<=A THEN
PWM_CSR<="000110";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="000011";
ELSE
PWM_CSR<="010010";
END IF;
WHEN "110" => IF COUNT<=A THEN
PWM_CSR<="000011";
ELSIF A<COUNT<=A+B THEN
PWM_CSR<="100001";
ELSE
PWM_CSR<="001001";
END IF;
WHEN OTHERS=> NULL;
END CASE;
END PROCESS CMP1;
END rtl;

Added after 46 minutes:

Please help me, I'm waiting online! thanks

 

The problem is the <= operator/signal assignment:
From a reference guide:
<quote>
Operator: <=

This symbol has two purposes. When used in an expression on scalar types and discrete array types, it is the "less than or equal to" operator. The resulting type of an expression using this operator in this context is Boolean (that is, True or False). In this context, the expression "A <= B" returns True only if A is less than or equal to B.

Example: LE := ‘1’ when A <= B else ‘0’;

In a signal assignment statement, the symbol "<=" is the assignment operator. Thus, the expression "TEST_SIGNAL <= 5" means that the signal TEST_SIGNAL is assigned the value 5.

Example: DataBUS <= 0x"E800";
<unquote>

in line 29 you have the expression
WHEN "001" => IF COUNT<=A THEN

Do you want count to be assigned to the signal A, or is it your intention to compare COUNT with A?

Using brackets sometimes helps. If not rewrite your code.
Something like:
IF COUNT < A+1 THEN ...

Hope this helps
 

Thank you very much, it's my intention to compare COUNT with A, so i think it's right? that's rather puzzling! who can help me ? THANKS



Added after 2 hours 49 minutes:

Thank you very much.
I've solved the problem, just change the expression" A<COUNT<=A+B" to "(A<COUNT)AND(COUNT<A+B)", THAT'LL BE OK!
THANKS

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…