Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring in Lawrie's commits #43

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions boards/blackicemx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Blackice Mx with Digilent Pmods support

This adds support for building the apple one design for [mystorm Blackice Mx](https://github.com/folknology/IceCore) with attached Digilent Pmods for vga and ps2

## Peripheral support

VGA port is working through a Digilent VGA Pmod on the middle Mixmod

PS/2 keyboard uses a Digilent PS/2 on bottom row of the Pmod next to the USB connector

## Building
Install a recent IceStorm toolchain, and:

```
$ cd yosys
$ make
```

## Use

To load BASIC type "E000R" with CAPS LOCK on.
72 changes: 72 additions & 0 deletions boards/blackicemx/yosys/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
DEVICE = hx8k
PIN_DEF=blackicemx.pcf

SOURCEDIR = ../../../rtl
BUILDDIR = build

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)/%.json: $(SOURCEDIR)/%.v
yosys -q -p "chparam -list; hierarchy -top apple1_top; synth_ice40 -json $@" $^

$(BUILDDIR)/%.asc: $(PIN_DEF) $(BUILDDIR)/%.json
nextpnr-ice40 --${DEVICE} --package tq144:4k --freq 25 --asc $@ --json $(filter-out $<,$^) --pcf $< --placer heap

$(BUILDDIR)/%.bin: $(BUILDDIR)/%.asc
icepack $^ $@

%.rpt: $(BUILDDIR)/%.asc
icetime -d $(DEVICE) -P $(PACKAGE) -c $(FREQ_PLL) -mtr $@ $<

%_tb.vvp: %_tb.v %.v
iverilog -o $@ $^

%_tb.vcd: %_tb.vvp
vvp -N $< +vcd=$@

# ------ APPLE 1 ------
apple1: dir $(BUILDDIR)/apple1.bin
report: dir apple1.rpt

$(BUILDDIR)/apple1.bin: $(BUILDDIR)/apple1.asc
$(BUILDDIR)/apple1.asc: $(BUILDDIR)/apple1.json
$(BUILDDIR)/apple1.json: $(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/blackicemx/apple1_hx8k.v

apple1.rpt: $(BUILDDIR)/apple1.asc

prog: dir $(BUILDDIR)/apple1.bin
stty -F /dev/ttyACM0 raw
cat $(filter-out $<,$^) >/dev/ttyACM0

# ------ HELPERS ------
clean:
rm -rf build apple1.rpt

.SECONDARY:
.PHONY: all info clean prog iceprog
38 changes: 38 additions & 0 deletions boards/blackicemx/yosys/blackicemx.pcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# For the Blackice Mx board

### UART
set_io uart_rx 61
set_io uart_tx 62
set_io uart_cts 29

### LEDs
set_io led[0] 55
set_io led[1] 56
set_io led[2] 34
set_io led[3] 33

### VGA Display
set_io vga_h_sync 1
set_io vga_v_sync 2
set_io vga_r[3] 139
set_io vga_r[2] 138
set_io vga_r[1] 142
set_io vga_r[0] 141
set_io vga_g[3] 4
set_io vga_g[2] 3
set_io vga_g[1] 144
set_io vga_g[0] 143
set_io vga_b[3] 135
set_io vga_b[2] 134
set_io vga_b[1] 137
set_io vga_b[0] 136

set_io clk25 60

set_io ps2_din 19
set_io ps2_clk 23

### Buttons
set_io -pullup yes button[0] 49
set_io -pullup yes button[1] 52

22 changes: 22 additions & 0 deletions boards/ulx3s/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Ulx3s with HDMI

This adds support for building the Apple One design for [Ulx3s](https://radiona.org/ulx3s/) with HDMI output and a PS/2 keyboard connected to the us2 USB connector.

## Peripheral support

HDMI output on the built-in HDMI connector

PS/2 keyboard is connected to the us2 USB connector.
Note that some USB keyboards drup down to PS/2 mode and will work.

## Building
Install a recent ECP5 open source toolchain, and do:

```
$ cd yosys
$ make
```

## Use

To load BASIC type "E000R" (with CAPS LOCK on if you are using the UART rather than the PS/2 keyboard).
69 changes: 69 additions & 0 deletions boards/ulx3s/yosys/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
DEVICE = 25k
PIN_DEF=ulx3s_v20.lpf
IDCODE ?= 0x21111043 # 12f

SOURCEDIR = ../../../rtl
BUILDDIR = build

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)/%.json: $(SOURCEDIR)/%.v
yosys -q -p "chparam -list; hierarchy -top apple1_top; synth_ecp5 -json $@" $^

$(BUILDDIR)/%.config: $(PIN_DEF) $(BUILDDIR)/%.json
nextpnr-ecp5 --${DEVICE} --package CABGA381 --freq 25 --textcfg $@ --json $(filter-out $<,$^) --lpf $<

$(BUILDDIR)/%.bit: $(BUILDDIR)/%.config
ecppack --compress --idcode ${IDCODE} $^ $@

%_tb.vvp: %_tb.v %.v
iverilog -o $@ $^

%_tb.vcd: %_tb.vvp
vvp -N $< +vcd=$@

# ------ APPLE 1 ------
apple1: dir $(BUILDDIR)/apple1.bit

$(BUILDDIR)/apple1.bin: $(BUILDDIR)/apple1.asc
$(BUILDDIR)/apple1.asc: $(BUILDDIR)/apple1.json
$(BUILDDIR)/apple1.json: $(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/ulx3s/apple1_dvi.v \
$(SOURCEDIR)/boards/ulx3s/vga2dvid.v \
$(SOURCEDIR)/boards/ulx3s/clk_25_250_125_25.v \
$(SOURCEDIR)/boards/ulx3s/tmds_encoder.v \
$(SOURCEDIR)/boards/ulx3s/fake_differential.v

prog: dir $(BUILDDIR)/apple1.bit
ujprog $(filter-out $<,$^)
# ------ HELPERS ------
clean:
rm -rf build

.SECONDARY:
.PHONY: all info clean prog
Binary file added boards/ulx3s/yosys/apple1.bit
Binary file not shown.
30 changes: 30 additions & 0 deletions boards/ulx3s/yosys/slow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import time
import os
import sys

if len(sys.argv) != 2:
print("Usage: " + sys.argv[0] + " <filename>")
sys.exit(1)

os.system('stty -F /dev/ttyUSB0 raw -echo 115200')
fin = open(sys.argv[1], "r")
fout = open("/dev/ttyUSB0", "w")

for line in fin:
for ch in line.strip('\n'):
fout.write(ch)
fout.flush()
time.sleep(.1)
fout.write('\r')
fout.flush()
time.sleep(.5)
fin.close()
fout.close()






Loading