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 10

windowsでiverilog その46

Last updated at Posted at 2020-07-08

#概要

windowsでiverilogやってみた。
polyphonyでcpu書いてみる。
アセンブラでfizzbuzz書いてみる。
ちなみに、除算が使えないので、一苦労。

#サンプルコード

  r0set  0
  r0save 0
  r0save 1
  r0save 2
label_20:
  r0load  2
  r1set  1
  r0 + r1
  r0save  2
  r1set  9
  r0 < r1
  if label_32
  r0load  1
  r1set  1
  r0 + r1
  r0save  1
  r0set  0
  r0save  2
label_32:    
  r0load  0
  r1set	 1
  r0 + r1
  r0save 0
  r0load  0
  r1set	 100
  r0 < r1
  if label_255
  r0load  0
  r1set	 15
  r0 % r1
  if label_120
  r0load  0
  r1set	 5
  r0 % r1
  if label_140
  r0load  0
  r1set	 3
  r0 % r1
  if label_160
  r0load  1
  r0out
  r0load  2
  r0out
  jp label_20
label_120:
  r0set  'f'
  r0out 
  r0set  'i'
  r0out
  r0set  'z'
  r0out
  r0set  'z'
  r0out
  r0set  'b'
  r0out
  r0set  'u'
  r0out
  r0set  'z'
  r0out
  r0set  'z'
  r0out
  r0set  ' '
  r0out
  jp label_20
label_140:
  r0set  'b'
  r0out
  r0set  'u'
  r0out
  r0set  'z'
  r0out
  r0set  'z'
  r0out
  r0set  ' '
  r0out
  jp label_20
label_160:
  r0set  'f'
  r0out
  r0set  'i'
  r0out
  r0set  'z'
  r0out
  r0set  'z'
  r0out
  r0set  ' '
  r0out
  jp label_20
label_255:
  end


以上。

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?