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

Subversion Repositories ourisc

[/] [ourisc/] [trunk/] [rtl/] [program_counter.vhd] - Blame information for rev 9

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

Line No. Rev Author Line
1 7 joaocarlos
----------------------------------------------------------------------------------
2
-- Engineer: Joao Carlos Nunes Bittencourt
3
----------------------------------------------------------------------------------
4
-- Create Date:    13:18:18 03/06/2012 
5
----------------------------------------------------------------------------------
6
-- Design Name:    Program Counter
7 8 joaocarlos
-- Module Name:    program_counter - behavioral 
8 7 joaocarlos
----------------------------------------------------------------------------------
9
-- Project Name:   16-bit uRISC Processor
10
----------------------------------------------------------------------------------
11
-- Revision: 
12
--      1.0 - File Created
13
--      2.0 - Project refactoring
14
--
15
----------------------------------------------------------------------------------
16
library ieee;
17
use ieee.std_logic_1164.all;
18
use ieee.std_logic_arith.all;
19
 
20
entity program_counter is
21
        generic(
22
            DATA_WIDTH : integer := 16
23
        );
24
        port (
25
                sink_pc         : in std_logic_vector(DATA_WIDTH-1 downto 0);
26
                clk                     : in std_logic;
27
                enable          : in std_logic;
28
                reset           : in std_logic;
29
                src_pc      : out std_logic_vector(DATA_WIDTH-1 downto 0)
30
        );
31
 
32
end program_counter;
33
 
34
architecture behavioral of program_counter is
35
begin
36
        process(clk,enable)
37
                variable counter : std_logic_vector (DATA_WIDTH-1 downto 0) := conv_std_logic_vector(0,DATA_WIDTH);
38
        begin
39
                src_pc <= counter;
40
                if(clk='1' and clk'event) then
41
                        if(reset = '1') then
42
                                counter := conv_std_logic_vector(0,DATA_WIDTH);
43
                        else
44
                                if(enable = '1') then
45
                                        counter := sink_pc;
46
                                end if;
47
                        end if;
48
                end if;
49
        end process;
50
end behavioral;

powered by: WebSVN 2.1.0

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