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

Subversion Repositories mcs-4

[/] [mcs-4/] [trunk/] [rtl/] [verilog/] [common/] [timing_generator.v] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 rrpollack
`timescale 1ns / 1ps
2
`default_nettype none
3
////////////////////////////////////////////////////////////////////////
4
//
5
// MCS-4 clock phase generator module
6
//
7
// This file is part of the MCS-4 project hosted at OpenCores:
8
//      http://www.opencores.org/cores/mcs-4/
9
//
10
// Copyright © 2021 by Reece Pollack <rrpollack@opencores.org>
11
//
12
// These materials are provided under the Creative Commons
13
// "Attribution-NonCommercial-ShareAlike" (CC BY-NC-SA) Public License.
14
// They 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
/*
23
 *  Generate the clock phase timing internal to the i4004 CPU
24
 */
25
module timing_generator (
26
    input  wire     sysclk, // System clock
27
    input  wire     clk1,   // Clock phase 1
28
    input  wire     clk2,   // Clock phase 2
29
 
30
    output reg      a11,
31
    output reg      a12,
32
    output reg      a21,
33
    output reg      a22,
34
    output reg      a31,
35
    output reg      a32,
36
 
37
    output reg      m11,
38
    output reg      m12,
39
    output reg      m21,
40
    output reg      m22,
41
 
42
    output reg      x11,
43
    output reg      x12,
44
    output reg      x21,
45
    output reg      x22,
46
    output reg      x31,
47
    output reg      x32,
48
 
49
    output reg      sync
50
);
51
 
52
 
53
    //
54
    // Generate  the cycle timing
55
    //
56
    always @(posedge sysclk) begin
57
        if (clk2) begin
58
            a11 <= ~(a12 | a22 | a32 | m12 | m22 | x12 | x22);
59
            a21 <= a12;
60
            a31 <= a22;
61
            m11 <= a32;
62
            m21 <= m12;
63
            x11 <= m22;
64
            x21 <= x12;
65
            x31 <= x22;
66
        end
67
    end
68
 
69
    always @(posedge sysclk) begin
70
        if (clk1) begin
71
            a12 <= a11;
72
            a22 <= a21;
73
            a32 <= a31;
74
            m12 <= m11;
75
            m22 <= m21;
76
            x12 <= x11;
77
            x22 <= x21;
78
            x32 <= x31;
79
        end
80
    end
81
 
82
    always @(posedge sysclk) begin
83
        if (~clk2)
84
            sync <= x31;
85
    end
86
 
87
    // This is self-initializing in hardware, but
88
    // initialization is required for simulation to
89
    // avoid endlessly propagating X states
90
    initial begin
91
        a11 = 1'b0;
92
        a12 = 1'b0;
93
        a21 = 1'b0;
94
        a22 = 1'b0;
95
        a31 = 1'b0;
96
        a32 = 1'b0;
97
        m11 = 1'b0;
98
        m12 = 1'b0;
99
        m21 = 1'b0;
100
        m22 = 1'b0;
101
        x11 = 1'b0;
102
        x12 = 1'b0;
103
        x21 = 1'b0;
104
        x22 = 1'b0;
105
        x31 = 1'b0;
106
        x32 = 1'b0;
107
        sync = 1'b0;
108
    end
109
 
110
endmodule

powered by: WebSVN 2.1.0

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