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

Subversion Repositories cowgirl

[/] [cowgirl/] [trunk/] [pc.vhdl] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 thebeekeep
-- 10/24/2005
2
-- Program Counter
3
 
4
library ieee;
5
use ieee.std_logic_1164.all;
6
use ieee.std_logic_arith.all;
7
 
8
entity pc is port(
9
        reset:  in std_logic;
10
        clk:    in std_logic;
11
        load:   in std_logic;
12
        d:      in std_logic_vector(15 downto 0);
13
        c:      out std_logic_vector(15 downto 0)
14
);
15
end pc;
16
 
17
architecture pc_arch of pc is
18
 
19
signal count: unsigned(15 downto 0);
20
  --signal count : std_logic_vector(15 downto 0);
21
 
22
begin
23
        count_logic:process(clk, reset, load)
24
        begin
25
                if reset = '1' then
26
                        count <= x"0000";
27
                elsif (clk'EVENT and clk='1') then
28
                        count <= count + '1';
29
                elsif load = '1' then
30
                        count <= unsigned(d);
31
                end if;
32
                -- don't assign the output here!
33
                -- if you do, the count will change on the falling
34
                -- edge of the clock!  and that's lame!
35
                --c <= count;
36
        end process count_logic;
37
        c <= std_logic_vector(count);
38
end pc_arch;

powered by: WebSVN 2.1.0

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