forked from RobertBaruch/vz80core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz80.v
67 lines (56 loc) · 1.13 KB
/
z80.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
`default_nettype none
`timescale 1us/100 ns
`ifdef Z80_FORMAL
`include "z80fi.vh"
`endif
`include "sequencer.sv"
// The z80. We've only implemented the basic signals so far.
module z80(
input CLK,
input nRESET,
input [7:0] READ_D,
output nMREQ,
output nIORQ,
output nRD,
output nWR,
output [15:0] A,
output [7:0] WRITE_D
`ifdef Z80_FORMAL
,
`Z80FI_OUTPUTS
`endif
);
wire reset = !nRESET;
wire mem_wr;
wire mem_rd;
wire io_wr;
wire io_rd;
logic done;
assign nRD = !(mem_rd || io_rd);
assign nWR = !(mem_wr || io_wr);
assign nMREQ = !(mem_rd || mem_wr);
assign nIORQ = !(io_rd || io_wr);
sequencer sequencer(
.reset(reset),
.clk(CLK),
.bus_rdata(READ_D),
.done(done),
.addr(A),
.mem_wr(mem_wr),
.mem_rd(mem_rd),
.io_wr(io_wr),
.io_rd(io_rd),
.bus_wdata(WRITE_D)
`ifdef Z80_FORMAL
,
`Z80FI_CONN
`endif
);
`ifdef FORMAL
always @(*) begin
assert(!(mem_wr && mem_rd));
assert(!(io_wr && io_rd));
assert(!((mem_wr || mem_rd) && (io_wr || io_rd)));
end
`endif
endmodule