This commit is contained in:
Benjamin Rosseaux 2025-01-18 11:55:39 +01:00
commit bb818157e7
25 changed files with 32827 additions and 2 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
*.bin filter=lfs diff=lfs merge=lfs -text
*.dtb filter=lfs diff=lfs merge=lfs -text

71
.gitignore vendored Normal file
View file

@ -0,0 +1,71 @@
# ---> Delphi
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
#*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#
# Delphi compiler-generated binaries (safe to delete)
*.exe
*.dll
*.bpl
*.bpi
*.dcp
*.so
*.apk
*.drc
*.map
*.dres
*.rsm
*.tds
*.dcu
*.lib
*.a
*.o
*.ocx
# Delphi autogenerated files (duplicated info)
*.cfg
*.hpp
*Resource.rc
# Delphi local files (user-specific info)
*.local
*.identcache
*.projdata
*.tvsconfig
*.dsk
# Delphi history and backups
__history/
__recovery/
*.~*
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat
# Boss dependency manager vendor folder https://github.com/HashLoad/boss
modules/

12
.gitmodules vendored Normal file
View file

@ -0,0 +1,12 @@
[submodule "externals/pasriscv_software"]
path = externals/pasriscv_software
url = https://github.com/BeRo1985/pasriscv_software.git
[submodule "externals/rnl"]
path = externals/rnl
url = https://github.com/BeRo1985/rnl.git
[submodule "externals/pasmp"]
path = externals/pasmp
url = https://github.com/BeRo1985/pasmp.git
[submodule "externals/pasterm"]
path = externals/pasterm
url = https://github.com/BeRo1985/pasterm.git

20
LICENSE Normal file
View file

@ -0,0 +1,20 @@
zlib license
Copyright (C) 2024-2025, Benjamin Rosseaux (benjamin@rosseaux.de)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View file

@ -1,2 +1,58 @@
# pasriscv
PasRISCV is a RV64GC RISC-V emulator, which is implemented in Object Pascal
# PasRISCV
A RISC-V RV64GC emulator written in Object Pascal. It simulates processor cores, memory, I/O, and much more.
## Features
- RV64GC instruction set support with these ISA extensions:
- M (Integer Multiplication and Division)
- A (Atomic Operations)
- F (Single-Precision Floating-Point)
- D (Double-Precision Floating-Point)
- C (Compressed Instructions)
- Zicsr (Control and Status Register)
- Zifencei (Instruction-Fetch Fence)
- Zicond (Conditional stuff)
- Zkr (Entropy source)
- Zicboz (Cache-Block Zero Instructions)
- Zicbom (Cache-Block Management Instructions)
- Svadu (Hardware Updating of PTE A/D Bits)
- Sstc (RISC-V "stimecmp / vstimecmp" Extension)
- Snapot (“NAPOT Translation Continuity)
- Zbb/Zcb/Zbs/Zba (Bit Manipulations)
- Zacas (Atomic Compare-And-Swap)
- Multi-core SMP support
- Emulated peripherals
- ACLINT
- PLIC
- UART NS16550A
- SysCon
- VirtIO MMIO with following devices support
- Block
- Network
- Random/Entropy
- 9P filesystem
- Keyboard
- Mouse
- Sound
- Framebuffer support
- PS/2 keyboard and mouse
- Raw keyboard input with scancode bit-array (for more direct input per polling)
- DS1742 real-time clock (read-only, no write support)
- PCI Bus
- NVMe
- I2C bus (disabled for now, due to IRQ issues, will be either fixed, removed, or replaced with virtio-i2c later)
- HID devices
- Keyboard
## Usage
See `riscvemu` PasVulkan project for an emulator that uses this library.
## Documentation
See the `docs` directory for more information.
## License
This project is released under zlib license.

0
bin/dummy.txt Normal file
View file

6
build Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
CWD=$(pwd)
./gitforceupdate
cd ./src
./buildonserver.sh
cd "$CWD"

92
docs/documentation.md Normal file
View file

