Skip to content

Commit

Permalink
Bug no write back, consertei alguma coisa ja, mas não tudo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Italo Valcy committed Jun 19, 2008
1 parent c3a07af commit 71a9c7e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/barramento.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ def Barramento.read(type,address, qtd)
return value
end

def Barramento.write(type,address,value)
Simulador.set_value_bus(type,"con","2")
def Barramento.write(type,address,value,qtd)
con = qtd.to_s(2).rjust(2,'0') + "10"
Simulador.set_value_bus(type,"con",con.to_i(2).to_s)
Simulador.set_value_bus(type,"end",address)
Simulador.set_value_bus(type,"data",value)
Simulador.get_clock
case type
when 'mem'
Memoria.set_value(address,value)
Memoria.set_value(address,value,qtd)
when 'io'
Simulador.set_value_grid('io',address,value)
end
Expand Down
12 changes: 11 additions & 1 deletion lib/gui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def initializa_configs
@@glade['clock_type'].active = 0
@@glade['cache_size'].active = 0
@@glade['cache_mapeamento'].active = 0
@@glade['cache_atualizacao'].active = 1
@@glade['cache_atualizacao'].active = 0
@@glade['cache_habilitado'].active = true
@@glade['io_size'].value = @@tam_io
@@glade['mem_size'].value = @@tam_mem
Expand Down Expand Up @@ -161,6 +161,15 @@ def carregar_arq(file_dialog, name_view)
return true
end

def clear_cache
list = @@glade['gridview_cache'].model
for i in 0..@@tam_cache -1
iter = list.get_iter(i.to_s)
iter[1] = "-1"
iter[2] = "0"
end
end

def set_events
@@glade['simulador_window'].signal_connect("destroy") { Gtk.main_quit }
@@glade['btn_sair'].signal_connect("activate") { Gtk.main_quit }
Expand Down Expand Up @@ -215,6 +224,7 @@ def event_clear
@@glade['txt_ula'].buffer.text = ""
@@count_clock = 0
@@glade['statusbar'].push(1,"Pulsos de clock: 0")
clear_cache()
end

def event_input_hd
Expand Down
12 changes: 10 additions & 2 deletions lib/memoria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ def Memoria.get_value(address, qtd)
end

# Armazena o valor de value na memoria no endereco address
def Memoria.set_value(address, value)
Simulador.set_value_grid('mem',address,value)
def Memoria.set_value(address, value, qtd)
case qtd
when 1
Simulador.set_value_grid('mem',address,value)
when 2
v1 = value.to_i / 256
Simulador.set_value_grid('mem',address,v1.to_s)
v2 = value.to_i - v1 * 256
Simulador.set_value_grid('mem',"#{address.to_i+1}",v2.to_s)
end
end
end

0 comments on commit 71a9c7e

Please sign in to comment.