Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 97 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,7 @@
</picture>
</div>

<h4 align="center">HyperCPU - the <i>hyper</i> toolkit for custom <i>hyper</i> ISA</h4>

<p align="center">
<a href="#what-is-it">What is it?</a>
|
<a href="#roadmap">Roadmap</a>
|
<a href="#installation">Installation</a>
|
<a href="#usage">Usage</a>
|
<a href="#contributing">Contributing</a>
|
<a href="#authors">Authors</a>
|
<a href="#license">License</a>
</p>
<h4 align="center">The <i>hyper</i> toolkit for custom <i>hyper</i> ISA.</h4>

<p align="center">
<a href="https://github.com/HyperWinX/HyperCPU/issues">
Expand All @@ -41,106 +25,136 @@
</p>

>[!IMPORTANT]
> HyperCPU is almost ready for use! Wait for 1.0 release to try it out or build the project locally, test and report found issues.
> HyperCPU is almost ready for use! Wait for 1.0 release to try it out or build the project yourself, test and report found issues.

<img alt="HyperCPU screenshot" src="images/screenshot.png">

## What is it?
HyperCPU is a set of programs created to work with my own simple ISA (instruction set architecture). The project was created for fun, but it took a lot of time (and nerves) and I learned a lot while working on it.

HyperCPU is a set of programs, created to work with my own simple ISA (instruction set architecture). The project was created for fun, but it took a lot of time (and nerves), and I learned a lot while working on it.

HyperCPU toolkit includes:
HyperCPU project includes:
* **hCPU emulator**;
* **hASM assembler**;
* **hASM disassembler**.
* ~~**hASM disassembler**~~ (planned).

The project roadmap can be found [here](ROADMAP.md).

### Installation

>[!WARNING]
> HyperCPU supports Linux systems only. Do not even try to build it under Windows.
> HyperCPU supports 64-bit GNU/Linux systems only. It is known to be successfully built and running on `amd64` and `aarch64` architectures.

#### Dependencies

* `gcc >= 14` or `clang >= 19`;
* `cmake >= 3.28`;
* `make`;
* `ninja`;
* `re2`;
* `fmt`;
* `googletest` (required for building tests in Release profile);
* `python3`, `python3-pip`, `python3-sphinx`, `python3-sphinx-rtd-theme` (required for building a documentation).

#### Build instructions

```bash
$ git clone https://github.com/HyperWinX/HyperCPU --recursive

Check notice on line 60 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L60

Dollar signs used before commands without showing output
$ cd HyperCPU

Check notice on line 61 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L61

Dollar signs used before commands without showing output
$ cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release

Check notice on line 62 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L62

Dollar signs used before commands without showing output
$ ninja -C build default -j$(nproc)

Check notice on line 63 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L63

Dollar signs used before commands without showing output
$ cd docs

Check notice on line 64 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L64

Dollar signs used before commands without showing output
$ make html

Check notice on line 65 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L65

Dollar signs used before commands without showing output
```

`cmake` build options (use `-D` flag to define them):

* `CMAKE_BUILD_TYPE:STRING` - project build profile (`Release` or `Debug`), mandatory to be specified;
* `HCPU_SANITIZERS_ENABLED:BOOL` - HyperCPU sanitizers, enabled by default (use `-DHCPU_SANITIZERS_ENABLED:BOOL=OFF` to disable).

The compiled binaries should be located in `build` directory. The generated documentation should be located in `docs/_build/html` directory. After building the project open `index.html` file and start reading the documentation.

Do not forget to check out [examples](examples) folder for interesting code examples that will help you better understand the syntax of hASM and the power of HyperCPU.

### Usage

#### `hcasm` (hASM assembler)

To compile a program to a binary file:

```bash
$ ./hcasm -o <target> <source>

Check notice on line 84 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L84

Dollar signs used before commands without showing output
```

To compile a program to an object file:

## Roadmap
```bash
$ ./hcasm -c <target> <source>

Check notice on line 90 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L90

Dollar signs used before commands without showing output
```

You can find the project roadmap [here](ROADMAP.md).
To do things with a different verbosity level (`debug`, `info`, `warning`, `error`):

## Installation
```bash
$ ./hcasm -v <verbosity_level> ...

Check notice on line 96 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L96

Dollar signs used before commands without showing output
```

At the moment of writing this text, HyperCPU installation is done by building the whole project from source code. Maybe one day HyperCPU will start distributing release tarballs for much easier installation, but who knows.
To display help message and exit:

### Building from source codes
```bash
$ ./hcasm -h # = ./hcasm --help

Check notice on line 102 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L102

Dollar signs used before commands without showing output
```

HyperCPU requires these tools and libraries:
To display program version and exit:

* C++ compiler with C++23 standard support (i. e. `gcc` >= `14` or `clang` >= 19);
* `cmake`, `ninja` - build systems;
* `re2` - regular expressions parser;
* `libfmt` - formatting library;
* `googletest` - required for building tests in Release build profile;
* `python3`, `python3-pip`, `sphinx` and `sphinx-rtd-theme` (should be installed through `pip` or your system package manager) - required for building a documentation.
```bash
$ ./hcasm --version

Check notice on line 108 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L108

Dollar signs used before commands without showing output
```

