Java Reference
In-Depth Information
[bus.command ACK]
EXEC_INPUT
bus.command
INPUT
EXEC_INPUT2
bus.command
RAM_WRITE
bus.address
arg( IR )
DECODE
FETCH
EXEC_OUTPUT
EXEC_OUTPUT2
bus.command
OUTPUT
bus.command
RAM_READ
bus.address
arg( IR )
Figure 5.10 FSA for I
O instructions
the data. Clearly this approach simulates the high-level functionalities
without taking into account the low-level details such as temporization.
The INPUT and OUTPUT instructions can be executed by the CPU intro-
ducing into the FSA the new states presented in Figure 5.10.
Decision point
How does the hard disk simulate the interaction with the file system?
In real computer systems the high-level operations of opening, closing
and reading from file are implemented by the operating system. The hard
disk component emulates the combination of both a hardware device and
operating system.
The FREAD instruction is similar to the INPUT instruction: it reads a line
from a text file and copies it into a memory cell.
The instructions FOPEN , FCLOSE and FREAD can be executed by the CPU
introducing into the FSA the new states presented in Figure 5.11.
5.6.3
Implementation
The CPU new instructions can be easily implemented using the algorithm
described in Sidebar 5.2. The lengthy code resulting from the application of
the algorithm is not shown here.
Since all the classes must access information on the BUS it is important
that they share a common codification for such information. The initial
version of such information is contained in the RAM class. Since all the
devices must share this codification a better place to define it is the class
 
Search WWH ::




Custom Search