Boros Simbong
Id pomonuhuan tokud, boros simbong (Inggilis: assembly language toi assembly noopo) nopo nga' it boros abasa tulun, di tosiriba' kopio, sontimbou mantad hisok pamot om i hisok osuau tulun i tosomok mantad koyuan tokud pointopot. Iti boros ponokudan okon nopo iso boros, nga' iso kawo do boros ponokudan. Tikid guang tokud (processor) haro dau sondii do boros simbong, tu' tikid yolo haro do langod ponuhuan (instruction set) poimbida'.
Baino nopo ti nga' okuri kopio guno do monokud id boros simbong tu' kogumuan ponimpung (compiler) kopoworun do tinokud boros simbong lobi awasi ko' i don tinunturu. Nga', iti au kasari otopot id pisuk do labus ponokudan koubasan, ugu id ponokudan montok kakamot asabi' hiza (time-sensitive).
Poomitanan
[simbanai | simbanai toud]Siriba poomitanan do boros simbong RISC-V (pinosimban mantad [1]):
app_main:
.equ GPIO_OUT_W1TS_REG, 0x60004008 ; 0x6000 don pangamping, 0x....4000 don GPIO, om 0x....,...C don GPIO_OUT_W1TS_REG
.equ GPIO_ENABLE_REG, 0x60004024 ; Irad tuku saat
.equ LED, 0b000100 ; Pomili dalat GPIO do LED id GPIO2 (D0)
li t0, LED ; Pilio GPIO2 (D0 id gantai Seeed XIAO ESP32C3)
li t1, GPIO_ENABLE_REG ; Pokuo nundar enable OUTPUT
sw t0, 0(t1) ; Poopio gatang t0 id pagatadan di t1 - Poposuhu do noko-OUTPUT-enabled o GPIO2.
li t1, GPIO_OUT_W1TS_REG ; Poopio pagatadan do SET GPIO (Komoyon do SET papakaas do gatang GPIO)
li t0, LED
sw t0, 0(t1) ; Posio LED
Hisok (code) diti pamasi do iso LED poingoput id dalat D0 do gantai pomorunan Seeed XIAO ESP32C3. Okito ngaai ponuhuan ugu li
, om sw
. Duo ponuhuan diti nopo nga' poimagon id songiyo RISC-V. Lobi pinotomod, i ponuhuan sw
(koinibaan: store word
) nopo nga pointomod id koruhango' RV32I/RV64I
[2].
Okito nogi i tinudu (directive) .equ
ii guno nopo popokomoi do togom.[3]
Id C
[simbanai | simbanai toud]Apakai nogi boros simbong id suang do hisok C.[4] Poomitanan id siriba' popoili 1
mantad src
kumaa dst
om poporuhang nogi 1
id dst
. Iti nopo nga' roitan do simbong suangtuku toi inline assembly.
int src = 1;
int dst;
asm ("mov %1, %0\n\t"
"add $1, %0"
: "=r" (dst)
: "r" (src));
printf("%d\n", dst);
Kogunoon
[simbanai | simbanai toud]Ogumu pamot onibo sundu mamakai do boros simbong tu' au kabagal o sundu do monokodung boros akaas timbou. Somoonu, apakai nogi boros simbong poposiau do nunu katandaan, irad montok pongumbangan pandu dontuntuu (digital signal processing).[5] Nung haro doliwan (hardware) pinotomod i lobi osiau do mongintob katandaan poimbida', somoonu lobi osiau i boros simbong gunoon moniton boros lobi akaas timbou.
Sukuon
[simbanai | simbanai toud]- ↑ https://github.com/andergisomon/risc-v-learning/blob/main/GPIO_example/main/main.S
- ↑ https://msyksphinz-self.github.io/riscv-isadoc/html/rvi.html#sw
- ↑ https://michaeljclark.github.io/asm.html
- ↑ https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/how-to-use-inline-assembly-language-in-c-code.html#extended-asm-assembler-instructions-with-c-expression-operands
- ↑ https://github.com/espressif/esp-dsp/blob/master/modules/matrix/add/float/dspm_add_f32_ae32.S