-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Tutorial - Add Two Integers in a Baby RISC-V.md (#14527)
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...xamples/add_2_integers_in_riscv/Tutorial - Add Two Integers in a Baby RISC-V.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Tutorial - Add Two Integers in a Baby RISC-V | ||
1. To build and execute use the following commands: | ||
|
||
```export ARCH_NAME=<arch name> | ||
export TT_METAL_HOME=<this repo dir> | ||
./build_metal.sh --build-tests | ||
./build/programming_examples/add_2_integers_in_riscv | ||
``` | ||
2. Setup the host program: | ||
|
||
```Device *device = CreateDevice(0); | ||
CommandQueue& cq = device->command_queue(); | ||
Program program = CreateProgram(); | ||
constexpr CoreCoord core = {0, 0}; | ||
``` | ||
3. Create two integers: | ||
|
||
``` | ||
Int a=1 | ||
Int b=2 | ||
``` | ||
|
||
4. Setup the kernel function for integer addition: | ||
|
||
``` | ||
KernelHandle binary_reader_kernel_id = CreateKernel( | ||
program, | ||
"tt_metal/programming_examples/add_2_integers_in_riscv/kernels/reader_writer_add_in_riscv.cpp", | ||
core, | ||
DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}); | ||
``` | ||
``` | ||
Kernel Code Here - TBD | ||
``` | ||
5. Setup two integers as runtime arguments: | ||
|
||
``` | ||
EnqueProgram(cq, program, false); | ||
Finish(cq); | ||
``` | ||
|
||
6. Close the device: | ||
|
||
``` | ||
CloseDevice(device); | ||
``` |