Added Spartan 3E starter kit implementation (work in progress!).

This commit is contained in:
Niels Moseley 2018-02-12 01:52:10 +01:00
parent 20ffe41999
commit 77b5847611
8 changed files with 299 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# Apple One<br>Digilent Spartan 3E Starter Kit Board target
Maintainer: Niels Moseley https://github.com/trcwm
![Digilent Spartan 3E Starter Kit board photo](images/spartan3e_starterkit.jpg)
### Build environment
The project was developed using Xilinx ISE 14.7. Using other versions might work, YMMV.
### Features
* UART support via the on-board RS-232 interface.
* VGA support via the on-board VGA connector.
* PS/2 keyboard support via the on-board PS/2 connector.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<generated_project xmlns="http://www.xilinx.com/XMLSchema" xmlns:xil_pn="http://www.xilinx.com/XMLSchema">
<!-- -->
<!-- For tool use only. Do not edit. -->
<!-- -->
<!-- ProjectNavigator created generated project file. -->
<!-- For use in tracking generated file and other information -->
<!-- allowing preservation of process status. -->
<!-- -->
<!-- Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. -->
<version xmlns="http://www.xilinx.com/XMLSchema">11.1</version>
<sourceproject xmlns="http://www.xilinx.com/XMLSchema" xil_pn:fileType="FILE_XISE" xil_pn:name="Apple-One.xise"/>
<files xmlns="http://www.xilinx.com/XMLSchema">
<file xil_pn:fileType="FILE_NCD" xil_pn:name="apple1_s3e_starterkit_top_guide.ncd" xil_pn:origination="imported"/>
</files>
<transforms xmlns="http://www.xilinx.com/XMLSchema"/>
</generated_project>