@ -0,0 +1,92 @@
# Base devices
These following devices are the base devices that are almost always present in a RISC-V system. They are the minimum set of devices that are
required to boot a RISC-V system.
| What | Where | Size | IRQ(s) | Description |
|-----------------------|-----------|-----------|---------------------------|---------------------------------------------|
| DS1742 | $00101000 | $8 | | Real-time clock |
| ACLINT | $02000000 | $10000 | | Core Local Interruptor |
| PLIC | $0c000000 | $208000 | | Platform Level Interrupt Controller |
| UART | $10000000 | $100 | $0a | Universal Asynchronous Receiver/Transmitter |
| SYSCON | $11100000 | $1000 | | System Controller (Reset, Power off, etc.) |
# HID devices
These devices are the Human Interface Devices (HID) that are used to interact with the system.
| What | Where | Size | IRQ(s) | Description |
|-----------------------|-----------|-----------|---------------------------|---------------------------------------------|
| RAW KEYBOARD | $10008000 | $1000 | | Raw keyboard input with scancode bit-array |
| PS/2 KEYBOARD | $10010000 | $8 | $05 | PS/2 keyboard input |
| PS/2 MOUSE | $10011000 | $8 | $06 | PS/2 mouse input |
Once the operating system initializes the VirtIO HID devices, the PS/2 HID devices are no longer fed with input data to avoid duplicating input events.
The raw keyboard device is a simple device that provides a bit array of scancodes. It can be used in conjunction with games specially tweaked for the emulator or other applications that work better with raw scan codes.
# I2C devices
These devices are the Inter-Integrated Circuit (I2C) devices that are used to connect to the system.
| What | Where | Size | IRQ(s) | Description |
|-----------------------|-----------|-----------|---------------------------|---------------------------------------------|
| I2C | $10020000 | $14 | $0d | I2C controller |
# VirtIO devices
These devices are the VirtIO devices that are used to connect to the system. They are partly required for the system to boot, but not all of them
are required. The VirtIO devices are used to provide a standard interface for devices for virtual machines.
| What | Where | Size | IRQ(s) | Description |
|-----------------------|-----------|-----------|---------------------------|---------------------------------------------|
| VIRTIO BLOCK | $10050000 | $1000 | $10 | VirtIO block device |
| VIRTIO INPUT KEYBOARD | $10051000 | $1000 | $11 | VirtIO keyboard input |
| VIRTIO INPUT MOUSE | $10052000 | $1000 | $12 | VirtIO mouse input |
| VIRTIO INPUT TOUCH | $10053000 | $1000 | $13 | VirtIO touch input (planned) |
| VIRTIO SOUND | $10054000 | $1000 | $14 | VirtIO sound device |
| VIRTIO 9P | $10055000 | $1000 | $15 | VirtIO 9P device |
| VIRTIO NET | $10056000 | $1000 | $16 | VirtIO network device |
| VIRTIO RNG | $10057000 | $1000 | $17 | VirtIO random number generator |
| VIRTIO GPU | $10058000 | $1000 | $18 | VirtIO GPU device (planned) |
For each VirtIO device, the MMIO region size is $1000. For the VirtIO GPU device, the guest OS allocates its own frame buffer memory ranges, so $1000 as MMIO region size remains valid for the device registers in this case.
# PCIe devices
These devices are the Peripheral Component Interconnect Express (PCIe) devices that are used to connect to the system.
| What | Where | Size | IRQ(s) | Description |
|-----------------------|-----------|-----------|---------------------------|---------------------------------------------|
| PCIe controller base | $30000000 | $10000000 | $01 - $04 (cross-wired) | PCIe controller base MMIO |
| PCIe I/O | $03000000 | $00010000 | | PCIe I/O |
| PCIe BAR memory range | $40000000 | $40000000 | | PCIe BAR memory range |
# PCIe bus devices
These devices are the PCIe bus devices that are used to connect to the system.
| Bus | Device | Function | Class ID | Vendor ID | Device ID | Description |
|------|--------|----------|----------|-----------|-----------|-------------------------------------------------------------|
| $00 | $00 | $00 | $0600 | $f15e | $0000 | PCIe controller (host bridge) |
| $00 | $01 | $00 | $0108 | $1aad | $a809 | Non-Volatile Memory Controller (NVMe) / NVMe SSD controller |
# Boot Trampoline and Device Tree Blob Memory
The memory region for the boot trampoline and the Device Tree Blob (DTB) is a dedicated 64KiB segment starting at $00000000. This memory serves two primary purposes:
1. **Boot Trampoline Code**: The boot trampoline code initializes essential CPU components, including CPU registers and the stack pointer. After initialization, it transfers control to the firmware's entry point. In the future, this code will be removed, and the CPU emulation will directly handle the initialization of registers and the stack pointer. This change is crucial for multi-core support, as executing the same trampoline code on all cores is undesirable.
2. **Device Tree Blob (DTB)**: The DTB provides a structured description of the system's hardware configuration to the operating system. It is passed to the operating system by the firmware and includes details such as CPU cores, memory, and device mappings.
# System Memory
The system memory begins at $80000000 and its size is dynamically determined based on the system configuration. It is the primary memory space and serves multiple purposes:
- **Operating System**: The system memory stores the kernel, essential services, and system libraries required for operation.
- **Applications and Data**: User applications, processes, and associated data are loaded and managed here.
- **Firmware and DTB**: The firmware and a copy of the Device Tree Blob are also stored in system memory, ensuring accessibility during boot and runtime.
This dynamic memory allocation ensures flexibility and scalability, adapting to the needs of different system configurations.

1
externals/pasmp vendored Submodule

@ -0,0 +1 @@
Subproject commit d6fb6844aa8e83f93bc0616ac57ad041580666d9

1
externals/pasriscv_software vendored Submodule

@ -0,0 +1 @@
Subproject commit 405dcfd59252e4e685b9caa6e0a95b8f5c817a6f

1
externals/pasterm vendored Submodule

@ -0,0 +1 @@
Subproject commit 162a1c108e45b52d869212ff47033d06dcc47692

1
externals/rnl vendored Submodule

