rumi29
Junior Member level 1
Below this text there's a code and I have a problem. I'm trying tod divide a number per 10, because I want to make the table of the numbers just from "0" to "9" but the compilator its saying that I cannot use the operator "/"...and I don't know why...Thanks guys
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity LUT1 is
port(
clk: in std_logic;
led: out bit_vector(6 downto 0);
entrada: in std_logic_vector(5 downto 0));
end LUT1;
Architecture table of LUT1 is
constant max: integer := 50000000;--This are just for the first process
constant half: integer := max/2;--This are just for the first process
signal newclk: std_logic;--This are just for the first process
signal count: integer range 0 to max;--This are just for the first process
shared variable bcd: std_logic_vector (2 downto 0):="000";--This are just for the second process
shared variable aux: integer;--This are just for the second process
constant deu: std_logic_vector(5 downto 0):="001010";--constant to divide per 10 in binary
begin
divide: process--This process its only to divide the main clock of the main board.
begin
wait until clk'event and
clk='1';
if
count<max then count<=count + 1;
else count <= 0;
end if;
if count < half then newclk<='0';
else newclk <='1';
end if;
end process divide;
conv: process (newclk)--This process works like we shown you the last time, it's showing the number that you are entering by the switches but this time we just want to divide the number from the switches per 10 and then show the number.
begin
bcd := entrada / deu;-- Here we have the problem, we cannot divide this variable per 10, you know why? The compilator says that this operator "/" is not valid
case bcd is
when "0000000000000000" => LED <= "1000000";--0
when "0000000000000001" => LED <= "1111001";--1
when "0000000000000010" => LED <= "0100100";--2
when "0000000000000011" => LED <= "0110000";--3
when "0000000000000100" => LED <= "0011001";--4
when "0000000000000101" => LED <= "0010010";--5
when "0000000000000110" => LED <= "0000010";--6
when "0000000000000111" => LED <= "1111000";--7
when "0000000000001000" => LED <= "0000000";--8
when "0000000000001001" => LED <= "0010000";--9
when "0000000000001010" => LED <= "1000000";--10
when "0000000000001011" => LED <= "1111001";--11
when "0000000000001100" => LED <= "0100100";--12
--- ...until 100
when others => LED <= "1000000";
end case;
end process conv;
end table;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity LUT1 is
port(
clk: in std_logic;
led: out bit_vector(6 downto 0);
entrada: in std_logic_vector(5 downto 0));
end LUT1;
Architecture table of LUT1 is
constant max: integer := 50000000;--This are just for the first process
constant half: integer := max/2;--This are just for the first process
signal newclk: std_logic;--This are just for the first process
signal count: integer range 0 to max;--This are just for the first process
shared variable bcd: std_logic_vector (2 downto 0):="000";--This are just for the second process
shared variable aux: integer;--This are just for the second process
constant deu: std_logic_vector(5 downto 0):="001010";--constant to divide per 10 in binary
begin
divide: process--This process its only to divide the main clock of the main board.
begin
wait until clk'event and
clk='1';
if
count<max then count<=count + 1;
else count <= 0;
end if;
if count < half then newclk<='0';
else newclk <='1';
end if;
end process divide;
conv: process (newclk)--This process works like we shown you the last time, it's showing the number that you are entering by the switches but this time we just want to divide the number from the switches per 10 and then show the number.
begin
bcd := entrada / deu;-- Here we have the problem, we cannot divide this variable per 10, you know why? The compilator says that this operator "/" is not valid
case bcd is
when "0000000000000000" => LED <= "1000000";--0
when "0000000000000001" => LED <= "1111001";--1
when "0000000000000010" => LED <= "0100100";--2
when "0000000000000011" => LED <= "0110000";--3
when "0000000000000100" => LED <= "0011001";--4
when "0000000000000101" => LED <= "0010010";--5
when "0000000000000110" => LED <= "0000010";--6
when "0000000000000111" => LED <= "1111000";--7
when "0000000000001000" => LED <= "0000000";--8
when "0000000000001001" => LED <= "0010000";--9
when "0000000000001010" => LED <= "1000000";--10
when "0000000000001011" => LED <= "1111001";--11
when "0000000000001100" => LED <= "0100100";--12
--- ...until 100
when others => LED <= "1000000";
end case;
end process conv;
end table;