AthiraMajinu
Newbie level 2
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.std_logic_unsigned.all;
entity corr is
port(clock:in bit;
reset: in bit;
csum : out integer);
end corr;
architecture corr_beh of corr is
signal dcount, intsum : integer := 0;
signal lfsr_reg1: unsigned(9 downto 0):= (others=>'1');
signal lfsr_reg2 : unsigned(9 downto 0):= (others=>'1');
begin
process (clock, reset,lfsr_reg1,lfsr_reg2)
begin
if reset = '0'then
dcount<= 0;
intsum<= 0;
elsif clock'event and clock = '1' then
dcount<= dcount + 1;
intsum<= intsum + to_integer(unsigned(lfsr_reg1 * lfsr_reg2));
if dcount = 1022 then
dcount<= 0;
intsum<= 0;
csum<= intsum;
end if;
end if;
end process;
end corr_beh;
- - - Updated - - -
its a program for cross correlation
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.std_logic_unsigned.all;
entity corr is
port(clock:in bit;
reset: in bit;
csum : out integer);
end corr;
architecture corr_beh of corr is
signal dcount, intsum : integer := 0;
signal lfsr_reg1: unsigned(9 downto 0):= (others=>'1');
signal lfsr_reg2 : unsigned(9 downto 0):= (others=>'1');
begin
process (clock, reset,lfsr_reg1,lfsr_reg2)
begin
if reset = '0'then
dcount<= 0;
intsum<= 0;
elsif clock'event and clock = '1' then
dcount<= dcount + 1;
intsum<= intsum + to_integer(unsigned(lfsr_reg1 * lfsr_reg2));
if dcount = 1022 then
dcount<= 0;
intsum<= 0;
csum<= intsum;
end if;
end if;
end process;
end corr_beh;
- - - Updated - - -
its a program for cross correlation