Skip to content

Commit

Permalink
Create Tutorial - Add Two Integers in a Baby RISC-V.md (#14527)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbeggsTT authored Nov 6, 2024
1 parent 22b94ab commit 4fe5505
Showing 1 changed file with 46 additions and 0 deletions.
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);
```

0 comments on commit 4fe5505

Please sign in to comment.