2018-01-26 22:32:31 +00:00
|
|
|
// Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
// distributed with this work for additional information
|
|
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing,
|
|
|
|
// software distributed under the License is distributed on an
|
|
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the License for the
|
|
|
|
// specific language governing permissions and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// Description: Top level test bench for apple1_top
|
|
|
|
//
|
|
|
|
// Author.....: Niels A. Moseley
|
|
|
|
// Date.......: 26-1-2018
|
2018-01-27 13:21:48 +00:00
|
|
|
//
|
2018-01-26 22:32:31 +00:00
|
|
|
|
|
|
|
`timescale 1ns/1ps
|
|
|
|
|
2018-01-27 06:00:33 +00:00
|
|
|
module apple1_tb;
|
2018-01-26 22:32:31 +00:00
|
|
|
|
2018-01-26 22:41:58 +00:00
|
|
|
reg clk25, uart_rx, rst_n;
|
2018-01-26 22:32:31 +00:00
|
|
|
wire uart_tx, uart_cts;
|
|
|
|
|
2018-01-27 13:21:48 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2018-01-26 22:32:31 +00:00
|
|
|
// Setup dumping of data for inspection
|
|
|
|
|
|
|
|
initial begin
|
2018-01-27 17:11:33 +00:00
|
|
|
|
2018-01-26 22:32:31 +00:00
|
|
|
clk25 = 1'b0;
|
2018-01-27 13:21:48 +00:00
|
|
|
uart_rx = 1'b1;
|
|
|
|
rst_n = 1'b0;
|
2018-01-26 22:41:58 +00:00
|
|
|
#40 rst_n = 1'b1;
|
2018-01-26 22:32:31 +00:00
|
|
|
|
|
|
|
$display("Starting...");
|
|
|
|
$dumpfile("apple1_top_tb.vcd");
|
2018-01-27 13:21:48 +00:00
|
|
|
$dumpvars;
|
|
|
|
|
|
|
|
#180000
|
|
|
|
uart_rx = 1'b0;
|
|
|
|
#400
|
|
|
|
uart_rx = 1'b1;
|
|
|
|
#400
|
|
|
|
uart_rx = 1'b0;
|
|
|
|
#400
|
|
|
|
uart_rx = 1'b1;
|
|
|
|
#800
|
|
|
|
uart_rx = 1'b0;
|
|
|
|
#1600
|
|
|
|
uart_rx = 1'b1;
|
|
|
|
|
|
|
|
|
2018-01-26 22:32:31 +00:00
|
|
|
#1000000 $display("Stopping...");
|
|
|
|
$finish;
|
|
|
|
end
|
|
|
|
|
2018-01-27 13:21:48 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2018-01-26 22:32:31 +00:00
|
|
|
// Clock
|
|
|
|
|
|
|
|
always
|
|
|
|
#20 clk25 = !clk25;
|
|
|
|
|
2018-01-27 13:21:48 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2018-01-26 22:32:31 +00:00
|
|
|
// Core of system
|
2018-01-27 06:00:33 +00:00
|
|
|
apple1 #(
|
|
|
|
"../roms/ram.hex",
|
2018-01-28 04:02:51 +00:00
|
|
|
"../roms/wozmon.hex",
|
|
|
|
"../roms/basic.hex"
|
2018-01-27 06:00:33 +00:00
|
|
|
) core_top (
|
2018-01-26 22:32:31 +00:00
|
|
|
.clk25(clk25),
|
2018-01-26 22:41:58 +00:00
|
|
|
.rst_n(rst_n),
|
2018-01-26 22:32:31 +00:00
|
|
|
.uart_rx(uart_rx),
|
|
|
|
.uart_tx(uart_tx),
|
|
|
|
.uart_cts(uart_cts)
|
|
|
|
);
|
|
|
|
|
2018-01-27 06:00:33 +00:00
|
|
|
endmodule
|