1 |
2 |
beattidp |
/** @package zGlue
|
2 |
|
|
|
3 |
|
|
@file ioport.v
|
4 |
|
|
|
5 |
|
|
@brief building blocks for I/O port and peripheral registers;
|
6 |
|
|
for eZ80 Family host processor with 24-bit address bus.
|
7 |
|
|
|
8 |
|
|
<BR>Simplified (2-clause) BSD License
|
9 |
|
|
|
10 |
|
|
Copyright (c) 2012, Douglas Beattie Jr.
|
11 |
|
|
All rights reserved.
|
12 |
|
|
|
13 |
|
|
Redistribution and use in source and hardware/binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
|
|
|
16 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
|
|
|
19 |
|
|
2. Redistributions in hardware/binary form must reproduce the above
|
20 |
|
|
copyright notice, this list of conditions and the following disclaimer in
|
21 |
|
|
the documentation and/or other materials provided with the distribution.
|
22 |
|
|
|
23 |
|
|
THIS RTL SOURCE IS PROVIDED BY DOUGLAS BEATTIE JR. "AS IS" AND ANY
|
24 |
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
25 |
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
26 |
|
|
DISCLAIMED. IN NO EVENT SHALL DOUGLAS BEATTIE JR. BE LIABLE FOR ANY
|
27 |
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
28 |
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
29 |
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
30 |
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
31 |
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
32 |
|
|
THIS RTL SOURCE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33 |
|
|
|
34 |
|
|
Author: Douglas Beattie
|
35 |
|
|
Created on: 4/12/2012 8:50:12 PM
|
36 |
|
|
Last change: DBJR 4/28/2012 5:31:56 PM
|
37 |
|
|
*/
|
38 |
|
|
`timescale 1ns / 100ps
|
39 |
|
|
|
40 |
|
|
module ioport_a16_d8_wo(reset_n, wr_n, data_in, ouplatched_bus);
|
41 |
|
|
input reset_n, wr_n;
|
42 |
|
|
input [7:0] data_in;
|
43 |
|
|
output reg [7:0] ouplatched_bus;
|
44 |
|
|
parameter INIT_VAL = 8'b0 ;
|
45 |
|
|
|
46 |
|
|
always @ (posedge wr_n or negedge reset_n)
|
47 |
|
|
if (! reset_n)
|
48 |
|
|
ouplatched_bus <= #1 INIT_VAL;
|
49 |
|
|
else if (wr_n)
|
50 |
|
|
ouplatched_bus <= #1 data_in;
|
51 |
|
|
|
52 |
|
|
endmodule
|
53 |
|
|
|
54 |
|
|
module ioport_a16_dx_wo(reset_n, wr_n, data_in, ouplatched_bus);
|
55 |
|
|
parameter NUM_BITS = 8;
|
56 |
|
|
parameter INIT_VAL = 0 ;
|
57 |
|
|
input reset_n, wr_n;
|
58 |
|
|
input [NUM_BITS-1:0] data_in;
|
59 |
|
|
output reg [NUM_BITS-1:0] ouplatched_bus;
|
60 |
|
|
|
61 |
|
|
always @ (posedge wr_n or negedge reset_n)
|
62 |
|
|
if (! reset_n)
|
63 |
|
|
ouplatched_bus <= #1 INIT_VAL;
|
64 |
|
|
else if (wr_n)
|
65 |
|
|
ouplatched_bus <= #1 data_in;
|
66 |
|
|
|
67 |
|
|
endmodule
|
68 |
|
|
|