boards: icoboard support

Signed-off-by: Paolo Pisati <p.pisati@gmail.com>
This commit is contained in:
Paolo Pisati 2019-11-04 15:52:00 +01:00
parent 6df00e7161
commit dce06d560e
5 changed files with 255 additions and 0 deletions

View File

@ -7,6 +7,7 @@ This is a basic implementation of the original Apple 1 in Verilog. It can run th
Contributor supported boards (YMMV):
- [Blackice II](https://www.tindie.com/products/Folknology/blackice-ii/)
- [icoBoard](http://icoboard.org/)
- [Olimex iCE40HX8K with ICE40-IO](https://www.olimex.com/Products/FPGA/iCE40/iCE40HX8K-EVB/open-source-hardware)
- [TinyFPGA B2](http://tinyfpga.com/)
- [Upduino](http://gnarlygrey.atspace.cc/development-platform.html)

28
boards/icoboard/README.md Normal file
View File

@ -0,0 +1,28 @@
# icoBoard with Digilent Pmods support
This adds support for building the apple one design for
[icoBoard](http://icoboard.org/about-icoboard.html) with attached Digilent Pmods
for VGA, PS/2 or UART.
## Peripheral support
VGA port is working through a Digilent VGA Pmod on Pmod 1/2.
PS/2 works through a Digilent PS/2 Pmod on Pmod 3 upper row.
UART works through a Digilent USBUART Pmod on Pmod 4 upper row.
By default, UART is enabled (and PS/2 is off), check
rtl/boards/icoboard/apple1_hx8k.v.
## Building
Install a recent IceStorm toolchain, and:
```
$ cd yosys
$ make apple1
```
## Use
To load BASIC type "E000R" with CAPS LOCK on.

View File

@ -0,0 +1,79 @@
DEVICE = hx8k
PIN_DEF = icoboard.pcf
FREQ_OSC = 100
FREQ_PLL = 25
SOURCEDIR = ../../../rtl
BUILDDIR = build
PLL = $(BUILDDIR)/pll.sv
all: apple1 prog
info:
@echo " To build: make apple1"
@echo " To program: make prog"
@echo "To build report: make report"
@echo " To clean up: make clean"
dir:
mkdir -p $(BUILDDIR)
# ------ TEMPLATES ------
$(BUILDDIR)/%.blif: $(SOURCEDIR)/%.v
yosys -q -p "chparam -list; hierarchy -top apple1_top; synth_ice40 -blif $@" $^
$(BUILDDIR)/%.asc: $(PIN_DEF) $(BUILDDIR)/%.blif
arachne-pnr -d 8k -o $@ -p $^
$(BUILDDIR)/%.bin: $(BUILDDIR)/%.asc
icepack $^ $@
%.rpt: $(BUILDDIR)/%.asc
icetime -d $(DEVICE) -c $(FREQ_PLL) -mtr $@ $<
%_tb.vvp: %_tb.v %.v
iverilog -o $@ $^
%_tb.vcd: %_tb.vvp
vvp -N $< +vcd=$@
$(PLL):
icepll $(QUIET) -i $(FREQ_OSC) -o $(FREQ_PLL) -m -f $@
# ------ APPLE 1 ------
apple1: dir $(PLL) $(BUILDDIR)/apple1.bin
report: dir apple1.rpt
$(BUILDDIR)/apple1.bin: $(BUILDDIR)/apple1.asc
$(BUILDDIR)/apple1.asc: $(BUILDDIR)/apple1.blif
$(BUILDDIR)/apple1.blif: $(SOURCEDIR)/apple1.v \
$(SOURCEDIR)/clock.v \
$(SOURCEDIR)/pwr_reset.v \
$(SOURCEDIR)/ram.v \
$(SOURCEDIR)/rom_wozmon.v \
$(SOURCEDIR)/rom_basic.v \
$(SOURCEDIR)/cpu/arlet_6502.v \
$(SOURCEDIR)/cpu/arlet/ALU.v \
$(SOURCEDIR)/cpu/arlet/cpu.v \
$(SOURCEDIR)/uart/uart.v \
$(SOURCEDIR)/uart/async_tx_rx.v \
$(SOURCEDIR)/vga/vga.v \
$(SOURCEDIR)/vga/vram.v \
$(SOURCEDIR)/vga/font_rom.v \
$(SOURCEDIR)/ps2keyboard/debounce.v \
$(SOURCEDIR)/ps2keyboard/ps2keyboard.v \
$(SOURCEDIR)/boards/icoboard/apple1_hx8k.v \
$(BUILDDIR)/pll.sv
apple1.rpt: $(BUILDDIR)/apple1.asc
prog: dir $(BUILDDIR)/apple1.bin
icoprog -p < $(BUILDDIR)/apple1.bin
# ------ HELPERS ------
clean:
rm -rf build apple1.rpt
.SECONDARY:
.PHONY: all info clean prog iceprog

View File

@ -0,0 +1,42 @@
# For the icoBoard
### 100Mhz clk
set_io clk R9
### VGA display
set_io vga_h_sync B8
set_io vga_v_sync A9
set_io vga_r[0] A5
set_io vga_r[1] A2
set_io vga_r[2] C3
set_io vga_r[3] B4
set_io vga_g[0] D8
set_io vga_g[1] B9
set_io vga_g[2] B10
set_io vga_g[3] B11
set_io vga_b[0] B7
set_io vga_b[1] B6
set_io vga_b[2] B3
set_io vga_b[3] B5
### LEDs
# onboard LEDs
set_io led[0] C8
set_io led[1] F7
### PS/2
set_io ps2_din L9
set_io ps2_clk L7
### Buttons
# onboard buttons
set_io button[0] K11
set_io button[1] P13
### UART
#set_io uart_rts T15
#set_io uart_rx T14
#set_io uart_tx T11
set_io uart_rx T11
set_io uart_tx T14
set_io uart_cts R10

View File

@ -0,0 +1,105 @@
// 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: Apple 1 implementation for the icoBoard
//
// Author.....: Paolo Pisati (inspired from blackice2/apple1_hx8k.v)
// Date.......: 05-11-2019
//
module apple1_top #(
parameter BASIC_FILENAME = "../../../roms/basic.hex",
parameter FONT_ROM_FILENAME = "../../../roms/vga_font_bitreversed.hex",
parameter RAM_FILENAME = "../../../roms/ram.hex",
parameter VRAM_FILENAME = "../../../roms/vga_vram.bin",
parameter WOZMON_ROM_FILENAME = "../../../roms/wozmon.hex"
) (
input clk, // 100 MHz board clock
// I/O interface to computer
input uart_rx, // asynchronous serial data input from computer
output uart_tx, // asynchronous serial data output to computer
output uart_cts, // clear to send flag to computer - not used
// I/O interface to keyboard
input ps2_clk, // PS/2 keyboard serial clock input
input ps2_din, // PS/2 keyboard serial data input
// Outputs to VGA display
output vga_h_sync, // hozizontal VGA sync pulse
output vga_v_sync, // vertical VGA sync pulse
output [3:0] vga_r, // red VGA signal
output [3:0] vga_g, // green VGA signal
output [3:0] vga_b, // blue VGA signal
// Debugging ports
output [1:0] led,
input [1:0] button // 2 buttons on board
);
assign led[0] = reset_n;
assign led[1] = clr_screen_n;
wire clk25;
// 100MHz down to 25MHz
pll my_pll(
.clock_in(clk),
.clock_out(clk25)
);
wire vga_bit;
// set the monochrome base colour here..
assign vga_r[3:0] = vga_bit ? 4'b1000 : 4'b0000;
assign vga_g[3:0] = vga_bit ? 4'b1111 : 4'b0000;
assign vga_b[3:0] = vga_bit ? 4'b1000 : 4'b0000;
wire reset_n;
assign reset_n = ~button[0];
wire clr_screen_n;
assign clr_screen_n = ~button[1];
// apple one main system
apple1 #(
.BASIC_FILENAME (BASIC_FILENAME),
.FONT_ROM_FILENAME (FONT_ROM_FILENAME),
.RAM_FILENAME (RAM_FILENAME),
.VRAM_FILENAME (VRAM_FILENAME),
.WOZMON_ROM_FILENAME (WOZMON_ROM_FILENAME)
) my_apple1(
.clk25(clk25),
.rst_n(reset_n),
.uart_rx(uart_rx),
.uart_tx(uart_tx),
.uart_cts(uart_cts),
.ps2_clk(ps2_clk),
.ps2_din(ps2_din),
//.ps2_select(1'b1), // PS/2 not working, at the moment
.ps2_select(1'b0), // PS/2 disabled, UART TX enabled
.vga_h_sync(vga_h_sync),
.vga_v_sync(vga_v_sync),
.vga_red(vga_bit),
//.vga_grn(vga_bit),
//.vga_blu(vga_bit),
.vga_cls(~clr_screen_n),
);
endmodule