-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Italo Valcy
committed
Jun 11, 2008
1 parent
207086b
commit dae9bac
Showing
3 changed files
with
104 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'gui' | ||
require 'memoria' | ||
|
||
class Barramento | ||
def initialize | ||
end | ||
|
||
# Solicita do barramento a leitura do dado | ||
# no endereço address. | ||
# Entrada: | ||
# type - Tipo de barramento: mem (memoria), io (I/O) | ||
# address - Endereço que deseja-se ler | ||
# Retorno: | ||
# Valor contido em address | ||
def read(type,address) | ||
Simulador.set_value_bus(type,"con","1") | ||
Simulador.set_value_bus(type,"end",address) | ||
value = Memoria.get_value(address,1) | ||
Simulador.set_value_bus(type,"data",value) | ||
return value | ||
end | ||
|
||
def write(type,address,value) | ||
Simulador.set_value_bus(type,"con","2") | ||
Simulador.set_value_bus(type,"end",address) | ||
Simulador.set_value_bus(type,"data",value) | ||
Memoria.set_value(address,value) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters