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

Subversion Repositories mcu8

[/] [mcu8/] [trunk/] [src/] [reg.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 reg is
7
  port( clk, rst : IN std_logic;        -- high-active asynch rst
8
--        a_in : in d_bus; -- register a
9
--        b_in : in d_bus; -- register b
10
        result_in : d_bus;
11 13 dimo
        rom_data_in : d_bus;
12 2 dimo
        carry_in : IN std_logic;
13
        zero_in : in std_logic;
14
        a_out : out d_bus; -- register a
15
        b_out : out d_bus; -- register b
16
        carry_out : out std_logic;
17
        zero_out : out STD_LOGIC;
18
        control : IN opcode );          -- extend the control from the CU
19
end reg;
20
 
21
 
22
architecture behavioral of reg is
23 13 dimo
  signal rom_data_intern : d_bus;
24 2 dimo
begin
25 13 dimo
 
26
reg_rom: process(clk)
27
begin
28
  if clk'event and clk='1' then
29
    if rst='1' then
30
      rom_data_intern <= (others => '0');
31
    else
32
      rom_data_intern <= rom_data_in;
33
    end if;
34
  end if;
35
end process;
36
 
37
 
38
reg_p: process(clk)
39 2 dimo
  BEGIN
40 13 dimo
    IF clk'EVENT AND clk='1' THEN
41
      if rst='1' THEN
42
        a_out <= (OTHERS => '0');
43
        b_out <= (OTHERS => '0');
44
        zero_out <= '0';
45
        carry_out <= '0';
46
      else
47
        CASE control IS
48
          WHEN neg_s | and_s | exor_s | or_s | sra_s | ror_s | add_s | addc_s =>
49
            zero_out <= zero_in;
50
            a_out <= result_in;
51
            carry_out <= carry_in;
52
 
53
          WHEN lda_const_2 => zero_out <= zero_in;
54
                              a_out <= rom_data_intern;
55
                              carry_out <= carry_in;
56 19 dimo
          when lda_const_1 => zero_out <= zero_in;
57 13 dimo
          WHEN ldb_const_2 => zero_out <= zero_in;
58
                              b_out <= rom_data_intern;
59
                              carry_out <= carry_in;
60 19 dimo
          WHEN lda_addr_2 =>  zero_out <= zero_in;
61
                              a_out <= result_in;
62
                              carry_out <= carry_in;
63
          WHEN ldb_addr_2 =>  zero_out <= zero_in;
64
                              b_out <= result_in;
65
                              carry_out <= carry_in;
66 13 dimo
          WHEN OTHERS => NULL;
67
        END CASE;
68
      END if;
69
    end if;
70 2 dimo
end process;
71
end behavioral;
72
 
73
 

powered by: WebSVN 2.1.0

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