OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [host/] [basic_de1/] [basic_de1_ModelSim.sv] - Blame information for rev 8

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

Line No. Rev Author Line
1 8 gdevic
//============================================================================
2
// Host design containing A-Z80 and a few peripherials
3
//
4
// This module does not define a physical board but is only meant to be
5
// compiled within the ModelSim host test.
6
//
7
//  Copyright (C) 2014-2016  Goran Devic
8
//
9
//  This program is free software; you can redistribute it and/or modify it
10
//  under the terms of the GNU General Public License as published by the Free
11
//  Software Foundation; either version 2 of the License, or (at your option)
12
//  any later version.
13
//
14
//  This program is distributed in the hope that it will be useful, but WITHOUT
15
//  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
//  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17
//  more details.
18
//
19
//  You should have received a copy of the GNU General Public License along
20
//  with this program; if not, write to the Free Software Foundation, Inc.,
21
//  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
//============================================================================
23
module host
24
(
25
    input wire clk,
26
    input wire reset,
27
    input wire nint,
28
    input wire nnmi,
29
    output wire uart_tx
30
);
31
 
32
// ----------------- CPU PINS -----------------
33
wire nM1;
34
wire nMREQ;
35
wire nIORQ;
36
wire nRD;
37
wire nWR;
38
wire nRFSH;
39
wire nHALT;
40
wire nBUSACK;
41
 
42
wire nWAIT = 1;
43
wire nINT = nint;
44
wire nNMI = nnmi;
45
wire nBUSRQ = 1;
46
 
47
wire [15:0] A;
48
wire [7:0] D;
49
 
50
// ----------------- INTERNAL WIRES -----------------
51
wire [7:0] RamData;                     // RamData is a data writer from the RAM module
52
wire RamWE;
53
assign RamWE = nIORQ==1 && nRD==1 && nWR==0;
54
 
55
wire uart_busy;
56
wire UartWE = nIORQ==0 && nRD==1 && nWR==0;
57
 
58
// Memory map:
59
//   0000 - 3FFF  16K RAM
60
assign D[7:0] = (A[15:14]=='h0 && nIORQ==1 && nRD==0 && nWR==1) ? RamData :
61
                (nIORQ==0 && nRD==1 && nWR==1) ? 8'h80 :
62
                (nIORQ==0 && nRD==0 && nWR==1) ? {7'h0,uart_busy} :
63
                {8{1'bz}};
64
 
65
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
// Instantiate A-Z80 CPU module
67
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68
z80_top_direct_n z80_( .*, .nRESET(reset), .CLK(clk) );
69
 
70
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
// Instantiate 16Kb of RAM memory
72
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
ram ram_( .address(A[13:0]), .clock(clk), .data(D[7:0]), .wren(RamWE), .q(RamData[7:0]) );
74
 
75
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76
// Instantiate UART module
77
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78
uart #( .BAUD(115200), .IN_CLOCK(10000000) ) uart_(
79
   // Outputs
80
   .busy(uart_busy),
81
   .uart_tx(uart_tx),
82
   // Inputs
83
   .wr(UartWE),
84
   .data(D[7:0]),
85
   .clk(clk),
86
   .reset(!reset)
87
);
88
 
89
endmodule

powered by: WebSVN 2.1.0

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