Arhitecturi de Microcalculatoare: - Von Neuman - Caracteristici
Arhitecturi de Microcalculatoare: - Von Neuman - Caracteristici
Arhitecturi de Microcalculatoare: - Von Neuman - Caracteristici
• Von Neuman
• Caracteristici:
• Magistrala comuna
pentru memoria de
program si de date
• Exemplu tipic:
• Motorola HC11
• Arhitectura Harvard
• Caracteristici:
• magistrale distincte
pentru program si date
• Exemplu tipic
• Atmel AVR
Consecinte ale arhitecturii Harvard
– The presence of the second bus makes the following things possible:
− While an instruction is executed, the next instruction can be fetched
from the program memory. This technique is called pipelining and
brings a significant increase of the computer speed.
− The program memory can be organized in words of a different size,
usually larger, than the data memory. Wider instructions mean a
greater data flow to the CPU, and therefore the overall speed is
higher.
− Such architecture, along with reducing and optimizing the instruction
set, allow that most instructions execute in a single machine cycle.
Since the Harvard architecture is often accompanied by the reduction
of the size and complexity of the instruction set, the computers with
this architecture are also called RISC. (Reduced Instruction Set
Computers) For example, some PIC microcontrollers have an
instruction set of only 35 instructions, compared to more than 100 of
HC11. The speed increase is even higher.
Consecinte asupra organizarii spatiului de adrese
• Harta memoriei in
cazul unui
microcontroller HC11
• Harta memoriei
pentru un
microcontroller
din seria Atmel
AVR
• Se observa ca aici
exista 3 spatii de
adrese
Registrele interne ale CPU
• HC11 • AVR
• Doi acumulatori A si B. Pot fi • 32 acumulatori R0-R31
concatenati pentru a forma un • R26-R27, R28-R29, R30-R31
registru dublu D can be concatenated to form the
• Doua registre index X si Y X, Y, Z , registers
• Stack pointer • Stack pointer SP
• Registrul de stare CPU denumit • registrul de stare CPU denumit
CCR SREG
• Numaratorul de program PC • Numaratorul de program
Interfetele periferice
• Any peripheral
interface contains
one or more
control and status
registers, and one
or more data
registers
• These registers are,
normally, located
in the address
space of the data
memory, and are
accessed as RAM
locations
Interfete periferice uzuale
Definitie:
• An interrupt is a mechanism that allows an
external event to temporarily put on hold the
normal execution of the program, forcing the
execution of a specific subroutine. Once the
interrupt service subroutine completes, the main
program continues from the point where it was
interrupted.
Procesul de tratare a unei intreruperi
• The next step is the execution of the interrupt service routine (ISR).
This is a program sequence similar to a subroutine, but ended with a
special instruction called Return from Interrupt (RTI, RETI).
• Observatie importanta: STAREA masinii trebuie salvata prin soft
inainte de executia rutinei de intrerupere si restaurata dupa executia
rutinei de intrerupere.
• The final step in handling an interrupt is the actual return to the main
program. This is done by executing a RTI (RETI) instruction as
mentioned before. When this instruction is encountered, the contents of
PC, saved in step 2, is retrieved from stack and restored, which is
equivalent to a jump to the point where the program was interrupted.
Intreruperi - note importante
The stack is essential for the interrupt system. Both the PC and the
CPU status are saved in the stack when handling interrupts.
Therefore, the SP must be initialized by software before enabling
the interrupts.
The interrupt service routine must save the CPU status and restore
it before returning to the main program.
If two or more interrupt requests occur simultaneously, they are
serviced in a predetermined, order according to a hardwired
priority
Controlul asupra intreruperilor
.......
.ORG $000C
RJMP ANA_COMP ;unconditional jump to the
;interrupt handler
.......
ANA_COMP:
.......
RETI