@ -0,0 +1 @@
Subproject commit 7cf1f65b6e390139860a0ca97214cefcccefc949

3
gitcommitpush Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
git commit -am "-"
git push

3
gitcommitpush.bat Normal file
View file

@ -0,0 +1,3 @@
@echo off
call git commit -am "-"
call git push --set-upstream origin master

4
gitforceupdate Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
git stash save
git pull
git stash drop

4
gitforceupdate.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
call git stash save
call git pull
call git stash drop

2
initsubmodules Executable file
View file

@ -0,0 +1,2 @@
#/bin/sh
git submodule update --init --recursive

2
initsubmodules.bat Normal file
View file

@ -0,0 +1,2 @@
@echo off
git submodule update --init --recursive

31711
src/PasRISCV.pas Normal file

File diff suppressed because it is too large Load diff

467
src/PasRISCVTest.dpr Normal file
View file

@ -0,0 +1,467 @@
// This file is part of the PasRISCV project, a RISC-V emulator written in Object Pascal.
// PasRISCVTest executes the riscv-tests suite and checks the results for correctness.
// It includes a quick&dirty HTIF implementation for handling HTIF communication with the test binaries.
program PasRISCVTest;
{$ifdef fpc}
{$mode delphi}
{$else}
{$ifdef conditionalexpressions}
{$if CompilerVersion>=24.0}
{$legacyifend on}
{$ifend}
{$endif}
{$endif}
{$if defined(Win32) or defined(Win64)}
{$define Windows}
{$ifend}
{$if defined(Windows) or defined(Win32) or defined(Win64)}
{$apptype console}
{$ifend}
{$scopedenums on}
uses {$ifdef Unix}cthreads,{$endif}
{$if defined(Windows) and not defined(fpc)}
Windows,
{$ifend}
SysUtils,Classes,Math,PasRISCV;
var Machine:TPasRISCV;
const HTIF_DEV_SHIFT=56;
HTIF_CMD_SHIFT=48;
HTIF_DEV_SYSTEM=0;
HTIF_DEV_CONSOLE=1;
HTIF_SYSTEM_CMD_SYSCALL=0;
HTIF_CONSOLE_CMD_GETCHAR=0;
HTIF_CONSOLE_CMD_PUTCHAR=1;
PK_SYS_WRITE=64;
var VModeTest:Boolean=false;
// HTIF offsets
HTIFToHostOffset:TPasRISCVUInt64;
HTIFFromHostOffset:TPasRISCVUInt64;
HTIFExitCode:TPasRISCVInt64;
TestErrorCode:TPasRISCVInt64;
PassCode:TPasRISCVUInt64;
type { TMachineInstance }
TMachineInstance=class
public
procedure Boot;
procedure OnReboot;
function OnCPUException(const aCPUCore:TPasRISCV.TCPUCore;const aExceptionValue:TPasRISCV.TCPUCore.TExceptionValue;const aExceptionData:TPasRISCVUInt64;const aExceptionPC:TPasRISCVUInt64):Boolean;
end;
{ TReboot }
procedure TMachineInstance.Boot;
begin
Machine.Reset;
if FileExists('disk.img') then begin
Machine.VirtIOBlockDevice.LoadFromFile('disk.img');
end;
end;
procedure TMachineInstance.OnReboot;
begin
Boot;
end;
function TMachineInstance.OnCPUException(const aCPUCore:TPasRISCV.TCPUCore;const aExceptionValue:TPasRISCV.TCPUCore.TExceptionValue;const aExceptionData:TPasRISCVUInt64;const aExceptionPC:TPasRISCVUInt64):Boolean;
begin
case aExceptionValue of
TPasRISCV.TCPUCore.TExceptionValue.ECallUMode,
TPasRISCV.TCPUCore.TExceptionValue.ECallSMode,
TPasRISCV.TCPUCore.TExceptionValue.ECallHMode,
TPasRISCV.TCPUCore.TExceptionValue.ECallMMode:begin
if Machine.CPUCore.State^.Registers[TPasRISCV.TCPUCore.TRegister.A7]=93 then begin // Exit syscall
TestErrorCode:=Machine.CPUCore.State^.Registers[TPasRISCV.TCPUCore.TRegister.A0];
result:=true;
end else begin
result:=false;
end;
end;
else begin
result:=false;
end;
end;
end;
procedure Run;
var Configuration:TPasRISCV.TConfiguration;
MachineInstance:TMachineInstance;
{$if defined(Windows) and not defined(fpc)}
ConsoleInputHandle:Windows.THandle;
ConsoleOutputHandle:Windows.THandle;
OldConsoleModeIn:DWORD;
OldConsoleModeOut:DWORD;
{$ifend}
begin
{$if defined(Windows) and not defined(fpc)}
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
ConsoleInputHandle:=GetStdHandle(STD_INPUT_HANDLE);
ConsoleOutputHandle:=GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleMode(ConsoleInputHandle,OldConsoleModeIn);
SetConsoleMode(ConsoleInputHandle,(ENABLE_VIRTUAL_TERMINAL_INPUT or
ENABLE_WINDOW_INPUT or
ENABLE_MOUSE_INPUT) and not
(//ENABLE_PROCESSED_INPUT or
ENABLE_WRAP_AT_EOL_OUTPUT));
GetConsoleMode(ConsoleOutputHandle,OldConsoleModeOut);
SetConsoleMode(ConsoleOutputHandle,OldConsoleModeOut or (ENABLE_PROCESSED_OUTPUT or
ENABLE_VIRTUAL_TERMINAL_PROCESSING));
{$ifend}
Configuration:=TPasRISCV.TConfiguration.Create;
try
Configuration.LoadBIOSFromFile(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'bios.bin');
Configuration.LoadKernelFromFile(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'kernel.bin');
MachineInstance:=TMachineInstance.Create;
try
Machine:=TPasRISCV.Create(Configuration);
try
Machine.OnReboot:=MachineInstance.OnReboot;
MachineInstance.Boot;
Machine.Run;
finally
FreeAndNil(Machine);
end;
finally
FreeAndNil(MachineInstance);
end;
finally
FreeAndNil(Configuration);
end;
{$if defined(Windows) and not defined(fpc)}
SetConsoleMode(ConsoleInputHandle,OldConsoleModeIn);
SetConsoleMode(ConsoleOutputHandle,OldConsoleModeOut);
{$ifend}
end;
procedure GetAllBinaryFiles(const aPath:string;const aStringList:TStringList);
var SearchRec:TSearchRec;
begin
if FindFirst(aPath+'*.bin',faAnyFile,SearchRec)=0 then begin
try
repeat
if (SearchRec.Attr and faDirectory)=0 then begin
aStringList.Add(aPath+SearchRec.Name);
end;
until FindNext(SearchRec)<>0;
finally
FindClose(SearchRec);
end;
end;
if FindFirst(aPath+'*.elf',faAnyFile,SearchRec)=0 then begin
try
repeat
if (SearchRec.Attr and faDirectory)=0 then begin
aStringList.Add(aPath+SearchRec.Name);
end;
until FindNext(SearchRec)<>0;
finally
FindClose(SearchRec);
end;
end;
if FindFirst(aPath+{$ifdef Unix}'*'{$else}'*.*'{$endif},faDirectory,SearchRec)=0 then begin
try
repeat
if (SearchRec.Attr and faDirectory)<>0 then begin
if (SearchRec.Name<>'.') and (SearchRec.Name<>'..') then begin
GetAllBinaryFiles(IncludeTrailingPathDelimiter(aPath+SearchRec.Name),aStringList);
end;
end;
until FindNext(SearchRec)<>0;
finally
FindClose(SearchRec);
end;
end;
end;
// Set HTIF offsets based on filename, as some tests use different offsets
procedure SetHTIFHostOffsetsFromFileName(const aFileName:string);
var FileNameWithoutPathAndExtension:string;
begin
FileNameWithoutPathAndExtension:=LowerCase(ChangeFileExt(ExtractFileName(aFileName),''));
// Determine HTIF offsets based on filename, as some tests use different offsets
if pos('rv64uc-p-rvc',FileNameWithoutPathAndExtension)>0 then begin
HTIFToHostOffset:=$3000;
HTIFFromHostOffset:=$3040;
end else if (pos('rv64ud-p-move',FileNameWithoutPathAndExtension)>0) or
(pos('rv64ui-p-ma_data',FileNameWithoutPathAndExtension)>0) then begin
HTIFToHostOffset:=$2000;
HTIFFromHostOffset:=$2040;
end else begin
HTIFToHostOffset:=$1000;
HTIFFromHostOffset:=$1040;
end;
// Reset HTIF
HTIFExitCode:=-1;
end;
// Handle HTIF communication as quick&dirty hack per memory-device instead of a proper device, since the tests are running instruction step-wise anyway,
// so we can just check the memory for HTIF communication after each instruction step and handle it here.
procedure HandleHTIF;
var ToHostValue:TPasRISCVUInt64;
Device:TPasRISCVUInt64;
Cmd:TPasRISCVUInt64;
Payload:TPasRISCVUInt64;
Response:TPasRISCVUInt64;
SysCall:array[0..7] of TPasRISCVUInt64;
begin
// Read HTIF values from memory
ToHostValue:=PPasRISCVUInt64(Pointer(@PPasRISCVUInt8Array(Machine.MemoryDevice.Data)^[HTIFToHostOffset]))^;
// Handle ToHost value
if ToHostValue<>0 then begin
Device:=(ToHostValue shr HTIF_DEV_SHIFT) and $ff;
Cmd:=(ToHostValue shr HTIF_CMD_SHIFT) and $ff;
Payload:=ToHostValue and TPasRISCVUInt64($fffffffffff);
Response:=0;
// Currently, there is a fixed mapping of devices:
// 0: System for riscv-tests
// 1: Console
// Handle HTIF communication
case Device of
HTIF_DEV_SYSTEM:begin
case Cmd of
HTIF_SYSTEM_CMD_SYSCALL:begin
if (Payload and 1)<>0 then begin
HTIFExitCode:=Payload shr 1;
TestErrorCode:=Machine.CPUCore.State^.Registers[TPasRISCV.TCPUCore.TRegister.A0];
end else begin
SysCall[0]:=Machine.Bus.Load(nil,Payload+(0*SizeOf(TPasRISCVUInt64)),8);
SysCall[1]:=Machine.Bus.Load(nil,Payload+(1*SizeOf(TPasRISCVUInt64)),8);
SysCall[2]:=Machine.Bus.Load(nil,Payload+(2*SizeOf(TPasRISCVUInt64)),8);
SysCall[3]:=Machine.Bus.Load(nil,Payload+(3*SizeOf(TPasRISCVUInt64)),8);
SysCall[4]:=Machine.Bus.Load(nil,Payload+(4*SizeOf(TPasRISCVUInt64)),8);
SysCall[5]:=Machine.Bus.Load(nil,Payload+(5*SizeOf(TPasRISCVUInt64)),8);
SysCall[6]:=Machine.Bus.Load(nil,Payload+(6*SizeOf(TPasRISCVUInt64)),8);
SysCall[7]:=Machine.Bus.Load(nil,Payload+(7*SizeOf(TPasRISCVUInt64)),8);
if (SysCall[0]=PK_SYS_WRITE) and (SysCall[1]=HTIF_DEV_CONSOLE) and (SysCall[3]=HTIF_CONSOLE_CMD_PUTCHAR) then begin
// Write character to console
Write(AnsiChar(TPasRISCVUInt8(SysCall[2] and $ff)));
Response:=$100 or (Payload and $ff);
end;
end;
end;
end;
end;
HTIF_DEV_CONSOLE:begin
case Cmd of
HTIF_CONSOLE_CMD_GETCHAR:begin
// Get character from console
Response:=0;//TPasRISCVUInt64(Ord(ReadKey));
end;
HTIF_CONSOLE_CMD_PUTCHAR:begin
// Write character to console
Write(AnsiChar(Payload and $ff));
Response:=$100 or (Payload and $ff);
end;
end;
end;
end;
// Reset ToHost value in memory for indicating that the value has been read
PPasRISCVUInt64(Pointer(@PPasRISCVUInt8Array(Machine.MemoryDevice.Data)^[HTIFToHostOffset]))^:=0;
// Write FromHost value to memory
PPasRISCVUInt64(Pointer(@PPasRISCVUInt8Array(Machine.MemoryDevice.Data)^[HTIFFromHostOffset]))^:=((ToHostValue shr 48) shl 48) or ((Response shl 16) shr 16);
end;
end;
function RunTest(const aFileName:string):Boolean;
var FileNameWithoutPathAndExtension:string;
Size:TPasRISCVUInt64;
FailedOnException:Boolean;
MemoryStream:TMemoryStream;
MachineInstance:TMachineInstance;
begin
result:=false;
FileNameWithoutPathAndExtension:=ChangeFileExt(ExtractFileName(aFileName),'');
TestErrorCode:=-1; // Reset error code for each test
VModeTest:=pos('-v-',LowerCase(FileNameWithoutPathAndExtension))>0;
// Determine fail/pass code based on filename, as some tests expect different results
if VModeTest then begin
PassCode:=1;
end else begin
PassCode:=0;
end;
Write('Running test "',aFileName,'" ... ');
MachineInstance:=TMachineInstance.Create;
try
Machine.OnCPUException:=MachineInstance.OnCPUException;
Machine.Reset;
FillChar(Machine.MemoryDevice.Data^,Machine.MemoryDevice.Size,#0);
MemoryStream:=TMemoryStream.Create;
try
MemoryStream.LoadFromFile(aFileName);
MemoryStream.Seek(0,soBeginning);
Machine.LoadBinaryIntoMemory(MemoryStream,0,Size,true,true);
finally
FreeAndNil(MemoryStream);
end;
//Machine.MemoryDevice.LoadFromFile(aFileName);
SetHTIFHostOffsetsFromFileName(aFileName);
FailedOnException:=false;
repeat
// WriteLn('PC=',LowerCase(IntToHex(Machine.CPUCore.State^.PC,16)));
{ if Machine.CPUCore.State^.PC=TPasRISCVUInt64($FFFFFFFFFFE022C8) then begin
Sleep(0);
end;//}
{ if Machine.CPUCore.State^.PC=TPasRISCVUInt64($0000000000002AA4) then begin
Sleep(0);
end;//}
{ if Machine.CPUCore.State^.PC=TPasRISCVUInt64($0000000000002f1c) then begin
Sleep(0);
end;//}
// Sleep(20);
Machine.Step;
HandleHTIF;
if TestErrorCode>=0 then begin
break;
end;
if not VModeTest then begin
if (Machine.CPUCore.State^.ExceptionValue<>TPasRISCV.TCPUCore.TExceptionValue.None) and
(Machine.CPUCore.State^.CSR.Load(TPasRISCV.TCPUCore.TCSR.TAddress.MTVEC)=0) and
(Machine.CPUCore.State^.CSR.Load(TPasRISCV.TCPUCore.TCSR.TAddress.STVEC)=0) then begin
FailedOnException:=true;
break;
end else begin
Machine.CPUCore.ClearException;
end;
end;
until false;
if TestErrorCode=PassCode then begin
WriteLn('OK!');
result:=true;
end else begin
WriteLn('FAILED!');
if FailedOnException then begin
WriteLn('Failed on exception');
end else begin
WriteLn('Failed otherwise');
end;
WriteLn('PC=',IntToHex(Machine.CPUCore.State^.PC,16));
WriteLn('HTIFErrorCode=',IntToHex(TestErrorCode,16));
WriteLn;
end;
finally
FreeAndNil(MachineInstance);
end;
end;
procedure RunTests;
var StringList:TStringList;
Index:TPasRISCVInt32;
begin
Machine:=TPasRISCV.Create;
try
StringList:=TStringList.Create;
try
GetAllBinaryFiles(IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0)))+'../externals/pasriscv_software/riscv-tests/binaries/elf/'),StringList);
// RunTest('/home/bero/Projects/GitHub/pasriscv/externals/pasriscv_software/riscv-tests/binaries/elf/rv64mi-p-illegal.elf');
for Index:=0 to StringList.Count-1 do begin
if false or
//(pos('f',ChangeFileExt(ExtractFileName(StringList[Index]),''))=1) or
//(ChangeFileExt(ExtractFileName(StringList[Index]),'')='dirty') or
//(ChangeFileExt(ExtractFileName(StringList[Index]),'')='illegal') or
false then begin
continue;
end;
if not RunTest(StringList[Index]) then begin
Sleep(0);
end;
end;
finally
FreeAndNil(StringList);
end;
finally
FreeAndNil(Machine);
end;
{$ifndef fpc}
readln;
{$endif}
end;
begin
SetExceptionMask([exInvalidOp,exDenormalized,exZeroDivide,exOverflow,exUnderflow,exPrecision]);
RunTests;
//Run;
end.

