- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
-----------------------------------------------------------------------lcd-----------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity lcd is
generic(
delay_cnt : integer :=31); --delay_cnt=50, 50us X 31 = 1.55ms
port (
clk, clk1, clk2,clk3,clk4: in std_logic;
key : in std_logic_vector(3 downto 0);
sw : in std_logic_vector(1 downto 0);
rw,en,rs,v0 : out std_logic;
data_out : out std_logic_vector (7 downto 0);
segin1,segin2,segin3,segin4 : out std_logic_vector (3 downto 0);
LEDRin1,LEDRin2,LEDRin3 : out std_logic_vector (4 downto 0);
LEDRin4 : out std_logic_vector (1 downto 0));
end lcd;
architecture be of lcd is
subtype WORD is std_logic_vector(7 downto 0); -- Use 8bit to write down the word what i want to type
type DDRAM is array(0 to 15) of WORD; --DDRAM[0] ~ DDRAM[15]
signal Line0, Line1 : DDRAM; --Line1,2[0] ~ Line1,2[15] because Line0 and Line1 is DDRAM type
type STATE is (Wait_V0, Init, Line_0, Set_Add, Line_1, Wait_Vi, Go_Home); --kinds of STATE
signal ST : STATE:= Wait_V0; --ST become State Type, Initial value is Wait_V0
signal MUX_wire, clk_out, stop_sig : std_logic; --Role of enable, stop_sig is not used
signal init_count : integer range 0 to 127 := 0; -- Initial value is '0'. Range: 0 to 127
type GameST is (welcome,betting,betting_check,game,once_button,ea ch_button,error1,error2,error3,error4,error5,error 6,win,lose,each1,each2,each3);
signal GameSTATE:GameST:=welcome;
signal seg_input1,seg_input2,seg_input3,seg_input4:STd_lo gic_vector(3 downto 0):="0000";
signal LEDR_input1,LEDR_input2,LEDR_input3:std_logic_vect or(4 downto 0):="00000";
signal LEDR_input4:std_logic_vector(1 downto 0):="00";
begin
Game_staterocess(clk1,key,sw,GameSTATE)
begin
if rising_edge(clk1) then
case GameSTATE is
when welcome =>
if (key(0)='0' )then
GameSTATE <= betting;
else if (key(1)='0') then
GameSTATE<=game;
else if (key(2)='0') then
GameSTATE<=error1;
else if (key(3)='0') then
GameSTATE<=error2;
else GameSTATE<=welcome;
end if;
when betting =>
if (key(0)='0') then
GameSTATE<= betting_check;
else if (key(1)='0') then
GameSTATE<= game;
else if (key(2)='0') then
GameSTATE<=error3;
else if (key(3)='0') then
GameSTATE<=error4;
else if (sw(0)='0') then
GameSTATE<=welcome;
else GameSTATE<=betting;
end if ;
when betting_check =>
if (key(0)='0') then
GameSTATE <= welcome;
else if (key(1)='0') then
GameSTATE <= game;
else if (key(2)='0') then
GameSTATE <=error5;
else if (key(3)='0' )then
GameSTATE <=error6;
else if (sw(0)='0') then
GameSTATE <=welcome;
else GameSTATE <=betting_check;
end if;
when game =>
if (key(0)='0') then
GameSTATE <=betting;
else if (key(1)='0') then
GameSTATE <= game;
else if (key(2)='0') then
GameSTATE <=once_button;
else if (key(3)='0') then
GameSTATE <=each_button;
else if (sw(0)='0') then
GameSTATE <=welcome;
else GameSTATE <=betting_check;
end if;
end if;
when once_button =>
if (key(2)='0') then
if (seg_input1=seg_input2 and seg_input2 =seg_input3 and seg_input3 =seg_input4) then
GameSTATE<=win;
else if (seg_input1/=seg_input2 and seg_input2/=seg_input3 and seg_input3/=seg_input4) then
GameSTATE<= lose;
else GameSTATE<=once_button;
end if;
end if;
when each_button =>
if (key(3)='0') then
GameSTATE <=each1;
else if (key(0)='0') then
GameSTATE <=betting;
else if (key(1)='0') then
GameSTATE <=game;
else if (key(2)='0' )then
GameSTATE <=once_button;
else if (sw(0)='0') then
GameSTATE <=welcome;
else GameSTATE<=each_button;
end if;
when each1 =>
if (key(3)='0' )then
GameSTATE <=each2;
else if (key(0)='0') then
GameSTATE <=betting;
else if (key(1)='0') then
GameSTATE <=game;
else if (key(2)='0') then
GameSTATE <=once_button;
else if (sw(0)='0') then
GameSTATE <=welcome;
else GameSTATE<=each1;
end if;
when each2 =>
if (key(3)='0') then
GameSTATE <=each3;
else if (key(0)='0') then
GameSTATE <=betting;
else if (key(1)='0') then
GameSTATE <=game;
else if (key(2)='0') then
GameSTATE <=once_button;
else if (sw(0)='0') then
GameSTATE <=welcome;
else GameSTATE<=each2;
end if;
when each3 =>
if (key(3)='0') then
if (seg_input1=seg_input2 and seg_input2=seg_input3 and seg_input3 =seg_input4) then
GameSTATE<=win;
else if (seg_input1/=seg_input2 and seg_input2 /=seg_input3 and seg_input3/=seg_input4) then
GameSTATE<= lose;
else GameSTATE<=each3;
end if;
end if;
when win =>
GameSTATE<=welcome;
when lose =>
GameSTATE<=welcome;
when error1 =>
GameSTATE<=welcome;
when error2 =>
GameSTATE<=welcome;
when error3 =>
GameSTATE<=betting;
when error4 =>
GameSTATE<=betting;
when error5 =>
GameSTATE<=betting_check;
when others =>
GameSTATE<=betting_check;
end if;
segin1<=seg_input1;
segin2<=seg_input2;
segin3<=seg_input3;
segin4<=seg_input4;
end process;
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Info: *******************************************************************
Info: Running Quartus II 64-Bit Analysis & Synthesis Info: Version 13.1.0 Build 162 10/23/2013 SJ Web Edition Info: Processing started: Wed Jun 14 06:40:16 2017 Info: Command: quartus_map --read_settings_files=on --write_settings_files=off slotmachine -c slotmachine Info (20030): Parallel compilation is enabled and will use 4 of the 4 processors detected Error (10500): VHDL syntax error at slotmachine.vhd(152) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(169) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(186) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(203) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(214) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(232) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(249) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(267) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(278) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(282) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(288) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(292) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(296) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(300) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(304) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(308) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at slotmachine.vhd(317) near text "process"; expecting "if" Error (10500): VHDL syntax error at slotmachine.vhd(321) near text "begin"; expecting ":=", or "<=" Error (10500): VHDL syntax error at slotmachine.vhd(476) near text "process"; expecting "if" Info (12021): Found 0 design units, including 0 entities, in source file slotmachine.vhd Error: Quartus II 64-Bit Analysis & Synthesis was unsuccessful. 19 errors, 0 warnings Error: Peak virtual memory: 543 megabytes Error: Processing ended: Wed Jun 14 06:40:19 2017 Error: Elapsed time: 00:00:03 Error: Total CPU time (on all processors): 00:00:01 Error (293001): Quartus II Full Compilation was unsuccessful. 21 errors, 0 warnings- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
case is when phrase have all error ,, ** when000 =>00000 **** like this sentence
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
could you edit your post so the code is in code tags and keeps the indentatio s etc? that makes it more readable. having said that, then you should check just before line 152, you probably forgot so mething like an end statement, as the error is telling you it expected before it saw the when.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using "else if"
This opens a new if statement. I think you meant "elsif"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a general note, when you end up with a big list of errors you're probably forgetting to close an expression with a comma or a semicolon. Check the first error at the lowest line number and your problem is *probably* going to be around there.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page