2018-01-27 06:00:33 +00:00
|
|
|
module arlet_6502(
|
2018-01-27 17:11:33 +00:00
|
|
|
input clk, // clock signal
|
|
|
|
input enable, // clock enable strobe
|
2018-01-29 10:00:38 +00:00
|
|
|
input rst, // active high reset signal
|
2018-01-27 17:11:33 +00:00
|
|
|
output reg [15:0] ab, // address bus
|
|
|
|
input [7:0] dbi, // 8-bit data bus (input)
|
|
|
|
output reg [7:0] dbo, // 8-bit data bus (output)
|
|
|
|
output reg we, // active high write enable strobe
|
|
|
|
input irq_n, // active low interrupt request
|
|
|
|
input nmi_n, // active low non-maskable interrupt
|
|
|
|
input ready, // CPU updates when ready = 1
|
|
|
|
output [15:0] pc_monitor // program counter monitor signal for debugging
|
2018-01-27 06:00:33 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
wire [7:0] dbo_c;
|
|
|
|
wire [15:0] ab_c;
|
|
|
|
wire we_c;
|
|
|
|
|
|
|
|
cpu arlet_cpu (
|
|
|
|
.clk(clk),
|
2018-01-29 10:00:38 +00:00
|
|
|
.reset(rst),
|
2018-01-27 06:00:33 +00:00
|
|
|
.AB(ab_c),
|
|
|
|
.DI(dbi),
|
|
|
|
.DO(dbo_c),
|
|
|
|
.WE(we_c),
|
2018-01-27 21:58:07 +00:00
|
|
|
.IRQ(~irq_n),
|
|
|
|
.NMI(~nmi_n),
|
2018-01-27 17:11:33 +00:00
|
|
|
.RDY(ready),
|
|
|
|
.PC_MONITOR(pc_monitor)
|
2018-01-27 06:00:33 +00:00
|
|
|
);
|
|
|
|
|
2018-01-29 10:00:38 +00:00
|
|
|
always @(posedge clk or posedge rst)
|
2018-01-27 06:00:33 +00:00
|
|
|
begin
|
2018-01-29 10:00:38 +00:00
|
|
|
if (rst)
|
2018-01-27 06:00:33 +00:00
|
|
|
begin
|
2018-01-27 11:13:52 +00:00
|
|
|
ab <= 16'd0;
|
|
|
|
dbo <= 8'd0;
|
|
|
|
we <= 1'b0;
|
2018-01-27 06:00:33 +00:00
|
|
|
end
|
2018-01-27 11:13:52 +00:00
|
|
|
else
|
|
|
|
if (enable)
|
|
|
|
begin
|
|
|
|
ab <= ab_c;
|
|
|
|
dbo <= dbo_c;
|
|
|
|
we <= we_c;
|
|
|
|
end
|
2018-01-27 06:00:33 +00:00
|
|
|
end
|
|
|
|
endmodule
|