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

Subversion Repositories jart

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

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

Line No. Rev Author Line
1 70 jguarin200
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_signed.all;
4
 
5
 
6
entity zu is
7
        generic
8
        (
9
                VALSTART                : integer := 2
10
        );
11
        port (
12
 
13
                clk, rst, ena   : in std_logic; -- The usual control signals
14
                clr                             : in std_logic;
15
                zpos                    : out integer range 0 to 1023
16
 
17
        );
18
 
19
end entity;
20
 
21
architecture rtl of zu is
22
 
23
begin
24
 
25
        process (clk,rst,ena,clr)
26
                variable pivot  : integer range 0 to 15;
27
                variable z              : integer range 0 to 1023;
28
        begin
29
 
30
                if rst='0' then
31
 
32
                        zpos<=VALSTART;
33
                        z:=VALSTART;
34
                        pivot:=1;
35
 
36
                elsif rising_edge(clk) and ena='1' then
37
 
38
                        if clr='1' then
39
                                z:=VALSTART;
40
                                pivot:=0;
41
                        elsif pivot=4 then
42
                                z:=z+2;
43
                        elsif pivot=9 then
44
                                z:=z+1;
45
                        else
46
                                z:=z+3;
47
                        end if;
48
 
49
                        if pivot = 9 then
50
                                pivot := 0;
51
                        else
52
                                pivot:=pivot+1;
53
                        end if;
54
                        zpos <= z;
55
 
56
                end if;
57
 
58
        end process;
59
 
60
end rtl;
61
 
62
 
63
 

powered by: WebSVN 2.1.0

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