Skip to content

Commit dd90fd8

Browse files
author
Robert Muchsel
authored
README: Document generated file names; remove rtldev directory (#119)
1 parent e90ba7f commit dd90fd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+130
-1988210
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
/ninja-python-distributions
1515
/pip-selfcheck.json
1616
/pyvenv.cfg
17-
/rtldev/rtlsim-*/
18-
/rtldev/blocklevel-*/
17+
/rtldev/
1918
/share/
2019
/tensorflow/
2120
**/__pycache__/

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MAX78000 Model Training and Synthesis
22

3-
_March 18, 2021_
3+
_March 31, 2021_
44

55
The Maxim Integrated AI project is comprised of four repositories:
66

@@ -1845,15 +1845,53 @@ The MAX78000/MAX78002 accelerator can generate an interrupt on completion, and i
18451845

18461846
To run another inference, ensure all groups are disabled (stopping the state machine, as shown in `cnn_init()`). Next, load the new input data and start processing.
18471847

1848-
#### Softmax, and Data unload in C
1848+
#### Softmax, and Data Unload in C
18491849

18501850
`ai8xize.py` can generate a call to a software Softmax function using the command line switch `--softmax`. That function is provided in the `assets/device-all` folder. To use the provided software Softmax on MAX78000/MAX78002, the last layer output should be 32-bit wide (`output_width: 32`).
18511851

18521852
The software Softmax function is optimized for processing time and it quantizes the input. When the last layer uses weights that are not 8-bits, the software function used will shift the input values first.
18531853

18541854
![softmax](docs/softmax.png)
18551855

1856-
#### Overview of the Generated API functions
1856+
1857+
1858+
#### Generated Files and Upgrading the CNN Model
1859+
1860+
The generated C code comprises the following files. Some of the files are customized based in the project name, and some are custom for a combination of project name and weight/sample data inputs:
1861+
1862+
| File name | Source | Project specific? | Model/weights change? |
1863+
| ------------ | -------------------------------- | ----------------- | --------------------- |
1864+
| Makefile | template in assets/embedded-ai87 | Yes | No |
1865+
| cnn.c | generated | Yes | **Yes** |
1866+
| cnn.h | template in assets/device-all | Yes | **Yes** |
1867+
| weights.h | generated | Yes | **Yes** |
1868+
| log.txt | generated | Yes | **Yes** |
1869+
| main.c | generated | Yes | No |
1870+
| sampledata.h | generated | Yes | No |
1871+
| softmax.c | assets/device-all | No | No |
1872+
| model.launch | template in assets/eclipse | Yes | No |
1873+
| .cproject | template in assets/eclipse | Yes | No |
1874+
| .project | template in assets/eclipse | Yes | No |
1875+
1876+
In order to upgrade an embedded project after retraining the model, point the network generator to a new empty directory and regenerate. Then, copy the four files that will have changed to your original project — `cnn.c`, `cnn.h`, `weights.h`, and `log.txt`. This allows for persistent customization of the I/O code and project (for example, in `main.c` and additional files) while allowing easy model upgrades.
1877+
1878+
The generator also adds all files from the `assets/eclipse`, `assets/device-all`, and `assets/embedded-ai87` folders. These files (when starting with `template` in their name) will be automatically customized to include project specific information as shown in the following table:
1879+
1880+
| Key | Replaced by |
1881+
| --------------------- | ------------------------------------------------------------ |
1882+
| `##__PROJ_NAME__##` | Project name (works on file names as well as the file contents) |
1883+
| `##__ELF_FILE__##` | Output elf (binary) file name |
1884+
| `##__BOARD__##` | Board name (e.g., `EvKit_V1`) |
1885+
| `##__FILE_INSERT__##` | Network statistics and timer |
1886+
1887+
##### Contents of the device-all Folder
1888+
1889+
* For MAX78000/MAX78002, the software Softmax is implemented in `softmax.c`.
1890+
* A template for the `cnn.h` header file in `templatecnn.h`. The template is customized during code generation using model statistics and timer, but uses common function signatures for all projects.
1891+
1892+
1893+
1894+
#### Overview of the Generated API Functions
18571895

18581896
The API code (in `cnn.c` by default) is auto-generated. It is data independent, but differs depending on the network. This simplifies replacing the network while keeping the remainder of the code intact.
18591897

@@ -1898,10 +1936,7 @@ Turn on the boost circuit on `port`.`pin`. This is only needed for very energy i
18981936
`int cnn_boost_disable(mxc_gpio_regs_t *port, uint32_t pin);`
18991937
Turn off the boost circuit connected to `port`.`pin`.
19001938

1901-
#### Contents of the device-all Folder
19021939

1903-
* For MAX78000/MAX78002, the software Softmax is implemented in `softmax.c`.
1904-
* A template for the `cnn.h` header file in `templatecnn.h`. The template is customized during code generation.
19051940

19061941
#### Energy Measurement
19071942

README.pdf

10.2 KB
Binary file not shown.

izer/izer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def main():
138138
sampledata_file = args.sample_input
139139
data = sampledata.get(sampledata_file)
140140
if np.max(data) > 127 or np.min(data) < -128:
141-
raise ValueError(f'Input data {sampledata_file} contains values that exceed 8-bit!')
141+
eprint(f'Input data {sampledata_file} contains values that are outside the limits of '
142+
f'signed 8-bit (data min={np.min(data)}, max={np.max(data)})!')
142143
# Work with 1D input data
143144
if len(data.shape) < 3:
144145
data = np.expand_dims(data, axis=2)

rtldev/ai85-biasmem/Makefile.ARM_PROG

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)