- Joined
- Jan 24, 2011
- Messages
- 2
- Reaction score
- 0
Hello I'm new in this forum and recently I received an assigment for my Digital Systems Class. Its common to use in C/C++ or any high level language, a notation like cont = cont + 1. But my professor has prohibited the use of any library but std_logic_1164. I need to run a count of 32-bit and I have a component that can sum 32-bit, but I don't have any idea of how to perform it. Normally I will use
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
...
signal tmp : std_logic_vector(31 downto 0);
process(clk, rst)
begin
...
if tmp >= x"FFFFFFFF" then
tmp <= x"00000000";
else
tmp <= tmp + '1';
end if;
...
But I can't do that, at the moment I have something like
library ieee;
use ieee.std_logic_1164.all;
...
signal tmp, tmp2 : std_logic_vector(31 downto 0);
signal caux : std_logic;
component fullAdder32 is port(
a32, b32 : in std_logic_vector(31 downto 0);
s32 : out std_logic_vector(31 downto 0);
cout : out std_logic);
end component;
begin
f32 : fullAdder32 port map (tmp, 0x"00000001", tmp2, caux);
process(clk, rst)
begin
...
if tmp >= x"FFFFFFFF" then
tmp <= x"00000000";
else
tmp <= tmp2;
end if;
Is there a correct way to perform that because my code "compile" but with the instruction of "tmp <= tmp2" give a report of 100 macrocells and I only have 64 in the CPLD (Altera MAX3000). Without that instruction the fitter shows 20/64. Using, tmp = tmp + '1', the fitter shows (67/64). So I will appreciate any advice or sample you can show. Thanks in advance
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
...
signal tmp : std_logic_vector(31 downto 0);
process(clk, rst)
begin
...
if tmp >= x"FFFFFFFF" then
tmp <= x"00000000";
else
tmp <= tmp + '1';
end if;
...
But I can't do that, at the moment I have something like
library ieee;
use ieee.std_logic_1164.all;
...
signal tmp, tmp2 : std_logic_vector(31 downto 0);
signal caux : std_logic;
component fullAdder32 is port(
a32, b32 : in std_logic_vector(31 downto 0);
s32 : out std_logic_vector(31 downto 0);
cout : out std_logic);
end component;
begin
f32 : fullAdder32 port map (tmp, 0x"00000001", tmp2, caux);
process(clk, rst)
begin
...
if tmp >= x"FFFFFFFF" then
tmp <= x"00000000";
else
tmp <= tmp2;
end if;
Is there a correct way to perform that because my code "compile" but with the instruction of "tmp <= tmp2" give a report of 100 macrocells and I only have 64 in the CPLD (Altera MAX3000). Without that instruction the fitter shows 20/64. Using, tmp = tmp + '1', the fitter shows (67/64). So I will appreciate any advice or sample you can show. Thanks in advance