OpenCores
URL https://opencores.org/ocsvn/jart/jart/trunk

Subversion Repositories jart

[/] [jart/] [branches/] [ver0branch/] [zu.vhd] - Blame information for rev 72

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 72 jguarin200
-- Author : Julian Andres Guarin Reyes.
2
-- Project : JART, Just Another Ray Tracer.
3
-- email : jguarin2002 at gmail.com, j.guarin at javeriana.edu.co
4
 
5
-- This code was entirely written by Julian Andres Guarin Reyes.
6
-- The following code is licensed under GNU Public License
7
-- http://www.gnu.org/licenses/gpl-3.0.txt.
8
 
9
 -- This file is part of JART (Just Another Ray Tracer).
10
 
11
    -- JART (Just Another Ray Tracer) is free software: you can redistribute it and/or modify
12
    -- it under the terms of the GNU General Public License as published by
13
    -- the Free Software Foundation, either version 3 of the License, or
14
    -- (at your option) any later version.
15
 
16
    -- JART (Just Another Ray Tracer) is distributed in the hope that it will be useful,
17
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
    -- GNU General Public License for more details.
20
 
21
    -- You should have received a copy of the GNU General Public License
22
    -- along with JART (Just Another Ray Tracer).  If not, see <http://www.gnu.org/licenses/>.library ieee;
23
 
24
-- Zu synthesises the z and x components of the unitary vectors along an image vertical and/or horizontal line respectively. 
25
-- For the jart project Zu must be used with the following values:
26
-- When synthesising X , VALSTART must be 34, when synthesising Z, VALSTART must be 4.  
27
 
28
 
29
library ieee;
30 70 jguarin200
use ieee.std_logic_1164.all;
31
use ieee.std_logic_signed.all;
32
 
33
 
34
entity zu is
35
        generic
36
        (
37 72 jguarin200
                VALSTART                : integer := 15
38 70 jguarin200
        );
39
        port (
40
 
41
                clk, rst, ena   : in std_logic; -- The usual control signals
42
                clr                             : in std_logic;
43 72 jguarin200
                zpos                    : out integer range -1024 to 1023;
44
                zneg                    : out integer range -1024 to 1023
45 70 jguarin200
        );
46
 
47
end entity;
48
 
49
architecture rtl of zu is
50
 
51
begin
52
 
53
        process (clk,rst,ena,clr)
54 72 jguarin200
                variable pivot  : integer range 0 to 31;
55
                variable z      : integer range  -1024 to 1023;
56 70 jguarin200
        begin
57
 
58
                if rst='0' then
59
 
60
                        zpos<=VALSTART;
61 72 jguarin200
                        zneg<=-VALSTART;
62 70 jguarin200
                        z:=VALSTART;
63 72 jguarin200
                        pivot:=0;
64 70 jguarin200
 
65
                elsif rising_edge(clk) and ena='1' then
66
 
67
                        if clr='1' then
68
                                z:=VALSTART;
69
                                pivot:=0;
70 72 jguarin200
                        elsif pivot = 0 then
71
                                z:=z+3;
72
                                pivot:=1;
73
                        else
74 70 jguarin200
                                z:=z+2;
75 72 jguarin200
                                pivot:=0;
76 70 jguarin200
                        end if;
77
 
78
                        zpos <= z;
79 72 jguarin200
                        zneg <=-z;
80 70 jguarin200
                end if;
81
 
82
        end process;
83
 
84
end rtl;
85
 
86
 
87
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.