Line 59... |
Line 59... |
);
|
);
|
|
|
end component;
|
end component;
|
|
|
|
|
constant linefeed : integer range 0 to (SCREENW/2) := (SCREENW/2)-4;
|
constant linefeed : integer range 0 to (SCREENW/2) := (SCREENW/2)-2;
|
|
|
|
|
-- Support signals.
|
-- Support signals.
|
signal s1addf0 : std_logic_vector (13 downto 0); -- The function 0 is the function of the y component derivative.
|
signal s1addf0 : std_logic_vector (13 downto 0); -- The function 0 is the function of the y component derivative.
|
signal s1addf1 : std_logic_vector (13 downto 0); -- The function 1 is the function of the y component integration curve initial constant.
|
signal s1addf1 : std_logic_vector (13 downto 0); -- The function 1 is the function of the y component integration curve initial constant.
|
signal sf0 : std_logic_vector (0 downto 0); -- Derivative function
|
signal sf0 : std_logic_vector (0 downto 0); -- Derivative function
|
signal sf1 : std_logic_vector (0 downto 0); -- Derivative curve, initial constant derivative function.
|
signal sf1 : std_logic_vector (0 downto 0); -- Derivative curve, initial constant derivative function.
|
|
signal cc : integer range 0 to SCREENW/2;
|
|
signal f0 : integer range TOP/2 to TOP-1;
|
|
|
-- Some Initial Locks.
|
|
signal sneglock : std_logic;
|
|
begin
|
begin
|
|
|
|
-- Connect f0, to the output.
|
|
ypos <= f0;
|
|
|
derivate : yurom
|
derivate : yurom
|
port map (
|
port map (
|
address_a => s1addf0,
|
address_a => s1addf0,
|
address_b => s1addf1,
|
address_b => s1addf1,
|
clock => clk,
|
clock => clk,
|
q_a => sf0,
|
q_a => sf0,
|
q_b => sf1
|
q_b => sf1
|
);
|
);
|
|
|
integrate : process(clk,rst,ena)
|
|
|
|
variable f0 : integer range TOP/2 to TOP-1;
|
integrationControl : process (clk,rst,ena)
|
variable f1 : integer range TOP/2 to TOP-1;
|
variable f1 : integer range TOP/2 to TOP-1;
|
variable cc : integer range 0 to SCREENW/2;
|
|
|
|
begin
|
begin
|
|
|
if rst='0' then
|
if rst='0' then
|
|
|
f0:=TOP-10;
|
f0<=TOP-1;
|
f1:=TOP-1;
|
f1:=TOP-1;
|
cc:=linefeed;
|
lineDone<='0';
|
|
|
-- Right from the start.
|
elsif rising_edge(clk) and ena='1' then
|
s1addf0 (13 downto 1) <= (others=>'0'); -- 0000.
|
|
s1addf0 (0) <= '1';
|
|
s1addf1 <= "11111010000000"; -- 3E7F.
|
|
|
|
-- Locks
|
if cc=0 then
|
sneglock<='0';
|
lineDone<='1';
|
|
if sf1(0) ='1' then
|
|
f1 := f1 - 1;
|
|
end if;
|
|
f0 <= f1;
|
|
|
|
else
|
|
lineDone<='0';
|
|
if sf0(0) = '1' then
|
|
f0 <= f0-1;
|
|
end if;
|
|
|
elsif rising_edge(clk) and ena='1' then --ADD!
|
end if;
|
|
|
|
|
-- Count f0 address
|
|
if sneglock='1' then
|
|
s1addf0 <= s1addf0+1;
|
|
end if;
|
|
|
|
-- Count f1 address (156)
|
|
if cc=linefeed then
|
|
s1addf1 <= s1addf1+1;
|
|
end if;
|
end if;
|
|
|
-- Unlock first stage f0 address (157)
|
|
if cc=linefeed+1 then
|
|
sneglock<='1';
|
|
end if;
|
|
|
|
-- Now, the integration function, cause we are at a new line..
|
end process;
|
if cc = 0 then
|
|
ypos <= f1;
|
counterControl : process (clk,rst,ena)
|
f0 := f1;
|
begin
|
|
|
|
if rst='0' then
|
|
|
|
cc<=0;
|
|
|
|
elsif rising_edge(clk) and ena='1' then
|
|
if cc=(SCREENW/2)-1 then
|
|
cc<=0;
|
else
|
else
|
ypos <= f0;
|
cc<=cc+1;
|
if sf0(0)='1' then
|
|
f0 := f0 - 1;
|
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
-- Count when reach linefeed +3 (159) then turn cc into 0, else turn it into cc+1!
|
end process;
|
if cc=linefeed+3 then
|
|
lineDone <='1';
|
addressControl : process (clk,rst,ena)
|
if sf1(0) = '1' then
|
begin
|
f1 := f1 - 1;
|
if rst='0' then
|
end if;
|
-- Right from the start.
|
cc:=0;
|
s1addf0 (13 downto 1) <= (others=>'0'); -- 00001.
|
else
|
s1addf0 (0) <= '1';
|
lineDone <='0';
|
s1addf1 <= "11111010000000"; -- 3E80.
|
cc:=cc+1;
|
|
|
elsif rising_edge(clk) and ena='1' then
|
|
|
|
s1addf0 <= s1addf0+1;
|
|
-- Count f1 address (158)
|
|
if cc=linefeed then
|
|
s1addf1 <= s1addf1+1;
|
end if;
|
end if;
|
|
|
end if;
|
end if;
|
|
|
end process;
|
end process;
|
|
|
|
|
|
|
|
|
|
|
|
|
end rtl;
|
end rtl;
|
|
|
|
|
|
|
|
|