246
src/PasRISCVTest.dproj Normal file
View file

@ -0,0 +1,246 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{A32B5298-ACA3-4DEB-A6B7-A85631EA5F13}</ProjectGuid>
<MainSource>PasRISCVTest.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>693379</TargetedPlatforms>
<AppType>Console</AppType>
<FrameworkType>None</FrameworkType>
<ProjectVersion>19.5</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android64' and '$(Base)'=='true') or '$(Base_Android64)'!=''">
<Base_Android64>true</Base_Android64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
<Base_iOSDevice32>true</Base_iOSDevice32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
<Base_iOSDevice64>true</Base_iOSDevice64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
<Base_iOSSimulator>true</Base_iOSSimulator>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Android64)'!=''">
<Cfg_2_Android64>true</Cfg_2_Android64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice64)'!=''">
<Cfg_2_iOSDevice64>true</Cfg_2_iOSDevice64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSX64' and '$(Cfg_2)'=='true') or '$(Cfg_2_OSX64)'!=''">
<Cfg_2_OSX64>true</Cfg_2_OSX64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSXARM64' and '$(Cfg_2)'=='true') or '$(Cfg_2_OSXARM64)'!=''">
<Cfg_2_OSXARM64>true</Cfg_2_OSXARM64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<SanitizedProjectName>PasRISCVTest</SanitizedProjectName>
<VerInfo_Locale>1031</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
<DCC_ExeOutput>../bin</DCC_ExeOutput>
<DCC_Define>PasRISCVUseRealConsole;$(DCC_Define)</DCC_Define>
<DCC_UnitSearchPath>.\..\externals\pasmp\src;.\..\externals\rnl\src;.\..\externals\pasterm\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
<AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
<AUP_CALL_PHONE>true</AUP_CALL_PHONE>
<AUP_CAMERA>true</AUP_CAMERA>
<AUP_INTERNET>true</AUP_INTERNET>
<AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<Android_NotificationIcon24>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png</Android_NotificationIcon24>
<Android_NotificationIcon36>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png</Android_NotificationIcon36>
<Android_NotificationIcon48>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png</Android_NotificationIcon48>
<Android_NotificationIcon72>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png</Android_NotificationIcon72>
<Android_NotificationIcon96>$(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png</Android_NotificationIcon96>
<Android_LauncherIcon192>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png</Android_LauncherIcon192>
<EnabledSysJars>annotation-1.2.0.dex.jar;asynclayoutinflater-1.0.0.dex.jar;billing-4.0.0.dex.jar;browser-1.0.0.dex.jar;cloud-messaging.dex.jar;collection-1.0.0.dex.jar;coordinatorlayout-1.0.0.dex.jar;core-1.5.0-rc02.dex.jar;core-common-2.0.1.dex.jar;core-runtime-2.0.1.dex.jar;cursoradapter-1.0.0.dex.jar;customview-1.0.0.dex.jar;documentfile-1.0.0.dex.jar;drawerlayout-1.0.0.dex.jar;firebase-annotations-16.0.0.dex.jar;firebase-common-20.0.0.dex.jar;firebase-components-17.0.0.dex.jar;firebase-datatransport-18.0.0.dex.jar;firebase-encoders-17.0.0.dex.jar;firebase-encoders-json-18.0.0.dex.jar;firebase-iid-interop-17.1.0.dex.jar;firebase-installations-17.0.0.dex.jar;firebase-installations-interop-17.0.0.dex.jar;firebase-measurement-connector-19.0.0.dex.jar;firebase-messaging-22.0.0.dex.jar;fmx.dex.jar;fragment-1.0.0.dex.jar;google-play-licensing.dex.jar;interpolator-1.0.0.dex.jar;javax.inject-1.dex.jar;legacy-support-core-ui-1.0.0.dex.jar;legacy-support-core-utils-1.0.0.dex.jar;lifecycle-common-2.0.0.dex.jar;lifecycle-livedata-2.0.0.dex.jar;lifecycle-livedata-core-2.0.0.dex.jar;lifecycle-runtime-2.0.0.dex.jar;lifecycle-service-2.0.0.dex.jar;lifecycle-viewmodel-2.0.0.dex.jar;listenablefuture-1.0.dex.jar;loader-1.0.0.dex.jar;localbroadcastmanager-1.0.0.dex.jar;play-services-ads-20.1.0.dex.jar;play-services-ads-base-20.1.0.dex.jar;play-services-ads-identifier-17.0.0.dex.jar;play-services-ads-lite-20.1.0.dex.jar;play-services-base-17.5.0.dex.jar;play-services-basement-17.6.0.dex.jar;play-services-cloud-messaging-16.0.0.dex.jar;play-services-drive-17.0.0.dex.jar;play-services-games-21.0.0.dex.jar;play-services-location-18.0.0.dex.jar;play-services-maps-17.0.1.dex.jar;play-services-measurement-base-18.0.0.dex.jar;play-services-measurement-sdk-api-18.0.0.dex.jar;play-services-places-placereport-17.0.0.dex.jar;play-services-stats-17.0.0.dex.jar;play-services-tasks-17.2.0.dex.jar;print-1.0.0.dex.jar;room-common-2.1.0.dex.jar;room-runtime-2.1.0.dex.jar;slidingpanelayout-1.0.0.dex.jar;sqlite-2.0.1.dex.jar;sqlite-framework-2.0.1.dex.jar;swiperefreshlayout-1.0.0.dex.jar;transport-api-3.0.0.dex.jar;transport-backend-cct-3.0.0.dex.jar;transport-runtime-3.0.0.dex.jar;user-messaging-platform-1.0.0.dex.jar;versionedparcelable-1.1.1.dex.jar;viewpager-1.0.0.dex.jar;work-runtime-2.1.0.dex.jar</EnabledSysJars>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android64)'!=''">
<Android_LauncherIcon192>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_192x192.png</Android_LauncherIcon192>
<EnabledSysJars>annotation-1.2.0.dex.jar;asynclayoutinflater-1.0.0.dex.jar;billing-4.0.0.dex.jar;browser-1.0.0.dex.jar;cloud-messaging.dex.jar;collection-1.0.0.dex.jar;coordinatorlayout-1.0.0.dex.jar;core-1.5.0-rc02.dex.jar;core-common-2.0.1.dex.jar;core-runtime-2.0.1.dex.jar;cursoradapter-1.0.0.dex.jar;customview-1.0.0.dex.jar;documentfile-1.0.0.dex.jar;drawerlayout-1.0.0.dex.jar;firebase-annotations-16.0.0.dex.jar;firebase-common-20.0.0.dex.jar;firebase-components-17.0.0.dex.jar;firebase-datatransport-18.0.0.dex.jar;firebase-encoders-17.0.0.dex.jar;firebase-encoders-json-18.0.0.dex.jar;firebase-iid-interop-17.1.0.dex.jar;firebase-installations-17.0.0.dex.jar;firebase-installations-interop-17.0.0.dex.jar;firebase-measurement-connector-19.0.0.dex.jar;firebase-messaging-22.0.0.dex.jar;fmx.dex.jar;fragment-1.0.0.dex.jar;google-play-licensing.dex.jar;interpolator-1.0.0.dex.jar;javax.inject-1.dex.jar;legacy-support-core-ui-1.0.0.dex.jar;legacy-support-core-utils-1.0.0.dex.jar;lifecycle-common-2.0.0.dex.jar;lifecycle-livedata-2.0.0.dex.jar;lifecycle-livedata-core-2.0.0.dex.jar;lifecycle-runtime-2.0.0.dex.jar;lifecycle-service-2.0.0.dex.jar;lifecycle-viewmodel-2.0.0.dex.jar;listenablefuture-1.0.dex.jar;loader-1.0.0.dex.jar;localbroadcastmanager-1.0.0.dex.jar;play-services-ads-20.1.0.dex.jar;play-services-ads-base-20.1.0.dex.jar;play-services-ads-identifier-17.0.0.dex.jar;play-services-ads-lite-20.1.0.dex.jar;play-services-base-17.5.0.dex.jar;play-services-basement-17.6.0.dex.jar;play-services-cloud-messaging-16.0.0.dex.jar;play-services-drive-17.0.0.dex.jar;play-services-games-21.0.0.dex.jar;play-services-location-18.0.0.dex.jar;play-services-maps-17.0.1.dex.jar;play-services-measurement-base-18.0.0.dex.jar;play-services-measurement-sdk-api-18.0.0.dex.jar;play-services-places-placereport-17.0.0.dex.jar;play-services-stats-17.0.0.dex.jar;play-services-tasks-17.2.0.dex.jar;print-1.0.0.dex.jar;room-common-2.1.0.dex.jar;room-runtime-2.1.0.dex.jar;slidingpanelayout-1.0.0.dex.jar;sqlite-2.0.1.dex.jar;sqlite-framework-2.0.1.dex.jar;swiperefreshlayout-1.0.0.dex.jar;transport-api-3.0.0.dex.jar;transport-backend-cct-3.0.0.dex.jar;transport-runtime-3.0.0.dex.jar;user-messaging-platform-1.0.0.dex.jar;versionedparcelable-1.1.1.dex.jar;viewpager-1.0.0.dex.jar;work-runtime-2.1.0.dex.jar</EnabledSysJars>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPhone_Notification40>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_40x40.png</iPhone_Notification40>
<iPhone_Notification60>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_60x60.png</iPhone_Notification60>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_Notification40>$(BDS)\bin\Artwork\iOS\iPad\FM_NotificationIcon_40x40.png</iPad_Notification40>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
<iOS_AppStore1024>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_1024x1024.png</iOS_AppStore1024>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPhone_Notification40>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_40x40.png</iPhone_Notification40>
<iPhone_Notification60>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_60x60.png</iPhone_Notification60>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_Notification40>$(BDS)\bin\Artwork\iOS\iPad\FM_NotificationIcon_40x40.png</iPad_Notification40>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>(None)</Manifest_File>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_RangeChecking>true</DCC_RangeChecking>
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Android64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSDevice64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_OSX64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_OSXARM64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">PasRISCVTest.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="Android64">True</Platform>
<Platform value="iOSDevice32">False</Platform>
<Platform value="iOSDevice64">True</Platform>
<Platform value="iOSSimARM64">True</Platform>
<Platform value="iOSSimulator">False</Platform>
<Platform value="Linux64">True</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="OSX64">True</Platform>
<Platform value="OSXARM64">True</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

