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 @@
../GPIO.jack

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,50 @@
## GPIO.jack
This library provides access to `BUT` and `LED`.
### GPIO-Test
In the Testfolder `01_GPIO_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 `leds.asm`, which reads the BUT and writes the values to LED in an endless loop:
```
class Sys {
function void init() {
do GPIO.init(4096);
while (true){
do GPIO.writeLed(GPIO.readBut());
}
return;
}
}
```
***
### Project
* Implement `GPIO.jack`
* Test in simulation:
```
$ cd 01_GPIO_Test
$ make
$ cd ../00_HACK
$ apio clean
$ apio sim
```
The test bench will simulate the pushing of BUT1/2. Check if the LED change accordingly.
![](gpio.png)
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload GPIO_Test to iCE40HX1K-EVB with:
```
$ cd 01_GPIO_Test
$ make
$ make upload
```
* push buttons BUT on iCE40HX1K-EVB and check the LED.

View File

@@ -0,0 +1,49 @@
## GPIO.jack
This library provides access to `BUT` and `LED`.
### function void init(int addr)
Initialize LED (addr) and BUT (addr+1).
### function int readLed()
Returns the value of LED.
### function void writeLed(int c)
Write c to LED.
### function int readBut()
Returns the state of BUT.
***
## Project
In the Testfolder `01_GPIO_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 `leds.asm`, which reads the BUT and writes the values to LED in an endless loop:
```
class Sys {
function void init() {
do GPIO.init(4096);
while (true){
do GPIO.writeLed(GPIO.readBut());
}
return;
}
}
```
* Implement `GPIO.jack`
* Test in simulation:
```
$ cd 01_GPIO_Test
$ make
$ cd ../00_HACK
$ apio clean
$ apio sim
```
The test bench will simulate the pushing of BUT1/2. Check if the LED change accordingly.
![](gpio.png)
* run in real hardware with HACK build at `06_IO_Devices/05_GO` (together with the bootloader). Build and upload GPIO_Test to iCE40HX1K-EVB with:
```
$ cd 01_GPIO_Test
$ make
$ make upload
```
* push buttons BUT on iCE40HX1K-EVB and check the LED.

View File

@@ -0,0 +1,15 @@
/**
* A library that supports various program execution services.
*/
class Sys {
/** Performs all the initializations required by the OS. */
function void init() {
do GPIO.init(4096);
while (true){
do GPIO.writeLed(GPIO.readBut());
}
return;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB