1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paiza.ioでelixir その321

Last updated at Posted at 2024-09-09

概要

paiza.ioでelixirやってみた。
練習問題、やってみた。
構想編

練習問題

RP2040のpioasmのディスアセンブラを書け。

pioasmの、命令セット。

命令は、9個
命令長は、16bit
メモリーは、32語

  • JMP 条件分岐。
  • WAIT 一定の条件が成立するまで停止。
  • IN 受信シフトレジスタへビット列を読み込む。
  • OUT 送信シフトレジスタからビット列を書き出す。
  • PUSH 受信シフトレジスタから受信バッファへデータを読み出す。
  • PULL 送信バッファから送信シフトレジスタへデータを書き出す。
  • MOV レジスタ等の間でデータをコピーする。
  • IRQ 割り込みフラグの読み書き。
  • SET GPIOピンやレジスタに即値を書き込む。
命令 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JMP 0 0 0 Delay/side-set Condition Address
WAIT 0 0 1 Delay/side-set Pol Source Index
IN 0 1 0 Delay/side-set Source Bit count
OUT 0 1 1 Delay/side-set Destination Bit count
PUSH 1 0 0 Delay/side-set 0 IfF Blk 0 0 0 0 0
PULL 1 0 0 Delay/side-set 1 IfE Blk 0 0 0 0 0
MOV 1 0 1 Delay/side-set Destination Op Source
IRQ 1 1 0 Delay/side-set 0 Clr Wait Index
SET 1 1 1 Delay/side-set Destination Data

方針

  • バイナリパターンマッチングを使う。
  • 13-15bitにマッチさせる。
            //     .wrap_target
    0xe001, //  0: set    pins, 1                    
    0xe000, //  1: set    pins, 0                    
            //     .wrap
バイナリー
e101
e100

逆アセンブル

.program test
    set pins 1 [1]
    set pins 0 [1]

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?