74
src/PasRISCVTest.lpi Normal file
View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="PasRISCVTest"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<Units>
<Unit>
<Filename Value="PasRISCVTest.dpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="PasRISCV.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="$(ProjPath)/../bin/PasRISCVTest"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../externals/pasmp/src;../externals/rnl/src;../externals/pasterm/src"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
</Linking>
<Other>
<CustomOptions Value="-dDEBUG -dPasRISCVUseRealConsole"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

41
src/buildonserver.sh Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
#echo 1 > /home/bero/www/pasriscv/building.txt
CWD=$(pwd)
SWD="/home/bero/GitHub/pasriscv/src/"
cd "$SWD"
/home/bero/fpcupdeluxe/lazarus/lazbuild --primary-config-path=/home/bero/fpcupdeluxe/config_lazarus -B /home/bero/GitHub/pasriscv/src/PasRISCVTest.lpi || { echo 'Failed' ; cd "$CWD"; exit 1; }
patchelf --set-rpath "\$ORIGIN" /home/bero/GitHub/pasriscv/bin/PasRISCVTest
cd "$SWD"
#./builddeb.sh || { echo 'Failed' ; cd "$CWD"; exit 1; }
cd "$SWD"
#./buildtargz.sh || { echo 'Failed' ; cd "$CWD"; exit 1; }
cd "$SWD"
#./buildappimage.sh || { echo 'Failed' ; cd "$CWD"; exit 1; }
cd "$SWD"
#cp -f /home/bero/git/pasriscv/distribution/deb/pasriscv.deb /home/bero/www/pasriscv/pasriscv.deb
#cp -f /home/bero/git/pasriscv/distribution/targz/pasriscv.tar.gz /home/bero/www/pasriscv/pasriscv.tar.gz
#cp -f /home/bero/git/pasriscv/distribution/appimage/pasriscv-gtk2/pasriscv-gtk2-latest-x86_64.AppImage /home/bero/www/pasriscv/pasriscv-gtk2-latest-x86_64.AppImage
#cp -f /home/bero/git/pasriscv/distribution/appimage/pasriscv-qt5/pasriscv-qt5-latest-x86_64.AppImage /home/bero/www/pasriscv/pasriscv-qt5-latest-x86_64.AppImage
cd "$CWD"
echo 'Done!'
#echo 0 > /home/bero/www/pasriscv/building.txt

3
updatesubmodules Executable file
View file

@ -0,0 +1,3 @@
#/bin/sh
git submodule update --remote --recursive

2
updatesubmodules.bat Normal file
View file

@ -0,0 +1,2 @@
@echo off
git submodule update --remote --recursive