0
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?

More than 3 years have passed since last update.

俺cpuAdvent Calendar 2020

Day 11

windowsでiverilog その47

Last updated at Posted at 2020-07-08

#概要

windowsでiverilogやってみた。
polyphonyでcpu書いてみる。
アセンブラでfizzbuzz書いてみる。
ハンドコンパイルしてみた。

#ニーモニック

ニーモニック HEX
r0set 0 0x8000
r1set 1 0x8401
r0save 0 0xd000
r1save 1 0xd401
r0load 0 0xc000
r1load 1 0xc401
r0out 0xa000
r0 + r1 0x0100
r0 < r1 0x6100
r0 % r1 0x7100
jp 2 0x4002
if 2 0x5002

#アセンブラをハンドコンパイル

rom = [
0x8000, #  r0set  0    0
0xd000, #  r0save 0    1 
0xd001, #  r0save 1    2 
0xd002, #  r0save 2    3
        #label_20:     
0xc002, #  r0load  2   4
0x8401, #  r1set  1    5 
0x0100, #  r0 + r1     6
0xd002, #  r0save  2   7
0x8409, #  r1set  9    8
0x6100, #  r0 < r1     9
0x5011, #  if label_32 a
0xc001, #  r0load  1   b
0x8401, #  r1set  1    c
0x0100, #  r0 + r1     d
0xd001, #  r0save  1   e
0x8000, #  r0set  0    f
0xd002, #  r0save  2   10
        #label_32:     
0xc000, #  r0load  0   11
0x8401, #  r1set  1    12
0x0100, #  r0 + r1     13
0xd000, #  r0save 0    14
0xc000, #  r0load  0   15
0x8464, #  r1set  100  16
0x6100, #  r0 < r1     17
0x5053, #  if label_255 18
0xc000, #  r0load  0   19
0x840f, #  r1set  15   1a
0x7100, #  r0 % r1     1b
0x502a, #  if label_120 1c
0xd000, #  r0load  0   1d
0x8005, #  r1set  5    1e
0x7100, #  r0 % r1     1f
0x503d, #  if label_140 20
0xd000, #  r0load  0    21
0x8003, #  r1set  3    22
0x7100, #  r0 % r1     23
0x5048, #  if label_160 24
0xc001, #  r0load  1    25
0xa000, #  r0out        26
0x8002, #  r0load  2    27
0xa000, #  r0out        28
0x4004, #  jp label_20  29
        #label_120:     
0x8066, #  r0set  'f'   2a
0xa000, #  r0out        2b
0x8069, #  r0set  'i'   2c
0xa000, #  r0out        2d
0x807a, #  r0set  'z'   2e
0xa000, #  r0out        2f
0x807a, #  r0set  'z'   30
0xa000, #  r0out        31
0x8062, #  r0set  'b'   32
0xa000, #  r0out        33
0x8075, #  r0set  'u'   34
0xa000, #  r0out        35
0x807a, #  r0set  'z'   36
0xa000, #  r0out        37
0x807a, #  r0set  'z'   38
0xa000, #  r0out        39
0x8020, #  r0set  ' '   3a
0xa000, #  r0out        3b
0x4004, #  jp label_20  3c
        #label_140:     
0x8062, #  r0set  'b'   3d
0xa000, #  r0out        3e
0x8075, #  r0set  'u'   3f
0xa000, #  r0out        40
0x807a, #  r0set  'z'   41
0xa000, #  r0out        42
0x807a, #  r0set  'z'   43
0xa000, #  r0out        44
0x8020, #  r0set  ' '   45
0xa000, #  r0out        46
0x4004, #  jp label_20  47
        #label_160:     
0x8066, #  r0set  'f'   48
0xa000, #  r0out        49
0x8069, #  r0set  'i'   4a
0xa000, #  r0out        4b
0x807a, #  r0set  'z'   4c
0xa000, #  r0out        4d
0x807a, #  r0set  'z'   4e
0xa000, #  r0out        4f
0x8020, #  r0set  ' '   50
0xa000, #  r0out        51
0x4004, #  jp label_20  52
        #label_255:
0x4056, #  end          53
]


以上。

0
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
0
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?