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 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rrpollack
`timescale 1ns / 1ps
2
`default_nettype none
3
////////////////////////////////////////////////////////////////////////
4 6 rrpollack
//
5 2 rrpollack
// 4004 Timing and I/O Interfaces
6 6 rrpollack
//
7 2 rrpollack
// This file is part of the MCS-4 project hosted at OpenCores:
8
//      http://www.opencores.org/cores/mcs-4/
9 6 rrpollack
//
10
// Copyright © 2012, 2021 by Reece Pollack <rrpollack@opencores.org>
11
//
12 2 rrpollack
// These materials are provided under the Creative Commons
13 6 rrpollack
// "Attribution-NonCommercial-ShareAlike" (CC BY-NC-SA) Public License.
14
// They are NOT "public domain", and are protected by copyright.
15
//
16 2 rrpollack
// 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 6 rrpollack
    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 wire         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 2 rrpollack
    );
60
 
61 6 rrpollack
    // 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 2 rrpollack
 
70
 
71 6 rrpollack
    // Generate the 8 execution phase indicators
72
    timing_generator timing_generator (
73
        .sysclk (sysclk),
74
        .clk1   (clk1),
75
        .clk2   (clk2),
76
        .a12    (a12),
77
        .a22    (a22),
78
        .a32    (a32),
79
        .m12    (m12),
80
        .m22    (m22),
81
        .x12    (x12),
82
        .x22    (x22),
83
        .x32    (x32),
84
        .sync   (sync_pad)
85
    );
86 2 rrpollack
 
87 6 rrpollack
    // Generate the DRAM Input Gate signal
88
    // Properly called M12+M22+CLK1~(M11&M12)
89
    wire n0279 = ~(a32 | m12);
90
    reg n0278;
91
    always @(posedge sysclk) begin
92
        if (clk2)
93
            n0278 <= n0279;
94
    end
95
    wire n0708 = ~((n0278 & clk1) | m12 | m22);
96
    assign gate = ~n0708;
97 2 rrpollack
 
98
 
99 6 rrpollack
    // Generate a clean POC signal
100
    always @(posedge sysclk or posedge poc_pad) begin
101
        if (poc_pad)    poc <= 1'b1;
102
        else if (a12)   poc <= 1'b0;
103
    end
104 2 rrpollack
 
105 6 rrpollack
    // Generate a clean ~TEST signal (n0432)
106
    always @(posedge sysclk) begin
107
        n0432 <= ~test_pad;
108
    end
109 2 rrpollack
 
110 6 rrpollack
    // Manage the Data I/O pads
111
    reg L;
112
    always @(posedge sysclk) begin
113
        if (clk2)
114
            L <= a32 | m12 | (x12 & (ior | poc));
115
    end
116 2 rrpollack
 
117 6 rrpollack
    wire n0702 = ~clk2;
118
    reg n0685;
119
    reg n0699;
120
    reg n0707;
121
    always @(posedge sysclk) begin
122
        if (clk1) begin
123
            n0685 <= ~L;
124
            n0707 <=  L;
125
        end
126
        if (n0702)
127
            n0699 <= ~L;
128
    end
129
    wire n0700 = n0707 | (L & n0702) | poc;
130
    wire n0659 = (clk2 & n0685) | (clk1 & L);
131
    wire n0676 = clk1 | n0685 | n0699;
132 2 rrpollack
 
133 6 rrpollack
    // Incoming data from the external pads
134
    reg [3:0] data_in;
135
    always @* begin
136
        if (n0659)      data_in = 4'b1111;
137
        else if (n0676) data_in = 4'bzzzz;
138
        else if (poc)   data_in = 4'b0000;
139
        else            data_in = data_pad;
140
    end
141
    assign data = data_in;
142 2 rrpollack
 
143 6 rrpollack
    // Outgoing data to the external pads
144
    reg [3:0] data_out;
145
    always @(posedge sysclk) begin
146
        if (n0702)
147
            data_out <= data;
148
    end
149
    assign data_pad = poc ? 4'b0000 : (n0700 ? 4'bzzzz : data_out);
150 2 rrpollack
 
151
endmodule

powered by: WebSVN 2.1.0

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