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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ba8ac0a5eaa357455a6e03c2a68780872c13e52
4
- data.tar.gz: dadbb4848036104eccb883594f6ebc55242e2f8e
3
+ metadata.gz: da602175a9a4fad4303735f4839de634fdd6c69f
4
+ data.tar.gz: ddec7e453dc99ce5ad427b8a8ba1d727ad3c7858
5
5
  SHA512:
6
- metadata.gz: bea3e6aa10a9688867818db06eb00cd1ea57259c1346fe3784ebcf1f7c3eb639db7b8e14556b8ee0cf3c05574aab69187fd9a8fb7d1e08c7825c6c3b4f991dbb
7
- data.tar.gz: 4df51297c08a6e4460327b78aeab6856e619a0f773baf6e5b7e8ad95d1b9d716bcd167fb5389fbab79995fefc16300d54cc4e73e2111ffe9ee330ea6398638ae
6
+ metadata.gz: 2e133f6438d2a32d2cc03cc93e72a3ac2ab6f83cbb358146e21d7007334f900bc5df54a9636e499850fba1284fc4ac4c550294c3288b124610605e7e1e0f3169
7
+ data.tar.gz: ea199e86cc2cf07d5fde0eb4bcc5a585ed311ac21354c1be517896be45a9e4112d09219c1e4e346c07253638d0e4f10a197b14076fbcf65320100b9ef6489d49
@@ -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.delete(" ").split(",")
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::Bez) ||
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 Bez < Instruction
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("bez",Formats::BFormat.new(0b001111))
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(0b011111))
13
+ super("bnez",Formats::BFormat.new(0b001111))
14
14
  @variables = [Variables::Address.new]
15
15
  @length = {r1:10, op:6}
16
16
  end
@@ -8,7 +8,7 @@ module Rips
8
8
  "jal",
9
9
  "ji",
10
10
  "jr",
11
- "bez",
11
+ "beqz",
12
12
  "bnez",
13
13
  "lesr",
14
14
  "li",
@@ -1,6 +1,6 @@
1
1
  require "rips/instructions/add"
2
2
  require "rips/instructions/and"
3
- require "rips/instructions/bez"
3
+ require "rips/instructions/beqz"
4
4
  require "rips/instructions/bnez"
5
5
  require "rips/instructions/j"
6
6
  require "rips/instructions/jal"
data/lib/rips/utils.rb CHANGED
@@ -6,4 +6,13 @@ class Integer
6
6
  '%0*b' % [width, self]
7
7
  end
8
8
  end
9
+ end
10
+
11
+ class String
12
+ def del(regexp)
13
+ gsub(regexp,'')
14
+ end
15
+ def del!(regexp)
16
+ gsub!(regexp,'')
17
+ end
9
18
  end
data/lib/rips/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rips
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/rips.gemspec CHANGED
@@ -21,4 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency 'rspec'
24
+
25
+ spec.required_ruby_version = '>= 2.0'
24
26
  end
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.7
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-13 00:00:00.000000000 Z
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/bez.rb
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
  - - ">="