There are a few options (definitions) that can be used with `cmake`:
* `CMAKE_BUILD_TYPE`:`STRING` - project build profile (`Release` or `Debug`), should be always specified;
* `HCPU_SANITIZERS_ENABLED`:`BOOL` - HyperCPU sanitizers (enabled by default); use `-DHCPU_SANITIZERS_ENABLED:BOOL=OFF` to disable them.
#### `hcemul` (hCPU emulator)

After installing dependencies, open the terminal and run these commands:
To run a binary:

```bash
git clone https://github.com/HyperWinX/HyperCPU --recursive
cd HyperCPU
cmake -S. -Bbuild -G "Ninja" -DCMAKE_BUILD_TYPE=Release
ninja -C build default -j$(nproc)
$ ./hcasm <target>

Check notice on line 116 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L116

Dollar signs used before commands without showing output
```

That's all. The compiled binaries should be located in `build` directory.
To do things with a different verbosity level (`debug`, `info`, `warning`, `error`):

Run `cd docs && make html` to build a documentation. After that go to `docs/_build/html` directory, open `index.html` and start reading.
```bash
$ ./hcemul -v <verbosity_level> ...

Check notice on line 122 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L122

Dollar signs used before commands without showing output
```

## Usage
To display help message and exit:

```bash
$ ./hcemul -h # = ./hcemul --help

Check notice on line 128 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L128

Dollar signs used before commands without showing output
```
Usage: hcasm [--help] [--version] [-o VAR] [-c] [-v VAR] source

Positional arguments:
source source file to be assembled [required]

Optional arguments:
-h, --help shows help message and exits
-v, --version prints version information and exits
-o name of the binary file
-c compile to object file
-v set verbosity level. possible modes:
- debug
- info
- warning
- error [nargs=0..1] [default: "warning"]

Usage: hcemul [--help] [--version] [-v VAR] binary

Positional arguments:
binary binary file to execute [required]

Optional arguments:
-h, --help shows help message and exits
-v, --version prints version information and exits
-v set verbosity level. possible modes:
- debug
- info
- warning
- error [nargs=0..1] [default: "debug"]

To display program version and exit:

```bash
$ ./hcemul --version

Check notice on line 134 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L134

Dollar signs used before commands without showing output
```

## Contributing
### Contributing

HyperCPU is in active development, and we will be happy to hear any feedback from you. Do not hesitate to report bugs or suggest any ideas using "Issues" page.
HyperCPU is in active development and we will be happy to hear any feedback from you. Do not hesitate to report bugs or suggest any ideas using "Issues" page.

>[!IMPORTANT]
>Please send your pull requests to `dev` repository branch (not `master`).
> Please send your pull requests to `dev` repository branch, not `master`.

Thank you for your interest in HyperCPU.

## Authors
### Authors

HyperCPU is brought to you by:

* [HyperWin](https://github.com/HyperWinX) (2024 - present time) - idea, code, documentation.
* [Ivan Movchan](https://github.com/ivan-movchan) (2025 - present time) - artwork.
* [Ivan Movchan](https://github.com/ivan-movchan) (2025 - present time) - artwork, beta testing, sample programs.

### License

HyperCPU is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

## License
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

HyperCPU is a free software licensed under [GNU General Public License 3.0](LICENSE).
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
23 changes: 12 additions & 11 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# HyperCPU Roadmap

**Current goal: release 1.0**.
This document describes the roadmap of the project (some kind of TODO-list).

- [ ] Review whole documentation
- [ ] Improve test coverage
- [x] Implement emulator entry point
- [x] Implement low-latency console I/O mechanism for emulator (using ports)
- [x] Solve not-yet-defined label references
### *Release 1.0*

Check notice on line 5 in ROADMAP.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ROADMAP.md#L5

Expected: h2; Actual: h3

- [ ] Review the whole documentation.
- [ ] Improve test coverage.
- [x] Implement emulator entry point.
- [x] Implement low-latency console I/O mechanism for emulator (using ports).
- [x] Solve not-yet-defined label references.

### Release 1.1
- [ ] Add comparison instruction, conditional call/jmp
- [ ] Add build system functionality to the assembler, implement build configurations
- [ ] Write proper benchmarks
- [ ] Add comparison instruction, conditional `CALL`/`JMP`.

Check notice on line 14 in ROADMAP.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ROADMAP.md#L14

Lists should be surrounded by blank lines
- [ ] Add build system functionality to hASM (assembler), implement build configurations.
- [ ] Write proper benchmarks.

### Release 1.2
- [ ] Implement ncurses-based UI and standard to communicate with it
- [ ] Implement `ncurses`-based UI and standard to communicate with it.

Check notice on line 19 in ROADMAP.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ROADMAP.md#L19

Lists should be surrounded by blank lines

### Release 2.0
- [ ] Implement linking functionality
- [ ] Implement linking functionality.

Check notice on line 22 in ROADMAP.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ROADMAP.md#L22

Lists should be surrounded by blank lines
11 changes: 10 additions & 1 deletion examples/hello_world.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*

This is a simple "Hello World" program written in HyperCPU assembly (hASM).
It writes a string to the console char by char, then writes a newline byte (0x10) and does CPU halt.

Copyrignt (c) 2025 Ivan Movchan <ivan.movchan.07@gmail.com>

*/

main:
write xlll0, 'H';
write xlll0, 'e';
Expand All @@ -13,4 +22,4 @@ main:
write xlll0, 'd';
write xlll0, '!';
write xlll0, 0u10;
halt;
halt;
Binary file modified images/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading