LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all;
ENTITY Fuzzy IS PORT (Clock,Reset : IN std_logic; IN1 : IN std_logic_vector(7 DOWNTO 0); IN2 : IN std_logic_vector(7 DOWNTO 0); IN3 : IN std_logic_vector(7 DOWNTO 0); IN4 : IN std_logic_vector(7 DOWNTO 0); IN5 : IN std_logic_vector(7 DOWNTO 0); IN6 : IN std_logic_vector(7 DOWNTO 0); IN7 : IN std_logic_vector(7 DOWNTO 0); RESULT : OUT std_logic_vector (7 DOWNTO 0)); END Fuzzy;
ARCHITECTURE ARCH_Fuzzy OF Fuzzy IS
-- FOR INPUT 1 TYPE INPUT1 IS (VL1,L1,ML1,M1,MH1,H1,VH1,NONE1); TYPE membership1 IS RECORD term: INPUT1; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership1_function IS ARRAY(NATURAL RANGE<>) OF membership1; CONSTANT mfs1: membership1_function:= ((term => VL1, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L1, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML1, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M1, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH1, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H1, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH1, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE1, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 2 TYPE INPUT2 IS (VL2,L2,ML2,M2,MH2,H2,VH2,NONE2); TYPE membership2 IS RECORD term: INPUT2; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership2_function IS ARRAY(NATURAL RANGE<>) OF membership2; CONSTANT mfs2: membership2_function:= ((term => VL2, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L2, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML2, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M2, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH2, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H2, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH2, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE2, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 3 TYPE INPUT3 IS (VL3,L3,ML3,M3,MH3,H3,VH3,NONE3); TYPE membership3 IS RECORD term: INPUT3; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership3_function IS ARRAY(NATURAL RANGE<>) OF membership3; CONSTANT mfs3: membership3_function:= ((term => VL3, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L3, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML3, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M3, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH3, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H3, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH3, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE3, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 4 TYPE INPUT4 IS (VL4,L4,ML4,M4,MH4,H4,VH4,NONE4); TYPE membership4 IS RECORD term: INPUT4; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership4_function IS ARRAY(NATURAL RANGE<>) OF membership4; CONSTANT mfs4: membership4_function:= ((term => VL4, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L4, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML4, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M4, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH4, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H4, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH4, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE4, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 5 TYPE INPUT5 IS (VL5,L5,ML5,M5,MH5,H5,VH5,NONE5); TYPE membership5 IS RECORD term: INPUT5; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership5_function IS ARRAY(NATURAL RANGE<>) OF membership5; CONSTANT mfs5: membership5_function:= ((term => VL5, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L5, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML5, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M5, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH5, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H5, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH5, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE5, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 6 TYPE INPUT6 IS (VL6,L6,ML6,M6,MH6,H6,VH6,NONE6); TYPE membership6 IS RECORD term: INPUT6; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership6_function IS ARRAY(NATURAL RANGE<>) OF membership6; CONSTANT mfs6: membership6_function:= ((term => VL6, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L6, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML6, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M6, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH6, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H6, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH6, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE6, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR INPUT 7 TYPE INPUT7 IS (VL7,L7,ML7,M7,MH7,H7,VH7,NONE7); TYPE membership7 IS RECORD term: INPUT7; point1: std_logic_vector(7 DOWNTO 0); slope1: std_logic_vector(7 DOWNTO 0); point2: std_logic_vector(7 DOWNTO 0); slope2: std_logic_vector(7 DOWNTO 0); END RECORD; TYPE membership7_function IS ARRAY(NATURAL RANGE<>) OF membership7; CONSTANT mfs7: membership7_function:= ((term => VL7, point1 => x"00", slope1 => x"FF", point2 => x"24", slope2 => x"07"), (term => L7, point1 => x"24", slope1 => x"07", point2 => x"48", slope2 => x"07"), (term => ML7, point1 => x"48", slope1 => x"07", point2 => x"6C", slope2 => x"07"), (term => M7, point1 => x"6C", slope1 => x"07", point2 => x"90", slope2 => x"07"), (term => MH7, point1 => x"90", slope1 => x"07", point2 => x"B4", slope2 => x"07"), (term => H7, point1 => x"B4", slope1 => x"07", point2 => x"D8", slope2 => x"07"), (term => VH7, point1 => x"D8", slope1 => x"07", point2 => x"F0", slope2 => x"FF"), (term => NONE7, point1 => x"FF", slope1 => x"FF", point2 => x"FF", slope2 => x"FF"));
-- FOR OUTPUT CONSTANT P1: std_logic_vector:= x"00"; CONSTANT P2: std_logic_vector:= x"0F"; CONSTANT P3: std_logic_vector:= x"1E"; CONSTANT P4: std_logic_vector:= x"2D"; CONSTANT P5: std_logic_vector:= x"3C"; CONSTANT P6: std_logic_vector:= x"4B"; CONSTANT P7: std_logic_vector:= x"5A"; CONSTANT P8: std_logic_vector:= x"69"; CONSTANT P9: std_logic_vector:= x"78"; CONSTANT P10: std_logic_vector:= x"87"; CONSTANT P11: std_logic_vector:= x"96"; CONSTANT P12: std_logic_vector:= x"A5"; CONSTANT P13: std_logic_vector:= x"B4"; CONSTANT P14: std_logic_vector:= x"C3"; CONSTANT P15: std_logic_vector:= x"D2"; CONSTANT P16: std_logic_vector:= x"E1"; CONSTANT P17: std_logic_vector:= x"F0"; SIGNAL u: std_logic_vector(7 DOWNTO 0);
BEGIN
PROCESS(Clock,Reset) BEGIN IF (Reset = '0') THEN RESULT <= "000"; ELSIF (Clock'EVENT AND CLOCK='1') THEN FOR i IN 0 TO 7 LOOP IF IN1 < membership1[i].point1 THEN u[i] = '0'; ELSIF IN1 < membership1[i].point2 THEN u[i] = (IN1-membership1[i].point1)*membership1[i].slope1; ELSE u[i] = 255 - (IN1-membership1[i].point2)*membership1[i].slope2; END IF; END LOOP; END IF; END PROCESS; END ARCH_Fuzzy;
Info: Command: quartus_map --read_settings_files=on --write_settings_files=off test -c test Error (10500): VHDL syntax error at test.vhd(181) near text "="; expecting "(", or "'", or "." Error (10500): VHDL syntax error at test.vhd(183) near text "="; expecting "(", or "'", or "." Error (10500): VHDL syntax error at test.vhd(183) near text "*"; expecting ":=", or "<=" Error (10500): VHDL syntax error at test.vhd(184) near text "="; expecting "(", or "'", or "." Error (10500): VHDL syntax error at test.vhd(184) near text "*"; expecting ":=", or "<=" Info: Found 0 design units, including 0 entities, in source file test.vhd
I'm amatuer in VHDL and require to troubleshoot this error. I'm doing Fuzzy Logic using VHDL. Hope anyone can help thru. Really need it for my Final year Project. I'm out of solution
|