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

Subversion Repositories zx_ula

[/] [zx_ula/] [trunk/] [fpga_version/] [rtl/] [ula.v] - Diff between revs 2 and 6

Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 1... Line 1...
`timescale 1ns / 1ps
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// Company:        Dept. Architecture and Computing Technology. University of Seville
// Company:        Dept. Architecture and Computing Technology. University of Seville
// Engineer:       Miguel Angel Rodriguez Jodar
// Engineer:       Miguel Angel Rodriguez Jodar. rodriguj@atc.us.es
// 
// 
// Create Date:    19:13:39 4-Apr-2012 
// Create Date:    19:13:39 4-Apr-2012 
// Design Name:    ULA
// Design Name:    ZX Spectrum
// Module Name:    ula_reference_design 
// Module Name:    ula 
// Project Name: 
// Project Name: 
// Target Devices: 
// Target Devices: 
// Tool versions: 
// Tool versions: 
// Description: 
// Description: 
//
//
// Dependencies: 
// Dependencies: 
//
//
// Revision: 
// Revision: 
// Revision 0.01 - File Created
// Revision 1.00 - File Created
// Additional Comments: 
// Additional Comments: GPL License policies apply to the contents of this file.
//
//
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
 
 
`define cyclestart(a,b) ((a)==(b))
`define cyclestart(a,b) ((a)==(b))
`define cycleend(a,b) ((a)==(b+1))
`define cycleend(a,b) ((a)==(b+1))
Line 256... Line 256...
        // Address and control line multiplexor ULA/CPU
        // Address and control line multiplexor ULA/CPU
        always @(*) begin
        always @(*) begin
                if (Border_n && (hc[3:0]==4'b1000 || hc[3:0]==4'b1001 || hc[3:0]==4'b1100 || hc[3:0]==4'b1101)) begin       // cycles 8 and 12: present display address to VRAM 
                if (Border_n && (hc[3:0]==4'b1000 || hc[3:0]==4'b1001 || hc[3:0]==4'b1100 || hc[3:0]==4'b1101)) begin       // cycles 8 and 12: present display address to VRAM 
                        rVA = {1'b0,v[7:6],v[2:0],v[5:3],c[7:3]};                                                // (cycles 9 and 13 load display byte)
                        rVA = {1'b0,v[7:6],v[2:0],v[5:3],c[7:3]};                                                // (cycles 9 and 13 load display byte)
                        rVCS = 1;
                        rVCS = 1;
                        rVOE = 1;
                        rVOE = !hc[0];
                        rVWE = 0;
                        rVWE = 0;
                end
                end
                else if (Border_n && (hc[3:0]==4'b1010 || hc[3:0]==4'b1011 || hc[3:0]==4'b1110 || hc[3:0]==4'b1111)) begin  // cycles 10 and 14: present attribute address to VRAM
                else if (Border_n && (hc[3:0]==4'b1010 || hc[3:0]==4'b1011 || hc[3:0]==4'b1110 || hc[3:0]==4'b1111)) begin  // cycles 10 and 14: present attribute address to VRAM
                        rVA = {4'b0110,v[7:3],c[7:3]};                                                                          // (cycles 11 and 15 load attr byte)
                        rVA = {4'b0110,v[7:3],c[7:3]};                                                                          // (cycles 11 and 15 load attr byte)
                        rVCS = 1;
                        rVCS = 1;
                        rVOE = 1;
                        rVOE = !hc[0];
 
                        rVWE = 0;
 
                end
 
                else if (Border_n && hc[3:0]==4'b0000) begin
 
                        rVA = a[13:0];
 
                        rVCS = 0;
 
                        rVOE = 0;
                        rVWE = 0;
                        rVWE = 0;
                end
                end
                else begin      // when VRAM is not in use by ULA, give it to CPU
                else begin      // when VRAM is not in use by ULA, give it to CPU
                        rVA = a[13:0];
                        rVA = a[13:0];
                        rVCS = !a[15] & a[14] & !mreq_n;
                        rVCS = !a[15] & a[14] & !mreq_n;
Line 303... Line 309...
        end
        end
 
 
        // ULA-CPU interface
        // ULA-CPU interface
        assign dout = (!a[15] & a[14] & !mreq_n)?         vramdout : // CPU reads VRAM through ULA as in the +3, not directly
        assign dout = (!a[15] & a[14] & !mreq_n)?         vramdout : // CPU reads VRAM through ULA as in the +3, not directly
                      (!iorq_n & !a[0])?                  {1'b1,ear,1'b1,kbcolumns} :    // CPU reads keyboard and EAR state
                      (!iorq_n & !a[0])?                  {1'b1,ear,1'b1,kbcolumns} :    // CPU reads keyboard and EAR state
                                          (Border_n)?                         vramdout :  // to emulate
                                          (Border_n)?                  AttrReg :  // to emulate
                                                                              8'hFF;     // port FF
                                                                              8'hFF;     // port FF
        assign vramdin = din;           // The CPU doesn't need to share the memory input data bus with the ULA
        assign vramdin = din;           // The CPU doesn't need to share the memory input data bus with the ULA
        assign kbrows = {a[11]? 1'bz : 0,        // high impedance or 0, as if diodes were been placed in between
        assign kbrows = {a[11]? 1'bz : 1'b0,    // high impedance or 0, as if diodes were been placed in between
                                                  a[10]? 1'bz : 0,       // if the keyboard matrix is to be implemented within the FPGA, then
                                                  a[10]? 1'bz : 1'b0,   // if the keyboard matrix is to be implemented within the FPGA, then
                                                  a[9]?  1'bz : 0,       // there's no need to do this.
                                                  a[9]?  1'bz : 1'b0,   // there's no need to do this.
                                                  a[12]? 1'bz : 0,
                                                  a[12]? 1'bz : 1'b0,
                                                  a[13]? 1'bz : 0,
                                                  a[13]? 1'bz : 1'b0,
                                                  a[8]?  1'bz : 0,
                                                  a[8]?  1'bz : 1'b0,
                                                  a[14]? 1'bz : 0,
                                                  a[14]? 1'bz : 1'b0,
                                                  a[15]? 1'bz : 0 };
                                                  a[15]? 1'bz : 1'b0 };
 
//      assign kbrows = {a[8]? 1'bz : 1'b0,     // high impedance or 0, as if diodes were been placed in between
 
//                                                a[9]? 1'bz : 1'b0,    // if the keyboard matrix is to be implemented within the FPGA, then
 
//                                                a[10]?  1'bz : 1'b0,  // there's no need to do this.
 
//                                                a[11]? 1'bz : 1'b0,
 
//                                                a[12]? 1'bz : 1'b0,
 
//                                                a[13]?  1'bz : 1'b0,
 
//                                                a[14]? 1'bz : 1'b0,
 
//                                                a[15]? 1'bz : 1'b0 };
        reg rMic = 0;
        reg rMic = 0;
        reg rSpk = 0;
        reg rSpk = 0;
        assign mic = rMic;
        assign mic = rMic;
        assign spk = rSpk;
        assign spk = rSpk;
        always @(negedge clk7) begin
        always @(negedge clk7) begin

powered by: WebSVN 2.1.0

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