how to make vhdl 7seg 6bit array











up vote
0
down vote

favorite












I am a beginner who started learning vhdl now.
I make a 7seg 6bit array.
The code is compiled. But not working.
I tried to find out what was wrong, but I can not find it.
first step is make a count. second is display.
I wonder if there is a problem with the second code.
I would appreciate your advice.



enter code here 
library ieee;
use ieee.std_logic_1164.all;


use ieee.numeric_std.all;
entity display is
port(
display_dco : in std_logic;
r : in std_logic;
seg_gamma : out std_logic_vector(6 downto 0);
r6 : out std_logic;
r5 : out std_logic;
r4 : out std_logic;
r3 : out std_logic;
r2 : out std_logic;
r1 : out std_logic;



);
end display;

architecture step11_1_final_main of display is

signal seg_counts : integer range 0 to 150000000;
signal seg_counttr : integer range 0 to 5;
signal seg_counttb : integer range 0 to 5;

signal rcount : integer range 0 to 150000000;

signal gresult5 : integer range 0 to 9 := 0 ; --gamma3
signal gresult4 : integer range 0 to 9 := 0 ; --gamma3
signal gresult3 : integer range 0 to 9 := 0 ; --gamma3
signal gresult2 : integer range 0 to 9 := 0 ; --gamma2
signal gresult1 : integer range 0 to 9 := 0 ; --gamma1



begin
process(display_dco,seg_counts)
begin
if falling_edge(display_dco) then
if (seg_counts < 150000000) then
seg_counts <= seg_counts+1;
else
seg_counts <= 0;
end if;
end if;
end process;

process(display_dco,seg_counttr)
begin
if falling_edge(display_dco) then
if (seg_counttr < 5) then
seg_counttr <= seg_counttr+1;
else
seg_counttr <= 0;
end if;
end if;
end process;



process(display_dco,r,b,rcount,bcount)
begin
if falling_edge(display_dco) then
if (r='1') then
rcount <= rcount+1;
elsif (b='1') then
rcount <= rcount;
else
rcount <= rcount;
end if;
end if;
end process;



process(seg_counts,rcount)
begin
if (seg_counts > 140000000) then

if(rcount>10000 and rcount<99999) then

gresult5 <= rcount/10000;
gresult4 <= ((rcount rem 10000)/1000);
gresult3 <= ((rcount rem 1000)rem 1000)/100;
gresult2 <= (((rcount rem 1000)rem 1000) rem 100)/10;
gresult1 <= 0;


elsif( (rcount<10000) and (rcount>1000) ) then

gresult5 <= 0;
gresult4 <= rcount/1000;
gresult3 <= ((rcount rem 1000)/100);
gresult2 <= ((rcount rem 1000) rem 100)/10;
gresult1 <= ((rcount rem 1000) rem 100)rem 10;


