rips 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rips/assembler.rb +2 -14
- data/lib/rips/instructions/{bez.rb → beqz.rb} +2 -2
- data/lib/rips/instructions/bnez.rb +1 -1
- data/lib/rips/instructions/set.rb +1 -1
- data/lib/rips/instructions.rb +1 -1
- data/lib/rips/utils.rb +9 -0
- data/lib/rips/version.rb +1 -1
- data/rips.gemspec +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da602175a9a4fad4303735f4839de634fdd6c69f
|
4
|
+
data.tar.gz: ddec7e453dc99ce5ad427b8a8ba1d727ad3c7858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e133f6438d2a32d2cc03cc93e72a3ac2ab6f83cbb358146e21d7007334f900bc5df54a9636e499850fba1284fc4ac4c550294c3288b124610605e7e1e0f3169
|
7
|
+
data.tar.gz: ea199e86cc2cf07d5fde0eb4bcc5a585ed311ac21354c1be517896be45a9e4112d09219c1e4e346c07253638d0e4f10a197b14076fbcf65320100b9ef6489d49
|
data/lib/rips/assembler.rb
CHANGED
@@ -61,16 +61,6 @@ module Rips
|
|
61
61
|
find_instructions
|
62
62
|
find_labels
|
63
63
|
|
64
|
-
puts "instructions...."
|
65
|
-
@instructions.each do |k|
|
66
|
-
puts "#{k}"
|
67
|
-
end
|
68
|
-
|
69
|
-
puts "labels...."
|
70
|
-
@labels.each do |k,v|
|
71
|
-
puts "#{k}:#{v}"
|
72
|
-
end
|
73
|
-
|
74
64
|
@input.each do |line|
|
75
65
|
|
76
66
|
# If line is empty -> next line
|
@@ -135,7 +125,7 @@ module Rips
|
|
135
125
|
@cmd[:name] = line.split("#").first.split(" ").first.downcase
|
136
126
|
@cmd[:arguments] = line.split("#").first.split("#{@cmd[:name]} ")
|
137
127
|
if !@cmd[:arguments].empty?
|
138
|
-
@cmd[:arguments] = @cmd[:arguments].pop.split("#").first.
|
128
|
+
@cmd[:arguments] = @cmd[:arguments].pop.split("#").first.del(/\s+|\t+/).split(",")
|
139
129
|
end
|
140
130
|
if @cmd[:arguments].first == "jr" ||
|
141
131
|
@cmd[:arguments].first == "nop"
|
@@ -148,14 +138,12 @@ module Rips
|
|
148
138
|
|
149
139
|
# Translate label's name to instruction's number
|
150
140
|
def parse_label
|
151
|
-
if (@instruction.is_a? Rips::Instructions::
|
141
|
+
if (@instruction.is_a? Rips::Instructions::Beqz) ||
|
152
142
|
(@instruction.is_a? Rips::Instructions::Bnez) ||
|
153
143
|
(@instruction.is_a? Rips::Instructions::J) ||
|
154
144
|
(@instruction.is_a? Rips::Instructions::Jal)
|
155
145
|
|
156
|
-
puts @cmd[:arguments]
|
157
146
|
@cmd[:arguments] = [@labels[@cmd[:arguments].first].to_s]
|
158
|
-
puts "Salto a: #{@cmd[:arguments]}"
|
159
147
|
end
|
160
148
|
end
|
161
149
|
|
@@ -3,14 +3,14 @@ require "rips/instructions/instruction"
|
|
3
3
|
module Rips
|
4
4
|
module Instructions
|
5
5
|
|
6
|
-
class
|
6
|
+
class Beqz < Instruction
|
7
7
|
|
8
8
|
attr_reader :variables, :length
|
9
9
|
|
10
10
|
# @variables: types of instruction's variables
|
11
11
|
# @length: length in bits for each variable
|
12
12
|
def initialize
|
13
|
-
super("
|
13
|
+
super("beqz",Formats::BFormat.new(0b011111))
|
14
14
|
@variables = [Variables::Address.new]
|
15
15
|
@length = {r1:10, op:6}
|
16
16
|
end
|
@@ -10,7 +10,7 @@ module Rips
|
|
10
10
|
# @variables: types of instruction's variables
|
11
11
|
# @length: length in bits for each variable
|
12
12
|
def initialize
|
13
|
-
super("bnez",Formats::BFormat.new(
|
13
|
+
super("bnez",Formats::BFormat.new(0b001111))
|
14
14
|
@variables = [Variables::Address.new]
|
15
15
|
@length = {r1:10, op:6}
|
16
16
|
end
|
data/lib/rips/instructions.rb
CHANGED
data/lib/rips/utils.rb
CHANGED
data/lib/rips/version.rb
CHANGED
data/rips.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rips
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Madh93
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,7 +80,7 @@ files:
|
|
80
80
|
- lib/rips/instructions.rb
|
81
81
|
- lib/rips/instructions/add.rb
|
82
82
|
- lib/rips/instructions/and.rb
|
83
|
-
- lib/rips/instructions/
|
83
|
+
- lib/rips/instructions/beqz.rb
|
84
84
|
- lib/rips/instructions/bnez.rb
|
85
85
|
- lib/rips/instructions/instruction.rb
|
86
86
|
- lib/rips/instructions/j.rb
|
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '2.0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - ">="
|