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

Subversion Repositories pdp8

[/] [pdp8/] [trunk/] [pdp8/] [cpu/] [mb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 trurl
------------------------------------------------------------------
2
--!
3
--! PDP-8 Processor
4
--!
5
--! \brief
6
--!      CPU Memory Buffer (MB) Register
7
--!
8
--! \details
9
--!      The Memory Buffer (MB) Register contains the data to be
10
--!      asserted onto the Data Bus during a write operation.
11
--!
12
--! \file
13
--!      mb.vhd
14
--!
15
--! \author
16
--!      Rob Doyle - doyle (at) cox (dot) net
17
--!
18
--------------------------------------------------------------------
19
--
20
--  Copyright (C) 2009, 2010, 2011, 2012 Rob Doyle
21
--
22
-- This source file may be used and distributed without
23
-- restriction provided that this copyright statement is not
24
-- removed from the file and that any derivative work contains
25
-- the original copyright notice and the associated disclaimer.
26
--
27
-- This source file is free software; you can redistribute it
28
-- and/or modify it under the terms of the GNU Lesser General
29
-- Public License as published by the Free Software Foundation;
30
-- version 2.1 of the License.
31
--
32
-- This source is distributed in the hope that it will be
33
-- useful, but WITHOUT ANY WARRANTY; without even the implied
34
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
35
-- PURPOSE. See the GNU Lesser General Public License for more
36
-- details.
37
--
38
-- You should have received a copy of the GNU Lesser General
39
-- Public License along with this source; if not, download it
40
-- from http://www.gnu.org/licenses/lgpl.txt
41
--
42
--------------------------------------------------------------------
43
--
44
-- Comments are formatted for doxygen
45
--
46
 
47
library ieee;                                   --! IEEE Library
48
use ieee.std_logic_1164.all;                    --! IEEE 1164
49
use ieee.numeric_std.all;                       --! IEEE Numeric Standard
50
use work.cpu_types.all;                         --! Types
51
 
52
--
53
--! CPU Memory Buffer (MB) Register Entity
54
--
55
 
56
entity eMB is port (
57
    sys  : in  sys_t;                           --! Clock/Reset
58
    mbOP : in  mbOP_t;                          --! MB Operation
59
    AC   : in  data_t;                          --! AC Register
60
    MA   : in  addr_t;                          --! MA Register
61
    MD   : in  data_t;                          --! MD Register
62
    MQ   : in  data_t;                          --! MQ Register
63
    PC   : in  addr_t;                          --! PC Register
64
    SR   : in  data_t;                          --! SR Register
65
    MB   : out data_t                           --! MB Output
66
);
67
end eMB;
68
 
69
--
70
--! CPU Memory Buffer (MB) Register RTL
71
--
72
 
73
architecture rtl of eMB is
74
 
75
    signal mbREG : data_t;                      --! Memory Buffer Register
76
    signal addMUX1 : addr_t;                    --! Adder Mux #1
77
    signal addMUX2 : addr_t;                    --! Adder Mux #2
78
 
79
begin
80
 
81
    --
82
    -- Adder input #1 mux.
83
    -- This synthesizes into a ROM
84
    --
85
 
86
    with mbOP select
87
        addMUX1 <= o"0000" when mbopNOP,        -- MB <- MB
88
                   o"0000" when mbopAC,         -- MB <- AC
89
                   o"0000" when mbopMA,         -- MB <- MA
90
                   o"0000" when mbopMD,         -- MB <- MD
91
                   o"0000" when mbopMQ,         -- MB <- MQ
92
                   o"0000" when mbopPC,         -- MB <- PC
93
                   o"0000" when mbopSR,         -- MB <- SR
94
                   o"0001" when mbopMDP1,       -- MB <- MD + 1
95
                   o"0001" when mbopPCP1;       -- MB <- PC + 1
96
 
97
    --
98
    -- Adder input #2 mux.
99
    --
100
 
101
    with mbOP select
102
        addMUX2 <= mbREG   when mbopNOP,        -- MB <- MB
103
                   AC      when mbopAC,         -- MB <- AC
104
                   MA      when mbopMA,         -- MB <- MA
105
                   MD      when mbopMD,         -- MB <- MD
106
                   MQ      when mbopMQ,         -- MB <- MQ
107
                   PC      when mbopPC,         -- MB <- PC
108
                   SR      when mbopSR,         -- MB <- SR
109
                   MD      when mbopMDP1,       -- MB <- MD + 1
110
                   PC      when mbopPCP1;       -- MB <- PC + 1
111
 
112
    --
113
    --! MB Register
114
    --
115
 
116
    REG_MB : process(sys)
117
    begin
118
        if sys.rst = '1' then
119
            mbREG <= (others => '0');
120
        elsif rising_edge(sys.clk) then
121
            mbREG <= std_logic_vector(unsigned(addMUX2) + unsigned(addMUX1));
122
        end if;
123
    end process REG_MB;
124
 
125
    MB <= mbREG;
126
 
127
end rtl;

powered by: WebSVN 2.1.0

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