tosunco
Newbie level 2
- Joined
- Apr 16, 2014
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 38
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 library ieee; use IEEE.std_logic_1164.all; use IEEE.std_logic_ARITH.all; use IEEE.std_logic_UNSIGNED.all; use ieee.numeric_std.all; entity sevenseg is port ( sw: in std_logic_vector (7 downto 0); clk: in std_logic; ssegon: out std_logic_vector(3 downto 0); sseg: out std_logic_vector (0 to 6)); end sevenseg; architecture behavioral of sevenseg is signal count : integer :=0; signal count2 : integer :=0; signal clk_1000hz : std_logic :='0'; signal a1 : integer range 0 to 9:= 1; signal a2 : integer range 0 to 9:= 1; signal a3 : integer range 0 to 9:= 1; signal a4 : integer range 0 to 9:= 1; signal a1_en : std_logic := '1'; signal a2_en : std_logic := '1'; signal a3_en : std_logic := '1'; signal a4_en : std_logic := '1'; function divide(bolunen, bolen: in integer) return integer is variable var,count : integer; begin var:=bolunen; count:=0; for i in 0 to 100 loop if (var>=bolen) then var :=var-bolen; count:=count+1; end if; return count; end loop; end divide; function seven_segment_display(din: in integer) return std_logic_vector is variable sev_seg: std_logic_vector(0 to 6); begin sev_seg:="0000000"; case din is when 0=> sev_seg := "0000001"; when 1=> sev_seg := "1001111"; when 2=> sev_seg := "0010010"; when 3=> sev_seg := "0000110"; when 4=> sev_seg := "1001100"; when 5=> sev_seg := "0100100"; when 6=> sev_seg := "0100000"; when 7=> sev_seg := "0001111"; when 8=> sev_seg := "0000000"; when 9=> sev_seg := "0000100"; when others => sev_seg := "1111111"; end case; return sev_seg; end seven_segment_display;
process(clk)
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 begin variable converted : integer := 0; variable var,count_division : integer; variable a1temp : integer range 0 to 9:= 1; variable a2temp : integer range 0 to 9:= 1; variable a3temp : integer range 0 to 9:= 1; variable a4temp : integer range 0 to 9:= 1; begin if(clk'event and clk='1') then count <=count+1; if(count = 50000) then--10khz clk_1000hz <= not clk_1000hz; count <=1; end if; end if; if(clk_1000hz'event and clk_1000hz='1') then count2 <=count2+1; if(count2 = 100) then--10khz count2 <=0; end if; end if; if(((count2 mod 4)=1) and a1_en='1')then ssegon <= "0111"; sseg <= seven_segment_display(a1); end if; if(((count2 mod 4)=2)and a2_en='1') then ssegon <= "1011"; sseg <= seven_segment_display(a2); end if; if(((count2 mod 4)=3) and a3_en='1')then ssegon <= "1101"; sseg <=seven_segment_display(a3); end if; if(((count2 mod 4)=0)and a4_en='1') then ssegon <= "1110"; sseg <= seven_segment_display(a4); end if; converted:=conv_integer(sw); count_division:=0; for i in 0 to 2 loop if (converted>=100) then converted :=converted-100; count_division:=count_division+1; else a2temp:=count_division; end if; end loop; count_division:=0; for i in 0 to 10 loop if (converted >=10) then converted :=converted-10; count_division:=count_division+1; else a3temp:=count_division; end if; end loop; a2<=a2temp; a3<=a3temp; a4<=converted; end if; end process;
When I run my code, I'm getting an error at the line 63 which is underlined and bolded.
It says "Line 63. parse error, unexpected PROCESS"
Can anyone please help to solve this problem?
Last edited by a moderator: