next up previous
Next: Microprocessador numa pastilha Up: ISPS - Instruction Set Previous: Ciclo de interpretação de

Divisão em seções

Em ISPS, as descrições são divididas em várias seções da forma:

** Seção 1 **

descrição

** Seção 2 **

descrição

O nosso exemplo do minicomputador simples fica então:


mini:=
    Begin
    
    ** Memory.State **

    Mp\Primary.Memory[0:255]<0:11>


    ** Processor.State **

    Acc\Accumulator<0:11>,
    PC\Program.Counter<0:7>,
    Interrupt.Enable<>,
    Interrupt.Request<>


    ** Instruction.Format **

    IR\Instruction.Register<0:11>,
        Op\Operation.Code<0:2>:=IR<0:2>,
        Ibit\Indirect.Bit<>:=IR<3>,
        Adr\Address<0:7>:=IR<4:11>


    ** Effective.Address.Calculation **

    Z\Effective.Address<0:7>:=
        Begin
        Decode Ibit =>
            Begin
            0:= Z<-Adr,
            1:= Z<-Mp[Adr]
            End
        End


    ** Instruction.Interpretation **
    IExec\Instruction.Execution:=
      Begin
      Decode Op =>
          Begin
          0\AND:= Acc <- Acc And Mp[Z()],
          1\TAD:= Acc <- Acc + Mp[Z()],  !Two's complement add
          2\ISZ:=             !Increment and skip if zero
              Begin
              Mp[Z] <- Mp[Z()] + 1 Next
              If Mp[Z] Eql 0 => PC <- PC+1
              End,
          3\DCA:= Mp[Z()]@Acc <- Acc@#0000,  !Deposit and clear Acc
          4\HLT:= Stop(),                    !Halt
          5\JMP:= PC <- Z(),                 !Jump
          6\IOF:= Interrupt.Enable <- 0,     !Interrupt OFF
          7\ION:=                            !Interrupt ON
              Begin
              Interrupt.Enable <- 1 Next
              Restart ICycle
              End
          End
      End


    ICycle\Interpretation.Cycle:=
        Begin
        Repeat
            Begin
            IR <- Mp[PC] Next
            PC <- PC + 1 Next
            IExec() Next
            If Interrupt.Enable And Interrupt.Request =>
                Begin
                Mp[0] <- PC Next
                PC <- 1
                End
            End
        End

    End



Siang Wun Song
2001-09-19