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

Subversion Repositories mipsr2000

[/] [mipsr2000/] [trunk/] [pc.vhd] - Blame information for rev 23

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 jimi39
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:       Lazaridis Dimitris
4
-- 
5
-- Create Date:    00:52:08 06/13/2012 
6
-- Design Name: 
7
-- Module Name:    pc - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
--use IEEE.STD_LOGIC_UNSIGNED.ALL;
23
 
24
use IEEE.numeric_std.all;
25
--use IEEE.STD_LOGIC_ARITH.ALL;
26
use IEEE.STD_LOGIC_UNSIGNED.ALL;
27
-- Uncomment the following library declaration if using
28
-- arithmetic functions with Signed or Unsigned values
29
--use IEEE.NUMERIC_STD.ALL;
30
 
31
-- Uncomment the following library declaration if instantiating
32
-- any Xilinx primitives in this code.
33
--library UNISIM;
34
--use UNISIM.VComponents.all;
35
 
36
entity pc is
37
    Port ( clk : in  STD_LOGIC;
38
                rst : in  STD_LOGIC;
39
                          npc : in std_logic_vector(31 downto 0);
40
                          PCWrite : in  STD_LOGIC;
41
                          Err : out STD_LOGIC;
42
                          N : out std_logic_vector(31 downto 0);
43
                address : out std_logic_vector(12 downto 0)
44
                        );
45
end pc;
46
 
47
architecture Behavioral of pc is
48
begin
49
 
50
      process(clk,rst,npc,PCWrite)
51
                variable  addr : std_logic_vector(12 downto 0) := "0000000000000";
52
                variable fix_addr :std_logic_vector(31 downto 0);
53
                begin
54
                if rst = '0' then
55
         addr := "0000000000000";
56
                        N <= "00000000000000000000000000000000";
57
                  elsif (RISING_EDGE(clk))then
58
              if PCWrite = '1' then
59
                                    if npc(31 downto 13) > "0000000000000000001" then
60
                                    Err <= '1';  --to soft reset cpu in conjuction with Fsm
61
                                         --elsif program_on = '1' then
62
                                         --addr :=  "0000010001100"; 
63
                                         else
64
                                    addr :=  npc(12 downto 0);
65
                                         end if;
66
              end if;
67
      end if;
68
 
69
          if rst /= '0' then
70
                          if (FALLING_EDGE(clk))then
71
                               if PCWrite /= '1' then
72
                                      fix_addr(12 downto 0) := addr + "100";
73
                                      fix_addr(31 downto 13) := "0000000000000000000";
74
                                 N(31 downto 0) <= fix_addr;
75
                                    end if;
76
                          end if;
77
         end if;
78
                          address <= addr;
79
                end process;
80
 
81
 
82
end Behavioral;
83
 

powered by: WebSVN 2.1.0

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