URL
https://opencores.org/ocsvn/tinycpu/tinycpu/trunk
Subversion Repositories tinycpu
Compare Revisions
- This comparison shows the changes necessary to convert path
/tinycpu/trunk/assembler
- from Rev 37 to Rev 38
- ↔ Reverse comparison
Rev 37 → Rev 38
/asm.rb
18,6 → 18,19
end |
end |
|
class OpcodeByte2 |
attr_accessor :cond, :reg2, :useextra, :reg3; |
def to_hex |
s=(cond << 8 | reg2.number << 5 | useextra << 4 | reg3.number).to_s(16); |
if s.length == 1 |
"0"+s; |
elsif s.length==0 |
"00"; |
else |
s; |
end |
end |
end |
|
|
class Register8 |
26,6 → 39,12
@number=num |
end |
end |
class OpcodeOption |
attr_accessor :number |
def initialize(num) |
@number=num; |
end |
end |
|
$iftr = 0; #0 for no condition, 1 for if TR, 2 for if not TR |
$useextra = 0; |
54,6 → 73,7
puts PREFIX + o.to_hex + imm.to_s(16) + SUFFIX; |
puts SEPERATOR; |
end |
def |
|
|
def mov(arg1,arg2) |
81,7 → 101,12
r1=Register8.new(1) |
r2=Register8.new(2) |
r3=Register8.new(3) |
r4=Register8.new(4) |
r5=Register8.new(5) |
sp=Register8.new(6) |
ip=Register8.new(7) |
|
|
#test code follows. Only do it here for convenience.. real usage should prefix assembly files with `require "asm.rb"` |
if_tr_set{ |
mov r1,0x10 |