elsif( (rcount>100) and (rcount<1000) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= rcount/100;
gresult2 <= rcount rem 100 ;
gresult1 <= (rcount rem 100) rem 10;

elsif( (rcount<100) and (rcount>10) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= rcount/10;
gresult1 <= rcount rem 10;

elsif (rcount<10) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= 0;
gresult1 <= rcount;

end if;

else

end if;


end process;



      process(seg_counttr,gresult3,gresult2,gresult1)
begin
case seg_counttr is
when 0 => r1 <= '0'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 1 => r1 <= '1'; r2 <='0'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 2 => r1 <= '1'; r2 <='1'; r3<='0'; r4<= '1'; r5<= '1'; r6<='1';
when 3 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '0'; r5<= '1'; r6<='1';
when 4 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '0'; r6<='1';
when 5 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='0';
end case;


if (seg_counttr = 4) then
if(gresult5=0) then
seg_gamma<="0111111";
elsif(gresult5=1) then
seg_gamma<="0000110";
elsif(gresult5=2) then
seg_gamma<="1011011";
elsif(gresult5=3) then
seg_gamma<="1001111";
elsif(gresult5=4) then
seg_gamma<="1100110";
elsif(gresult5=5) then
seg_gamma<="1101101";
elsif(gresult5=6) then
seg_gamma<="1111101";
elsif(gresult5=7) then
seg_gamma<="0000111";
elsif(gresult5=8) then
seg_gamma<="1111111";
elsif(gresult5=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


elsif (seg_counttr = 3) then
if(gresult4=0) then
seg_gamma<="0111111";
elsif(gresult4=1) then
seg_gamma<="0000110";
elsif(gresult4=2) then
seg_gamma<="1011011";
elsif(gresult4=3) then
seg_gamma<="1001111";
elsif(gresult4=4) then
seg_gamma<="1100110";
elsif(gresult4=5) then
seg_gamma<="1101101";
elsif(gresult4=6) then
seg_gamma<="1111101";
elsif(gresult4=7) then
seg_gamma<="0000111";
elsif(gresult4=8) then
seg_gamma<="1111111";
elsif(gresult4=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;



elsif (seg_counttr = 2) then
if(gresult3=0) then
seg_gamma<="0111111";
elsif(gresult3=1) then
seg_gamma<="0000110";
elsif(gresult3=2) then
seg_gamma<="1011011";
elsif(gresult3=3) then
seg_gamma<="1001111";
elsif(gresult3=4) then
seg_gamma<="1100110";
elsif(gresult3=5) then
seg_gamma<="1101101";
elsif(gresult3=6) then
seg_gamma<="1111101";
elsif(gresult3=7) then
seg_gamma<="0000111";
elsif(gresult3=8) then
seg_gamma<="1111111";
elsif(gresult3=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 1) then
if(gresult2=0) then
seg_gamma<="0111111";
elsif(gresult2=1) then
seg_gamma<="0000110";
elsif(gresult2=2) then
seg_gamma<="1011011";
elsif(gresult2=3) then
seg_gamma<="1001111";
elsif(gresult2=4) then
seg_gamma<="1100110";
elsif(gresult2=5) then
seg_gamma<="1101101";
elsif(gresult2=6) then
seg_gamma<="1111101";
elsif(gresult2=7) then
seg_gamma<="0000111";
elsif(gresult2=8) then
seg_gamma<="1111111";
elsif(gresult2=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 0) then
if(gresult1=0) then
seg_gamma<="0111111";
elsif(gresult1=1) then
seg_gamma<="0000110";
elsif(gresult1=2) then
seg_gamma<="1011011";
elsif(gresult1=3) then
seg_gamma<="1001111";
elsif(gresult1=4) then
seg_gamma<="1100110";
elsif(gresult1=5) then
seg_gamma<="1101101";
elsif(gresult1=6) then
seg_gamma<="1111101";
elsif(gresult1=7) then
seg_gamma<="0000111";
elsif(gresult1=8) then
seg_gamma<="1111111";
elsif(gresult1=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


end if;
end process;



end step11_1_final_main;










share|improve this question







New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
    – user1155120
    Nov 5 at 3:51












  • Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
    – DY.KIM
    Nov 5 at 4:06















up vote
0
down vote

favorite












I am a beginner who started learning vhdl now.
I make a 7seg 6bit array.
The code is compiled. But not working.
I tried to find out what was wrong, but I can not find it.
first step is make a count. second is display.
I wonder if there is a problem with the second code.
I would appreciate your advice.



enter code here 
library ieee;
use ieee.std_logic_1164.all;


use ieee.numeric_std.all;
entity display is
port(
display_dco : in std_logic;
r : in std_logic;
seg_gamma : out std_logic_vector(6 downto 0);
r6 : out std_logic;
r5 : out std_logic;
r4 : out std_logic;
r3 : out std_logic;
r2 : out std_logic;
r1 : out std_logic;



);
end display;

architecture step11_1_final_main of display is

signal seg_counts : integer range 0 to 150000000;
signal seg_counttr : integer range 0 to 5;
signal seg_counttb : integer range 0 to 5;

signal rcount : integer range 0 to 150000000;

signal gresult5 : integer range 0 to 9 := 0 ; --gamma3
signal gresult4 : integer range 0 to 9 := 0 ; --gamma3
signal gresult3 : integer range 0 to 9 := 0 ; --gamma3
signal gresult2 : integer range 0 to 9 := 0 ; --gamma2
signal gresult1 : integer range 0 to 9 := 0 ; --gamma1



begin
process(display_dco,seg_counts)
begin
if falling_edge(display_dco) then
if (seg_counts < 150000000) then
seg_counts <= seg_counts+1;
else
seg_counts <= 0;
end if;
end if;
end process;

process(display_dco,seg_counttr)
begin
if falling_edge(display_dco) then
if (seg_counttr < 5) then
seg_counttr <= seg_counttr+1;
else
seg_counttr <= 0;
end if;
end if;
end process;



process(display_dco,r,b,rcount,bcount)
begin
if falling_edge(display_dco) then
if (r='1') then
rcount <= rcount+1;
elsif (b='1') then
rcount <= rcount;
else
rcount <= rcount;
end if;
end if;
end process;



process(seg_counts,rcount)
begin
if (seg_counts > 140000000) then

if(rcount>10000 and rcount<99999) then

gresult5 <= rcount/10000;
gresult4 <= ((rcount rem 10000)/1000);
gresult3 <= ((rcount rem 1000)rem 1000)/100;
gresult2 <= (((rcount rem 1000)rem 1000) rem 100)/10;
gresult1 <= 0;


elsif( (rcount<10000) and (rcount>1000) ) then

gresult5 <= 0;
gresult4 <= rcount/1000;
gresult3 <= ((rcount rem 1000)/100);
gresult2 <= ((rcount rem 1000) rem 100)/10;
gresult1 <= ((rcount rem 1000) rem 100)rem 10;


elsif( (rcount>100) and (rcount<1000) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= rcount/100;
gresult2 <= rcount rem 100 ;
gresult1 <= (rcount rem 100) rem 10;

elsif( (rcount<100) and (rcount>10) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= rcount/10;
gresult1 <= rcount rem 10;

elsif (rcount<10) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= 0;
gresult1 <= rcount;

end if;

else

end if;


end process;



      process(seg_counttr,gresult3,gresult2,gresult1)
begin
case seg_counttr is
when 0 => r1 <= '0'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 1 => r1 <= '1'; r2 <='0'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 2 => r1 <= '1'; r2 <='1'; r3<='0'; r4<= '1'; r5<= '1'; r6<='1';
when 3 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '0'; r5<= '1'; r6<='1';
when 4 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '0'; r6<='1';
when 5 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='0';
end case;


if (seg_counttr = 4) then
if(gresult5=0) then
seg_gamma<="0111111";
elsif(gresult5=1) then
seg_gamma<="0000110";
elsif(gresult5=2) then
seg_gamma<="1011011";
elsif(gresult5=3) then
seg_gamma<="1001111";
elsif(gresult5=4) then
seg_gamma<="1100110";
elsif(gresult5=5) then
seg_gamma<="1101101";
elsif(gresult5=6) then
seg_gamma<="1111101";
elsif(gresult5=7) then
seg_gamma<="0000111";
elsif(gresult5=8) then
seg_gamma<="1111111";
elsif(gresult5=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


elsif (seg_counttr = 3) then
if(gresult4=0) then
seg_gamma<="0111111";
elsif(gresult4=1) then
seg_gamma<="0000110";
elsif(gresult4=2) then
seg_gamma<="1011011";
elsif(gresult4=3) then
seg_gamma<="1001111";
elsif(gresult4=4) then
seg_gamma<="1100110";
elsif(gresult4=5) then
seg_gamma<="1101101";
elsif(gresult4=6) then
seg_gamma<="1111101";
elsif(gresult4=7) then
seg_gamma<="0000111";
elsif(gresult4=8) then
seg_gamma<="1111111";
elsif(gresult4=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;



elsif (seg_counttr = 2) then
if(gresult3=0) then
seg_gamma<="0111111";
elsif(gresult3=1) then
seg_gamma<="0000110";
elsif(gresult3=2) then
seg_gamma<="1011011";
elsif(gresult3=3) then
seg_gamma<="1001111";
elsif(gresult3=4) then
seg_gamma<="1100110";
elsif(gresult3=5) then
seg_gamma<="1101101";
elsif(gresult3=6) then
seg_gamma<="1111101";
elsif(gresult3=7) then
seg_gamma<="0000111";
elsif(gresult3=8) then
seg_gamma<="1111111";
elsif(gresult3=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 1) then
if(gresult2=0) then
seg_gamma<="0111111";
elsif(gresult2=1) then
seg_gamma<="0000110";
elsif(gresult2=2) then
seg_gamma<="1011011";
elsif(gresult2=3) then
seg_gamma<="1001111";
elsif(gresult2=4) then
seg_gamma<="1100110";
elsif(gresult2=5) then
seg_gamma<="1101101";
elsif(gresult2=6) then
seg_gamma<="1111101";
elsif(gresult2=7) then
seg_gamma<="0000111";
elsif(gresult2=8) then
seg_gamma<="1111111";
elsif(gresult2=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 0) then
if(gresult1=0) then
seg_gamma<="0111111";
elsif(gresult1=1) then
seg_gamma<="0000110";
elsif(gresult1=2) then
seg_gamma<="1011011";
elsif(gresult1=3) then
seg_gamma<="1001111";
elsif(gresult1=4) then
seg_gamma<="1100110";
elsif(gresult1=5) then
seg_gamma<="1101101";
elsif(gresult1=6) then
seg_gamma<="1111101";
elsif(gresult1=7) then
seg_gamma<="0000111";
elsif(gresult1=8) then
seg_gamma<="1111111";
elsif(gresult1=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


end if;
end process;



end step11_1_final_main;










share|improve this question







New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
    – user1155120
    Nov 5 at 3:51












  • Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
    – DY.KIM
    Nov 5 at 4:06













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am a beginner who started learning vhdl now.
I make a 7seg 6bit array.
The code is compiled. But not working.
I tried to find out what was wrong, but I can not find it.
first step is make a count. second is display.
I wonder if there is a problem with the second code.
I would appreciate your advice.



enter code here 
library ieee;
use ieee.std_logic_1164.all;


use ieee.numeric_std.all;
entity display is
port(
display_dco : in std_logic;
r : in std_logic;
seg_gamma : out std_logic_vector(6 downto 0);
r6 : out std_logic;
r5 : out std_logic;
r4 : out std_logic;
r3 : out std_logic;
r2 : out std_logic;
r1 : out std_logic;



);
end display;

architecture step11_1_final_main of display is

signal seg_counts : integer range 0 to 150000000;
signal seg_counttr : integer range 0 to 5;
signal seg_counttb : integer range 0 to 5;

signal rcount : integer range 0 to 150000000;

signal gresult5 : integer range 0 to 9 := 0 ; --gamma3
signal gresult4 : integer range 0 to 9 := 0 ; --gamma3
signal gresult3 : integer range 0 to 9 := 0 ; --gamma3
signal gresult2 : integer range 0 to 9 := 0 ; --gamma2
signal gresult1 : integer range 0 to 9 := 0 ; --gamma1



begin
process(display_dco,seg_counts)
begin
if falling_edge(display_dco) then
if (seg_counts < 150000000) then
seg_counts <= seg_counts+1;
else
seg_counts <= 0;
end if;
end if;
end process;

process(display_dco,seg_counttr)
begin
if falling_edge(display_dco) then
if (seg_counttr < 5) then
seg_counttr <= seg_counttr+1;
else
seg_counttr <= 0;
end if;
end if;
end process;



process(display_dco,r,b,rcount,bcount)
begin
if falling_edge(display_dco) then
if (r='1') then
rcount <= rcount+1;
elsif (b='1') then
rcount <= rcount;
else
rcount <= rcount;
end if;
end if;
end process;



process(seg_counts,rcount)
begin
if (seg_counts > 140000000) then

if(rcount>10000 and rcount<99999) then

gresult5 <= rcount/10000;
gresult4 <= ((rcount rem 10000)/1000);
gresult3 <= ((rcount rem 1000)rem 1000)/100;
gresult2 <= (((rcount rem 1000)rem 1000) rem 100)/10;
gresult1 <= 0;


elsif( (rcount<10000) and (rcount>1000) ) then

gresult5 <= 0;
gresult4 <= rcount/1000;
gresult3 <= ((rcount rem 1000)/100);
gresult2 <= ((rcount rem 1000) rem 100)/10;
gresult1 <= ((rcount rem 1000) rem 100)rem 10;


elsif( (rcount>100) and (rcount<1000) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= rcount/100;
gresult2 <= rcount rem 100 ;
gresult1 <= (rcount rem 100) rem 10;

elsif( (rcount<100) and (rcount>10) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= rcount/10;
gresult1 <= rcount rem 10;

elsif (rcount<10) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= 0;
gresult1 <= rcount;

end if;

else

end if;


end process;



      process(seg_counttr,gresult3,gresult2,gresult1)
begin
case seg_counttr is
when 0 => r1 <= '0'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 1 => r1 <= '1'; r2 <='0'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 2 => r1 <= '1'; r2 <='1'; r3<='0'; r4<= '1'; r5<= '1'; r6<='1';
when 3 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '0'; r5<= '1'; r6<='1';
when 4 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '0'; r6<='1';
when 5 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='0';
end case;


if (seg_counttr = 4) then
if(gresult5=0) then
seg_gamma<="0111111";
elsif(gresult5=1) then
seg_gamma<="0000110";
elsif(gresult5=2) then
seg_gamma<="1011011";
elsif(gresult5=3) then
seg_gamma<="1001111";
elsif(gresult5=4) then
seg_gamma<="1100110";
elsif(gresult5=5) then
seg_gamma<="1101101";
elsif(gresult5=6) then
seg_gamma<="1111101";
elsif(gresult5=7) then
seg_gamma<="0000111";
elsif(gresult5=8) then
seg_gamma<="1111111";
elsif(gresult5=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


elsif (seg_counttr = 3) then
if(gresult4=0) then
seg_gamma<="0111111";
elsif(gresult4=1) then
seg_gamma<="0000110";
elsif(gresult4=2) then
seg_gamma<="1011011";
elsif(gresult4=3) then
seg_gamma<="1001111";
elsif(gresult4=4) then
seg_gamma<="1100110";
elsif(gresult4=5) then
seg_gamma<="1101101";
elsif(gresult4=6) then
seg_gamma<="1111101";
elsif(gresult4=7) then
seg_gamma<="0000111";
elsif(gresult4=8) then
seg_gamma<="1111111";
elsif(gresult4=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;



elsif (seg_counttr = 2) then
if(gresult3=0) then
seg_gamma<="0111111";
elsif(gresult3=1) then
seg_gamma<="0000110";
elsif(gresult3=2) then
seg_gamma<="1011011";
elsif(gresult3=3) then
seg_gamma<="1001111";
elsif(gresult3=4) then
seg_gamma<="1100110";
elsif(gresult3=5) then
seg_gamma<="1101101";
elsif(gresult3=6) then
seg_gamma<="1111101";
elsif(gresult3=7) then
seg_gamma<="0000111";
elsif(gresult3=8) then
seg_gamma<="1111111";
elsif(gresult3=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 1) then
if(gresult2=0) then
seg_gamma<="0111111";
elsif(gresult2=1) then
seg_gamma<="0000110";
elsif(gresult2=2) then
seg_gamma<="1011011";
elsif(gresult2=3) then
seg_gamma<="1001111";
elsif(gresult2=4) then
seg_gamma<="1100110";
elsif(gresult2=5) then
seg_gamma<="1101101";
elsif(gresult2=6) then
seg_gamma<="1111101";
elsif(gresult2=7) then
seg_gamma<="0000111";
elsif(gresult2=8) then
seg_gamma<="1111111";
elsif(gresult2=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 0) then
if(gresult1=0) then
seg_gamma<="0111111";
elsif(gresult1=1) then
seg_gamma<="0000110";
elsif(gresult1=2) then
seg_gamma<="1011011";
elsif(gresult1=3) then
seg_gamma<="1001111";
elsif(gresult1=4) then
seg_gamma<="1100110";
elsif(gresult1=5) then
seg_gamma<="1101101";
elsif(gresult1=6) then
seg_gamma<="1111101";
elsif(gresult1=7) then
seg_gamma<="0000111";
elsif(gresult1=8) then
seg_gamma<="1111111";
elsif(gresult1=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


end if;
end process;



end step11_1_final_main;










share|improve this question







New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am a beginner who started learning vhdl now.
I make a 7seg 6bit array.
The code is compiled. But not working.
I tried to find out what was wrong, but I can not find it.
first step is make a count. second is display.
I wonder if there is a problem with the second code.
I would appreciate your advice.



enter code here 
library ieee;
use ieee.std_logic_1164.all;


use ieee.numeric_std.all;
entity display is
port(
display_dco : in std_logic;
r : in std_logic;
seg_gamma : out std_logic_vector(6 downto 0);
r6 : out std_logic;
r5 : out std_logic;
r4 : out std_logic;
r3 : out std_logic;
r2 : out std_logic;
r1 : out std_logic;



);
end display;

architecture step11_1_final_main of display is

signal seg_counts : integer range 0 to 150000000;
signal seg_counttr : integer range 0 to 5;
signal seg_counttb : integer range 0 to 5;

signal rcount : integer range 0 to 150000000;

signal gresult5 : integer range 0 to 9 := 0 ; --gamma3
signal gresult4 : integer range 0 to 9 := 0 ; --gamma3
signal gresult3 : integer range 0 to 9 := 0 ; --gamma3
signal gresult2 : integer range 0 to 9 := 0 ; --gamma2
signal gresult1 : integer range 0 to 9 := 0 ; --gamma1



begin
process(display_dco,seg_counts)
begin
if falling_edge(display_dco) then
if (seg_counts < 150000000) then
seg_counts <= seg_counts+1;
else
seg_counts <= 0;
end if;
end if;
end process;

process(display_dco,seg_counttr)
begin
if falling_edge(display_dco) then
if (seg_counttr < 5) then
seg_counttr <= seg_counttr+1;
else
seg_counttr <= 0;
end if;
end if;
end process;



process(display_dco,r,b,rcount,bcount)
begin
if falling_edge(display_dco) then
if (r='1') then
rcount <= rcount+1;
elsif (b='1') then
rcount <= rcount;
else
rcount <= rcount;
end if;
end if;
end process;



process(seg_counts,rcount)
begin
if (seg_counts > 140000000) then

if(rcount>10000 and rcount<99999) then

gresult5 <= rcount/10000;
gresult4 <= ((rcount rem 10000)/1000);
gresult3 <= ((rcount rem 1000)rem 1000)/100;
gresult2 <= (((rcount rem 1000)rem 1000) rem 100)/10;
gresult1 <= 0;


elsif( (rcount<10000) and (rcount>1000) ) then

gresult5 <= 0;
gresult4 <= rcount/1000;
gresult3 <= ((rcount rem 1000)/100);
gresult2 <= ((rcount rem 1000) rem 100)/10;
gresult1 <= ((rcount rem 1000) rem 100)rem 10;


elsif( (rcount>100) and (rcount<1000) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= rcount/100;
gresult2 <= rcount rem 100 ;
gresult1 <= (rcount rem 100) rem 10;

elsif( (rcount<100) and (rcount>10) ) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= rcount/10;
gresult1 <= rcount rem 10;

elsif (rcount<10) then
gresult5 <= 0;
gresult4 <= 0;
gresult3 <= 0;
gresult2 <= 0;
gresult1 <= rcount;

end if;

else

end if;


end process;



      process(seg_counttr,gresult3,gresult2,gresult1)
begin
case seg_counttr is
when 0 => r1 <= '0'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 1 => r1 <= '1'; r2 <='0'; r3<='1'; r4<= '1'; r5<= '1'; r6<='1';
when 2 => r1 <= '1'; r2 <='1'; r3<='0'; r4<= '1'; r5<= '1'; r6<='1';
when 3 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '0'; r5<= '1'; r6<='1';
when 4 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '0'; r6<='1';
when 5 => r1 <= '1'; r2 <='1'; r3<='1'; r4<= '1'; r5<= '1'; r6<='0';
end case;


if (seg_counttr = 4) then
if(gresult5=0) then
seg_gamma<="0111111";
elsif(gresult5=1) then
seg_gamma<="0000110";
elsif(gresult5=2) then
seg_gamma<="1011011";
elsif(gresult5=3) then
seg_gamma<="1001111";
elsif(gresult5=4) then
seg_gamma<="1100110";
elsif(gresult5=5) then
seg_gamma<="1101101";
elsif(gresult5=6) then
seg_gamma<="1111101";
elsif(gresult5=7) then
seg_gamma<="0000111";
elsif(gresult5=8) then
seg_gamma<="1111111";
elsif(gresult5=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


elsif (seg_counttr = 3) then
if(gresult4=0) then
seg_gamma<="0111111";
elsif(gresult4=1) then
seg_gamma<="0000110";
elsif(gresult4=2) then
seg_gamma<="1011011";
elsif(gresult4=3) then
seg_gamma<="1001111";
elsif(gresult4=4) then
seg_gamma<="1100110";
elsif(gresult4=5) then
seg_gamma<="1101101";
elsif(gresult4=6) then
seg_gamma<="1111101";
elsif(gresult4=7) then
seg_gamma<="0000111";
elsif(gresult4=8) then
seg_gamma<="1111111";
elsif(gresult4=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;



elsif (seg_counttr = 2) then
if(gresult3=0) then
seg_gamma<="0111111";
elsif(gresult3=1) then
seg_gamma<="0000110";
elsif(gresult3=2) then
seg_gamma<="1011011";
elsif(gresult3=3) then
seg_gamma<="1001111";
elsif(gresult3=4) then
seg_gamma<="1100110";
elsif(gresult3=5) then
seg_gamma<="1101101";
elsif(gresult3=6) then
seg_gamma<="1111101";
elsif(gresult3=7) then
seg_gamma<="0000111";
elsif(gresult3=8) then
seg_gamma<="1111111";
elsif(gresult3=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 1) then
if(gresult2=0) then
seg_gamma<="0111111";
elsif(gresult2=1) then
seg_gamma<="0000110";
elsif(gresult2=2) then
seg_gamma<="1011011";
elsif(gresult2=3) then
seg_gamma<="1001111";
elsif(gresult2=4) then
seg_gamma<="1100110";
elsif(gresult2=5) then
seg_gamma<="1101101";
elsif(gresult2=6) then
seg_gamma<="1111101";
elsif(gresult2=7) then
seg_gamma<="0000111";
elsif(gresult2=8) then
seg_gamma<="1111111";
elsif(gresult2=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;

elsif (seg_counttr = 0) then
if(gresult1=0) then
seg_gamma<="0111111";
elsif(gresult1=1) then
seg_gamma<="0000110";
elsif(gresult1=2) then
seg_gamma<="1011011";
elsif(gresult1=3) then
seg_gamma<="1001111";
elsif(gresult1=4) then
seg_gamma<="1100110";
elsif(gresult1=5) then
seg_gamma<="1101101";
elsif(gresult1=6) then
seg_gamma<="1111101";
elsif(gresult1=7) then
seg_gamma<="0000111";
elsif(gresult1=8) then
seg_gamma<="1111111";
elsif(gresult1=9) then
seg_gamma<="1101111";
else
seg_gamma<="0000000";
end if;


end if;
end process;



end step11_1_final_main;







vhdl






share|improve this question







New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 5 at 2:47









DY.KIM

1




1




New contributor




DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






DY.KIM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
    – user1155120
    Nov 5 at 3:51












  • Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
    – DY.KIM
    Nov 5 at 4:06


















  • Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
    – user1155120
    Nov 5 at 3:51












  • Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
    – DY.KIM
    Nov 5 at 4:06
















Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
– user1155120
Nov 5 at 3:51






Your code example doesn't compile even gathering the text pieces For instance there is no b or bcount declared. As is your question is off-topic "1. Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." The idea is a question and answer can also help future readers searching Stackoverflow.
– user1155120
Nov 5 at 3:51














Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
– DY.KIM
Nov 5 at 4:06




Thank you for your reply. Actually the code contains bresult(b and bcount same as r rcount) but the code seems to be too long so I remove it and upload. So, there seems to be a problem.
– DY.KIM
Nov 5 at 4:06

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






DY.KIM is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147679%2fhow-to-make-vhdl-7seg-6bit-array%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








DY.KIM is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















DY.KIM is a new contributor. Be nice, and check out our Code of Conduct.













DY.KIM is a new contributor. Be nice, and check out our Code of Conduct.












DY.KIM is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147679%2fhow-to-make-vhdl-7seg-6bit-array%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()