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

Subversion Repositories mcu8

[/] [mcu8/] [trunk/] [src/] [pc.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimo
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
USE work.cpu_types.ALL;
5
 
6
entity pc is
7
  port( clk, rst : IN std_logic;        -- high-active asynch rst
8
        addr_in : in d_bus; -- new address
9
        control : IN opcode;          -- extend the control from the CU
10
        pc : OUT d_bus );
11
end pc;
12
 
13
 
14
architecture behavioral of pc is
15
begin
16 13 dimo
pc_p: process(clk)
17
  VARIABLE pc_int : d_bus;
18
BEGIN
19
  IF clk'EVENT AND clk='1' THEN
20
    if rst='1' then
21 2 dimo
      pc_int := zero_bus;
22 13 dimo
    else
23 2 dimo
      CASE control IS
24
--        WHEN  nop | neg_s | and_s | exor_s | or_s | sra_s | ror_s | add_s | addc_s | sta_1 => pc_int := pc_int + 1;
25 7 dimo
        WHEN jmp_2 | jmpc_2 | jmpz_2 => pc_int := addr_in;
26
--        WHEN lda_addr_2 | ldb_addr_2 => null;                                        
27
        WHEN jnt => pc_int := std_logic_vector(unsigned(unsigned(pc_int) + to_unsigned(2,d_bus_width))); -- jump not taken
28 2 dimo
        WHEN OTHERS => pc_int := std_logic_vector(unsigned(unsigned(pc_int) + to_unsigned(1,d_bus_width)));
29
      END CASE;
30
    END IF;
31 13 dimo
  end if;
32
  pc <= pc_int;
33 2 dimo
END process;
34
end behavioral;
35
 
36
 

powered by: WebSVN 2.1.0

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