View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<project xmlns="http://www.xilinx.com/XMLSchema" xmlns:xil_pn="http://www.xilinx.com/XMLSchema">
<header>
<!-- ISE source project file created by Project Navigator. -->
<!-- -->
<!-- This file contains project source information including a list of -->
<!-- project source files, project and process properties. This file, -->
<!-- along with the project source files, is sufficient to open and -->
<!-- implement in ISE Project Navigator. -->
<!-- -->
<!-- Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. -->
</header>
<version xil_pn:ise_version="14.7" xil_pn:schema_version="2"/>
<files>
<file xil_pn:name="../../../rtl/boards/spartan3e_starterkit/apple1_s3e_starterkit_top.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="1"/>
<association xil_pn:name="Implementation" xil_pn:seqID="17"/>
</file>
<file xil_pn:name="../../../rtl/cpu/arlet/ALU.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="2"/>
<association xil_pn:name="Implementation" xil_pn:seqID="1"/>
</file>
<file xil_pn:name="../../../rtl/cpu/arlet/cpu.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="3"/>
<association xil_pn:name="Implementation" xil_pn:seqID="6"/>
</file>
<file xil_pn:name="../../../rtl/cpu/arlet_6502.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="4"/>
<association xil_pn:name="Implementation" xil_pn:seqID="14"/>
</file>
<file xil_pn:name="../../../rtl/ps2keyboard/debounce.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="5"/>
<association xil_pn:name="Implementation" xil_pn:seqID="5"/>
</file>
<file xil_pn:name="../../../rtl/ps2keyboard/ps2keyboard.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="6"/>
<association xil_pn:name="Implementation" xil_pn:seqID="13"/>
</file>
<file xil_pn:name="../../../rtl/uart/async_tx_rx.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="7"/>
<association xil_pn:name="Implementation" xil_pn:seqID="4"/>
</file>
<file xil_pn:name="../../../rtl/uart/uart.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="8"/>
<association xil_pn:name="Implementation" xil_pn:seqID="8"/>
</file>
<file xil_pn:name="../../../rtl/vga/font_rom.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="9"/>
<association xil_pn:name="Implementation" xil_pn:seqID="3"/>
</file>
<file xil_pn:name="../../../rtl/vga/vga.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="10"/>
<association xil_pn:name="Implementation" xil_pn:seqID="7"/>
</file>
<file xil_pn:name="../../../rtl/vga/vram.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="11"/>
<association xil_pn:name="Implementation" xil_pn:seqID="2"/>
</file>
<file xil_pn:name="../../../rtl/apple1.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="12"/>
<association xil_pn:name="Implementation" xil_pn:seqID="16"/>
</file>
<file xil_pn:name="../../../rtl/clock.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="13"/>
<association xil_pn:name="Implementation" xil_pn:seqID="15"/>
</file>
<file xil_pn:name="../../../rtl/pwr_reset.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="14"/>
<association xil_pn:name="Implementation" xil_pn:seqID="12"/>
</file>
<file xil_pn:name="../../../rtl/ram.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="15"/>
<association xil_pn:name="Implementation" xil_pn:seqID="11"/>
</file>
<file xil_pn:name="../../../rtl/rom_basic.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="16"/>
<association xil_pn:name="Implementation" xil_pn:seqID="10"/>
</file>
<file xil_pn:name="../../../rtl/rom_wozmon.v" xil_pn:type="FILE_VERILOG">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="17"/>
<association xil_pn:name="Implementation" xil_pn:seqID="9"/>
</file>
<file xil_pn:name="apple1_s3e_starterkit_top.ucf" xil_pn:type="FILE_UCF">
<association xil_pn:name="Implementation" xil_pn:seqID="0"/>
</file>
</files>
<properties>
<property xil_pn:name="Device" xil_pn:value="xc3s500e" xil_pn:valueState="non-default"/>
<property xil_pn:name="Device Family" xil_pn:value="Spartan3E" xil_pn:valueState="non-default"/>
<property xil_pn:name="Evaluation Development Board" xil_pn:value="Spartan-3E Starter Board" xil_pn:valueState="non-default"/>
<property xil_pn:name="Implementation Top" xil_pn:value="Module|apple1_s3e_starterkit_top" xil_pn:valueState="non-default"/>
<property xil_pn:name="Implementation Top File" xil_pn:value="../../../rtl/boards/spartan3e_starterkit/apple1_s3e_starterkit_top.v" xil_pn:valueState="non-default"/>
<property xil_pn:name="Implementation Top Instance Path" xil_pn:value="/apple1_s3e_starterkit_top" xil_pn:valueState="non-default"/>
<property xil_pn:name="Package" xil_pn:value="fg320" xil_pn:valueState="non-default"/>
<property xil_pn:name="Preferred Language" xil_pn:value="Verilog" xil_pn:valueState="default"/>
<property xil_pn:name="Property Specification in Project File" xil_pn:value="Store non-default values only" xil_pn:valueState="non-default"/>
<property xil_pn:name="Simulator" xil_pn:value="ISim (VHDL/Verilog)" xil_pn:valueState="default"/>
<property xil_pn:name="Speed Grade" xil_pn:value="-4" xil_pn:valueState="non-default"/>
<property xil_pn:name="Synthesis Tool" xil_pn:value="XST (VHDL/Verilog)" xil_pn:valueState="default"/>
<property xil_pn:name="Target UCF File Name" xil_pn:value="apple1_s3e_starterkit_top.ucf" xil_pn:valueState="non-default"/>
<property xil_pn:name="Top-Level Source Type" xil_pn:value="HDL" xil_pn:valueState="default"/>
<property xil_pn:name="Working Directory" xil_pn:value="." xil_pn:valueState="non-default"/>
<!-- -->
<!-- The following properties are for internal use only. These should not be modified.-->
<!-- -->
<property xil_pn:name="PROP_DesignName" xil_pn:value="Apple-One" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_DevFamilyPMName" xil_pn:value="spartan3e" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_intProjectCreationTimestamp" xil_pn:value="2018-02-11T23:27:18" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWbtProjectID" xil_pn:value="44155E32156B424F8EA41D66911C47DB" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWorkingDirLocWRTProjDir" xil_pn:value="Same" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWorkingDirUsed" xil_pn:value="No" xil_pn:valueState="non-default"/>
</properties>
<bindings/>
<libraries/>
<autoManagedFiles>
<!-- The following files are identified by `include statements in verilog -->
<!-- source files and are automatically managed by Project Navigator. -->
<!-- -->
<!-- Do not hand-edit this section, as it will be overwritten when the -->
<!-- project is analyzed based on files automatically identified as -->
<!-- include files. -->
</autoManagedFiles>
</project>

View File

@ -0,0 +1,31 @@
#Pin definitions
# clocks
NET "CLK_50MHZ" LOC = "C9" | IOSTANDARD = LVCMOS33 ;
# ps/2 keyboard
NET "PS2_KBDAT" LOC = G13 | IOSTANDARD = LVCMOS33;
NET "PS2_KBCLK" LOC = G14 | IOSTANDARD = LVCMOS33;
# VGA pins
NET "VGA_R" LOC = H14 | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
NET "VGA_G" LOC = H15 | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
NET "VGA_B" LOC = G15 | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
NET "VGA_HS" LOC = F15 | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
NET "VGA_VS" LOC = F14 | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
# RS-232 pins
#NET "UART_RXD" LOC = "U8" | IOSTANDARD = LVTTL ;
#NET "UART_TXD" LOC = "M13" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = SLOW ;
NET "UART_RXD" LOC = "R7" | IOSTANDARD = LVTTL ;
NET "UART_TXD" LOC = "M14" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = SLOW ;
# RESET BUTTON / SOUTH on the board
NET "BUTTON" LOC = "K17" | IOSTANDARD = LVTTL | PULLDOWN;
#Created by Constraints Editor (xc3s500e-fg320-4) - 2018/02/11
NET "CLK_50MHZ" TNM_NET = CLK_50MHZ;
NET "clk25" TNM_NET = clk25;
TIMESPEC TS_CLOCK_50 = PERIOD "CLK_50MHZ" 20 ns HIGH 50%;
TIMESPEC TS_CLOCK_25 = PERIOD "clk25" 40 ns HIGH 50%;

12
tools/ise_hexer/README.md Normal file
View File

@ -0,0 +1,12 @@
# ISE_HEXER 1.0<br><h2>Convert a $readmemh HEX file so that Xilinx ISE can use them<br>Niels A. Moseley
Xilinx ISE is a piece of sh*t when it comes to reading HEX file using $readmemh. It will only read files that are _exactly_ the right length for the ROM/RAM to be instantiated.
Furthermore, it only allows _one_ data entry per line and _no_ comments.
This program makes sure there is only one data entry per line.
Comments will still be copied and cause erros.
It was programmed for the TinyCC portable compiler: http://download.savannah.gnu.org/releases/tinycc/
Install TCC in the subdir tcc.

81
tools/ise_hexer/main.c Normal file
View File

@ -0,0 +1,81 @@
/* Converts vga_font.bin into vga_font.hex
Author: Niels A. Moseley
*/
#include<stdio.h>
#include<stdint.h>
const char hextbl[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
uint8_t isWhiteSpace(char c)
{
if ((c==' ') || (c=='\t'))
{
return 1;
}
return 0;
}
uint8_t convert(const char *infilename, const char *outfilename)
{
FILE *fin = fopen(infilename,"rt");
if (fin == NULL)
{
printf("Error: cannot open %s!\n", infilename);
return 1;
}
FILE *fout = fopen(outfilename,"wt");
if (fout == NULL)
{
printf("Error: cannot open %s for writing!\n", outfilename);
fclose(fin);
return 1;
}
uint8_t inWhiteSpace = 1;
while(!feof(fin))
{
char c = fgetc(fin);
if (inWhiteSpace == 0)
{
if (isWhiteSpace(c))
{
inWhiteSpace = 1;
fprintf(fout, "\n");
}
else
{
fprintf(fout,"%c", c);
}
}
else
{
if (!isWhiteSpace(c))
{
fprintf(fout,"%c", c);
inWhiteSpace = 0;
}
else
{
// still in white space .. do nothing
}
}
}
fclose(fin);
fclose(fout);
}
int main(int argc, char *argv[])
{
printf("ISE_HEXER v1.0\n");
convert("..\\..\\roms\\basic.hex", "..\\..\\roms\\basic_ise.hex");
convert("..\\..\\roms\\ram.hex", "..\\..\\roms\\ram_ise.hex");
convert("..\\..\\roms\\wozmon.hex", "..\\..\\roms\\wozmon_ise.hex");
printf("Done\n");
return 0;
}

1
tools/ise_hexer/run.bat Normal file
View File

@ -0,0 +1 @@
tcc\tcc -run main.c