Next time use the syntax tags. Reformatting poorly written code is tedious at best. Learn to format your code it's pretty much unreadable as is without any white space above and below blocks of code.
You don't seem to know any of the syntax for VHDL, maybe you should learn the syntax for a process before writing code.
You wrote this, which is incorrect.
Code VHDL - [expand] |
1
2
3
4
| process(clk)
begin
variable converted : integer := 0;
begin |
You should only have a begin after the variable declarations:
Code VHDL - [expand] |
1
2
3
| process(clk)
variable converted : integer := 0;
begin |
You have an unsynthesizable construct in your process:
Code VHDL - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| process(clk)
-- your variable declarations
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;
-- etc. |
Generating a clock (
clk_1000hz) and using it in the same process is both unsynthesizable and is a very poor design practice. Even if you separated the generated clock into its own process you would still have the issue of generating a clock from a register and routing it to a clock buffer which even the FPGA vendors suggest NOT doing that.
You also are using a bunch of variables, which can be a problem if you don't know what logic will be generated from a synthesis tool. I'm not an expert on VHDL and variables, but I suspect the following code won't turn out as you expected.
Code VHDL - [expand] |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| 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; |
Besides that you have a mismatch between the opening if and the end if;
And you are missing the
end behavioral;, that ends your architecture.
Regards
- - - Updated - - -
As I was curious I threw the code into Vivado synthesis after fixing the problems and NOT separating the two clocked processes (amazingly Vivado synthesis didn't complain about having two clocks in the process) and ended up with the following schematic of the design.
As is apparent, poorly written code results in poor results...
The light purple is the
converted signal.
The blue is the
clk
The red is the generated
clk_1000hz
As is obviously apparent the converted isn't even clocked it's a big combinatorial "blob" with a much bigger combinatorial "blob" following it before it ends up at a register on the far far far lower right side.
Draw a schematic of what you want and make a VHDL (hardware description) that implements your drawing.
Regards