Skip to content

Latest commit

 

History

History

FPC_CPU

Demo that visualize the execution of assembler code in a CPU (using a 4 stage pipeline). This also means, if no pipelining is used each command needs 4 clock ticks.

The demo code is "more" or less this in FreePascal:

Function sumArray(aLength: integer; pElement: PInteger): integer;
Begin
  result := 0;
  While aLength > 0 Do Begin
    result := result + pElement^;
    dec(aLength);
    inc(pElement);
  End;
End;

Var
  a: Array Of Integer;
  mem119: integer;
Begin
  setlength(a, 3);
  a[0] := 1;
  a[1] := 2;
  a[2] := 3;

  mem119 := sumArray(3, @a[0]);
End;

See the Manual for more. If you need inspiration of what to implement with the CPU maybe you take a look here.

Features:

  • Execution of assembler code (step by step or automatic mode)
  • Optional pipelining
  • Breakpoints
  • Memory
  • Stack
  • Function calls

Dependencies:

  • none