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

Subversion Repositories mcs-4

[/] [mcs-4/] [trunk/] [rtl/] [verilog/] [i4004/] [timing_io.v] - Diff between revs 5 and 6

Only display areas with differences | Details | Blame | View Log

Rev 5 Rev 6
`timescale 1ns / 1ps
`timescale 1ns / 1ps
`default_nettype none
`default_nettype none
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// 
//
// 4004 Timing and I/O Interfaces
// 4004 Timing and I/O Interfaces
// 
//
// This file is part of the MCS-4 project hosted at OpenCores:
// This file is part of the MCS-4 project hosted at OpenCores:
//      http://www.opencores.org/cores/mcs-4/
//      http://www.opencores.org/cores/mcs-4/
// 
// 
// Copyright © 2012, 2020 by Reece Pollack <rrpollack@opencores.org>
// Copyright © 2012, 2021 by Reece Pollack <rrpollack@opencores.org>
// 
// 
// These materials are provided under the Creative Commons
// These materials are provided under the Creative Commons
// "Attribution-NonCommercial-ShareAlike" Public License. They
// "Attribution-NonCommercial-ShareAlike" (CC BY-NC-SA) Public License.
// are NOT "public domain" and are protected by copyright.
// They are NOT "public domain", and are protected by copyright.
// 
// 
// This work based on materials provided by Intel Corporation and
// This work based on materials provided by Intel Corporation and
// others under the same license. See the file doc/License for
// others under the same license. See the file doc/License for
// details of this license.
// details of this license.
//
//
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
 
 
module timing_io(
module timing_io(
        input  wire                     sysclk,
    input  wire         sysclk,
        input  wire                     clk1_pad,
    input  wire         clk1_pad,
        input  wire                     clk2_pad,
    input  wire         clk2_pad,
        input  wire                     poc_pad,
    input  wire         poc_pad,
        input  wire                     ior,
    input  wire         ior,
 
 
        // Timing and I/O Board Outputs
    // Timing and I/O Board Outputs
        output wire                     clk1,
    output wire         clk1,
        output wire                     clk2,
    output wire         clk2,
        output wire                     a12,
    output wire         a12,
        output wire                     a22,
    output wire         a22,
        output wire                     a32,
    output wire         a32,
        output wire                     m12,
    output wire         m12,
        output wire                     m22,
    output wire         m22,
        output wire                     x12,
    output wire         x12,
        output wire                     x22,
    output wire         x22,
        output wire                     x32,
    output wire         x32,
        output wire                     gate,
    output wire         gate,
        output reg                      poc,
    output reg          poc,
 
 
        // External I/O Pad conditioning
    // External I/O Pad conditioning
        inout  wire     [3:0]    data,
    inout  wire [3:0]   data,
        inout  wire [3:0]        data_pad,
    inout  wire [3:0]   data_pad,
        input  wire                     test_pad,
    input  wire         test_pad,
        output reg                      n0432,
        output reg                      n0432,
        output reg                      sync_pad,
    output wire         sync_pad,
        input  wire                     cmrom,
        input  wire                     cmrom,
        output wire                     cmrom_pad,
    output wire         cmrom_pad,
        input  wire                     cmram0,
    input  wire         cmram0,
        output wire                     cmram0_pad,
    output wire         cmram0_pad,
        input  wire                     cmram1,
    input  wire         cmram1,
        output wire                     cmram1_pad,
    output wire         cmram1_pad,
        input  wire                     cmram2,
    input  wire         cmram2,
        output wire                     cmram2_pad,
    output wire         cmram2_pad,
        input  wire                     cmram3,
    input  wire         cmram3,
        output wire                     cmram3_pad
    output wire         cmram3_pad
    );
    );
 
 
        // Simple pass-throughs
    // Simple pass-throughs
        assign clk1 = clk1_pad;
    assign clk1 = clk1_pad;
        assign clk2 = clk2_pad;
    assign clk2 = clk2_pad;
        assign cmrom_pad  = cmrom;
    assign cmrom_pad  = cmrom;
        assign cmram0_pad = cmram0;
    assign cmram0_pad = cmram0;
        assign cmram1_pad = cmram1;
    assign cmram1_pad = cmram1;
        assign cmram2_pad = cmram2;
    assign cmram2_pad = cmram2;
        assign cmram3_pad = cmram3;
    assign cmram3_pad = cmram3;
 
 
 
 
        // Generate the 8 execution phase indicators
        // Generate the 8 execution phase indicators
        reg [0:7] master = 8'h00;
    timing_generator timing_generator (
        reg [0:7] slave  = 8'h00;
        .sysclk (sysclk),
        always @(posedge sysclk) begin
        .clk1   (clk1),
                if (clk2)
        .clk2   (clk2),
                        master <= {~|slave[0:6], slave[0:6]};
        .a12    (a12),
                else
        .a22    (a22),
                        sync_pad <= master[7];
        .a32    (a32),
 
        .m12    (m12),
                if (clk1)
        .m22    (m22),
                        slave <= master;
        .x12    (x12),
        end
        .x22    (x22),
 
        .x32    (x32),
        assign a12 = slave[0];
        .sync   (sync_pad)
        assign a22 = slave[1];
    );
        assign a32 = slave[2];
 
        assign m12 = slave[3];
 
        assign m22 = slave[4];
 
        assign x12 = slave[5];
 
        assign x22 = slave[6];
 
        assign x32 = slave[7];
 
 
 
 
 
        // Generate the DRAM Input Gate signal
    // Generate the DRAM Input Gate signal
        // Properly called M12+M22+CLK1~(M11&M12)
    // Properly called M12+M22+CLK1~(M11&M12)
        wire n0279 = ~(a32 | m12);
    wire n0279 = ~(a32 | m12);
        reg n0278;
    reg n0278;
        always @(posedge sysclk) begin
    always @(posedge sysclk) begin
                if (clk2)
        if (clk2)
                        n0278 <= n0279;
            n0278 <= n0279;
        end
    end
        wire n0708 = ~((n0278 & clk1) | m12 | m22);
    wire n0708 = ~((n0278 & clk1) | m12 | m22);
        assign gate = ~n0708;
    assign gate = ~n0708;
 
 
 
 
        // Generate a clean POC signal
        // Generate a clean POC signal
        always @(posedge sysclk) begin
    always @(posedge sysclk or posedge poc_pad) begin
                if (poc_pad)    poc <= 1'b1;
                if (poc_pad)    poc <= 1'b1;
                else if (a12)   poc <= 1'b0;
                else if (a12)   poc <= 1'b0;
                else                    poc <= poc;
 
        end
        end
 
 
        // Generate a clean ~TEST signal (n0432)
    // Generate a clean ~TEST signal (n0432)
        always @(posedge sysclk) begin
    always @(posedge sysclk) begin
                n0432 <= ~test_pad;
        n0432 <= ~test_pad;
        end
    end
 
 
        // Manage the Data I/O pads
    // Manage the Data I/O pads
        reg L;
    reg L;
        always @(posedge sysclk) begin
    always @(posedge sysclk) begin
                if (clk2)
        if (clk2)
                        L <= a32 | m12 | (x12 & (ior | poc));
            L <= a32 | m12 | (x12 & (ior | poc));
        end
    end
 
 
        wire n0702 = ~clk2;
    wire n0702 = ~clk2;
        reg n0685;
    reg n0685;
        reg n0699;
    reg n0699;
        reg n0707;
    reg n0707;
        always @(posedge sysclk) begin
    always @(posedge sysclk) begin
                if (clk1) begin
        if (clk1) begin
                        n0685 <= ~L;
            n0685 <= ~L;
                        n0707 <=  L;
            n0707 <=  L;
                end
        end
                if (n0702)
        if (n0702)
                        n0699 <= ~L;
            n0699 <= ~L;
        end
    end
        wire n0700 = n0707 | (L & n0702) | poc;
    wire n0700 = n0707 | (L & n0702) | poc;
        wire n0659 = (clk2 & n0685) | (clk1 & L);
    wire n0659 = (clk2 & n0685) | (clk1 & L);
        wire n0676 = clk1 | n0685 | n0699;
    wire n0676 = clk1 | n0685 | n0699;
 
 
        // Incoming data from the external pads
    // Incoming data from the external pads
        reg [3:0] data_in;
    reg [3:0] data_in;
        always @* begin
    always @* begin
                if (n0659)              data_in = 4'b1111;
        if (n0659)      data_in = 4'b1111;
                else if (n0676) data_in = 4'bzzzz;
        else if (n0676) data_in = 4'bzzzz;
                else if (poc)   data_in = 4'b0000;
        else if (poc)   data_in = 4'b0000;
                else                    data_in = data_pad;
        else            data_in = data_pad;
        end
    end
        assign data = data_in;
    assign data = data_in;
 
 
        // Outgoing data to the external pads
    // Outgoing data to the external pads
        reg [3:0] data_out;
    reg [3:0] data_out;
        always @(posedge sysclk) begin
    always @(posedge sysclk) begin
                if (n0702)
        if (n0702)
                        data_out <= data;
            data_out <= data;
        end
    end
        assign data_pad = poc ? 4'b0000 : (n0700 ? 4'bzzzz : data_out);
    assign data_pad = poc ? 4'b0000 : (n0700 ? 4'bzzzz : data_out);
 
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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