OpenCores
URL https://opencores.org/ocsvn/mcs-4/mcs-4/trunk

Subversion Repositories mcs-4

[/] [mcs-4/] [trunk/] [rtl/] [verilog/] [i4004/] [timing_io.v] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 rrpollack
`timescale 1ns / 1ps
2
`default_nettype none
3
////////////////////////////////////////////////////////////////////////
4
// 
5
// 4004 Timing and I/O Interfaces
6
// 
7
// This file is part of the MCS-4 project hosted at OpenCores:
8
//      http://www.opencores.org/cores/mcs-4/
9
// 
10 4 rrpollack
// Copyright © 2012, 2020 by Reece Pollack <rrpollack@opencores.org>
11 2 rrpollack
// 
12
// These materials are provided under the Creative Commons
13
// "Attribution-NonCommercial-ShareAlike" Public License. They
14
// are NOT "public domain" and are protected by copyright.
15
// 
16
// This work based on materials provided by Intel Corporation and
17
// others under the same license. See the file doc/License for
18
// details of this license.
19
//
20
////////////////////////////////////////////////////////////////////////
21
 
22
module timing_io(
23
        input  wire                     sysclk,
24
        input  wire                     clk1_pad,
25
        input  wire                     clk2_pad,
26
        input  wire                     poc_pad,
27
        input  wire                     ior,
28
 
29
        // Timing and I/O Board Outputs
30
        output wire                     clk1,
31
        output wire                     clk2,
32
        output wire                     a12,
33
        output wire                     a22,
34
        output wire                     a32,
35
        output wire                     m12,
36
        output wire                     m22,
37
        output wire                     x12,
38
        output wire                     x22,
39
        output wire                     x32,
40
        output wire                     gate,
41
        output reg                      poc,
42
 
43
        // External I/O Pad conditioning
44
        inout  wire     [3:0]    data,
45
        inout  wire [3:0]        data_pad,
46
        input  wire                     test_pad,
47
        output reg                      n0432,
48
        output reg                      sync_pad,
49
        input  wire                     cmrom,
50
        output wire                     cmrom_pad,
51
        input  wire                     cmram0,
52
        output wire                     cmram0_pad,
53
        input  wire                     cmram1,
54
        output wire                     cmram1_pad,
55
        input  wire                     cmram2,
56
        output wire                     cmram2_pad,
57
        input  wire                     cmram3,
58
        output wire                     cmram3_pad
59
    );
60
 
61
        // Simple pass-throughs
62
        assign clk1 = clk1_pad;
63
        assign clk2 = clk2_pad;
64
        assign cmrom_pad  = cmrom;
65
        assign cmram0_pad = cmram0;
66
        assign cmram1_pad = cmram1;
67
        assign cmram2_pad = cmram2;
68
        assign cmram3_pad = cmram3;
69
 
70
 
71
        // Generate the 8 execution phase indicators
72
        reg [0:7] master = 8'h00;
73
        reg [0:7] slave  = 8'h00;
74
        always @(posedge sysclk) begin
75
                if (clk2)
76
                        master <= {~|slave[0:6], slave[0:6]};
77
                else
78
                        sync_pad <= master[7];
79
 
80
                if (clk1)
81
                        slave <= master;
82
        end
83
 
84
        assign a12 = slave[0];
85
        assign a22 = slave[1];
86
        assign a32 = slave[2];
87
        assign m12 = slave[3];
88
        assign m22 = slave[4];
89
        assign x12 = slave[5];
90
        assign x22 = slave[6];
91
        assign x32 = slave[7];
92
 
93
 
94
        // Generate the DRAM Input Gate signal
95
        // Properly called M12+M22+CLK1~(M11&M12)
96
        wire n0279 = ~(a32 | m12);
97
        reg n0278;
98
        always @(posedge sysclk) begin
99
                if (clk2)
100
                        n0278 <= n0279;
101
        end
102
        wire n0708 = ~((n0278 & clk1) | m12 | m22);
103
        assign gate = ~n0708;
104
 
105
 
106
        // Generate a clean POC signal
107
        always @(posedge sysclk) begin
108
                if (poc_pad)    poc <= 1'b1;
109
                else if (a12)   poc <= 1'b0;
110
                else                    poc <= poc;
111
        end
112
 
113
        // Generate a clean ~TEST signal (n0432)
114
        always @(posedge sysclk) begin
115
                n0432 <= ~test_pad;
116
        end
117
 
118
        // Manage the Data I/O pads
119
        reg L;
120
        always @(posedge sysclk) begin
121
                if (clk2)
122
                        L <= a32 | m12 | (x12 & (ior | poc));
123
        end
124
 
125
        wire n0702 = ~clk2;
126
        reg n0685;
127
        reg n0699;
128
        reg n0707;
129
        always @(posedge sysclk) begin
130
                if (clk1) begin
131
                        n0685 <= ~L;
132
                        n0707 <=  L;
133
                end
134
                if (n0702)
135
                        n0699 <= ~L;
136
        end
137
        wire n0700 = n0707 | (L & n0702) | poc;
138
        wire n0659 = (clk2 & n0685) | (clk1 & L);
139
        wire n0676 = clk1 | n0685 | n0699;
140
 
141
        // Incoming data from the external pads
142
        reg [3:0] data_in;
143
        always @* begin
144
                if (n0659)              data_in = 4'b1111;
145
                else if (n0676) data_in = 4'bzzzz;
146
                else if (poc)   data_in = 4'b0000;
147
                else                    data_in = data_pad;
148
        end
149
        assign data = data_in;
150
 
151
        // Outgoing data to the external pads
152
        reg [3:0] data_out;
153
        always @(posedge sysclk) begin
154
                if (n0702)
155
                        data_out <= data;
156
        end
157
        assign data_pad = poc ? 4'b0000 : (n0700 ? 4'bzzzz : data_out);
158
 
159
endmodule

powered by: WebSVN 2.1.0

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