added v2.0

This commit is contained in:
Michael Schröder
2023-01-11 11:13:09 +01:00
parent 2a5a64ca91
commit 971b323822
584 changed files with 159319 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
class GPIO {
static Array gpio;
function void init(int addr){
let gpio = addr;
return;
}
function boolean readBut() {
if (gpio[1] & 2){
return false;
}
return true;
}
function void writeLed(int c){
let gpio[0] = c;
return;
}
function void readLed(){
return gpio[0];
}
}

View File

@@ -0,0 +1,18 @@
all: jack vm asm bin sim
jack:
../../tools/JackCompiler/JackCompiler.pyc ./
vm:
../../tools/VMTranslator/VMTranslator.pyc ./
asm:
../../tools/Assembler/assembler.pyc out.asm
bin:
../../tools/AsciiToBin.py out.hack
sim:
cp out.hack ../00_HACK/ROM.hack
upload:
iceprogduino -o 64k -w out.bin
clean:
rm -f *.vm *.asm *.hack *.bin *~
.PHONY: all clean

View File

@@ -0,0 +1,54 @@
## UART.jack
Library that provides character based access to `UART_TX` and `UART_RX`.
### UART_Test
In the Testfolder `02_UART_Test` you find a minimal version of `Sys.jack` containing the init function `Sys.init()`, which is called after starting JACK-OS. `Sys.init()` is the JACK-OS version of `echo.asm`, which reads the bytes received at `UART_RX` and writes the values to `UART_TX` in an endless loop:
```
class Sys {
function void init() {
do UART.init(4098);
while (true){
do UART.write(UART.read());
}
return;
}
}
```
***
### Project
* Implement `UART.jack`
* Test in simulation:
```
$ cd 02_UARTTest
$ make
$ cd ../00_HACK
$ apio clean
$ apio sim
```
The test bench will simulate the transmission of "RX" to UART_RX. Check if HACK echoes to `UART_TX`.
![](uart.png)
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload the UART_Test to iCE40HX1K-EVB with:
```
$ cd 02_UART_Test
$ make
$ make upload
```
* Connect HACK with your computer over UART, open a terminal program and type some chars. Check if HACK can echo them.
```
$ tio /dev/ttyACM0
```

View File

@@ -0,0 +1,46 @@
## UART.jack
Library that provides access to `UART_TX` and `UART_RX`.
***
## Project
In the Testfolder `02_UART_Test` you find a minimal version of `Sys.jack` containing the init function `Sys.init()`, which is called after starting JACK-OS. `Sys.init()` is the JACK-OS version of `echo.asm`, which reads the bytes received at `UART_RX` and writes the values to `UART_TX` in an endless loop:
```
class Sys {
function void init() {
do UART.init(4098);
while (true){
do UART.write(UART.read());
}
return;
}
}
```
* Implement `UART.jack`
* Test in simulation:
```
$ cd 02_UARTTest
$ make
$ cd ../00_HACK
$ apio clean
$ apio sim
```
The test bench will simulate the transmission of "RX" to UART_RX. Check if HACK echoes to `UART_TX`.
![](uart.png)
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload the UART_Test to iCE40HX1K-EVB with:
```
$ cd 02_UART_Test
$ make
$ make upload
```
* Connect HACK with your computer over UART, open a terminal program and type some chars. Check if HACK can echo them.
```
$ tio /dev/ttyACM0
```

View File

@@ -0,0 +1,17 @@
/**
* A library that supports various program execution services.
*/
class Sys {
/** Performs all the initializations required by the OS. */
function void init() {
do UART.init(4098);
do UART.writeChar(71);
do UART.writeChar(79);
while (true){
do UART.writeChar(UART.readChar());
}
return;
}
}

View File

@@ -0,0 +1 @@
../UART.jack

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB