Skip to content
21 changes: 19 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,30 @@
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "false",
"username": "vscode",
"upgradePackages": "false"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "os-provided",
"ppa": "false"
}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"customizations": {
"vscode": {
"extensions": [
"swiftlang.swift-vscode"
],
"settings": {
"swift.path": "/usr/bin",
"lldb.library": "/usr/lib/liblldb.so",
"editor.inlayHints.enabled": "offUnlessPressed",
"editor.formatOnSave": true,
"[swift]": {
Expand All @@ -33,7 +50,7 @@
]
}
}
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"remoteUser": "vscode"
}
28 changes: 14 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.10
// swift-tools-version: 6.0

Check warning on line 1 in Package.swift

View workflow job for this annotation

GitHub Actions / cov / exec-cov

The current code coverage percentage is passing with 95.39% (minimum allowed: 95%).
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -15,7 +15,7 @@
.product(name: "SwiftUtils", package: "SwiftUtils"),
.product(name: "VHDLJSModels", package: "VHDLJSModels"),
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures"),
.target(name: "GeneratorCommands")
.target(name: "GeneratorCommands"),
],
swiftSettings: [.unsafeFlags(["-parse-as-library"])]
)
Expand All @@ -31,7 +31,7 @@
.product(name: "SwiftUtils", package: "SwiftUtils"),
.product(name: "VHDLJSModels", package: "VHDLJSModels"),
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures"),
.target(name: "GeneratorCommands")
.target(name: "GeneratorCommands"),
]
)
#endif
Expand All @@ -46,17 +46,17 @@
name: "llfsm-generate",
targets: ["MachineGenerator"]
),
.library(name: "LLFSMGenerate", targets: ["GeneratorCommands"])
.library(name: "LLFSMGenerate", targets: ["GeneratorCommands"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.2"),
.package(url: "https://github.com/mipalgu/VHDLMachines", from: "4.0.5"),
.package(url: "https://github.com/mipalgu/VHDLMachines", from: "4.1.0"),
.package(url: "https://github.com/mipalgu/VHDLParsing", from: "2.7.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
.package(url: "https://github.com/mipalgu/VHDLKripkeStructureGenerator.git", from: "0.5.1"),
.package(url: "https://github.com/CPSLabGU/SwiftUtils.git", from: "0.1.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.8.2"),
.package(url: "https://github.com/mipalgu/VHDLKripkeStructureGenerator.git", from: "0.6.0"),
.package(url: "https://github.com/CPSLabGU/SwiftUtils.git", from: "1.0.0"),
.package(url: "https://github.com/CPSLabGU/VHDLJSModels", from: "2.0.0"),
.package(url: "https://github.com/CPSLabGU/VHDLKripkeStructures", from: "1.3.0")
.package(url: "https://github.com/CPSLabGU/VHDLKripkeStructures", from: "2.0.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand All @@ -71,7 +71,7 @@
.product(name: "VHDLKripkeStructureGenerator", package: "VHDLKripkeStructureGenerator"),
.product(name: "SwiftUtils", package: "SwiftUtils"),
.product(name: "VHDLJSModels", package: "VHDLJSModels"),
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures")
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures"),
],
swiftSettings: [
.unsafeFlags(
Expand All @@ -90,8 +90,8 @@
.product(name: "VHDLKripkeStructureGenerator", package: "VHDLKripkeStructureGenerator"),
.product(name: "SwiftUtils", package: "SwiftUtils"),
.product(name: "VHDLJSModels", package: "VHDLJSModels"),
"TestHelpers",
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures")
.target(name: "TestHelpers"),
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures"),
]
),
.testTarget(
Expand All @@ -100,8 +100,8 @@
.product(name: "VHDLMachines", package: "VHDLMachines"),
.product(name: "VHDLParsing", package: "VHDLParsing"),
.product(name: "VHDLJSModels", package: "VHDLJSModels"),
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures")
.product(name: "VHDLKripkeStructures", package: "VHDLKripkeStructures"),
]
)
),
]
)
69 changes: 17 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![MacOS CI](https://github.com/CPSLabGU/LLFSMGenerate/actions/workflows/ci-macOS.yml/badge.svg)](https://github.com/CPSLabGU/LLFSMGenerate/actions/workflows/ci-macOS.yml)
[![Windows CI](https://github.com/CPSLabGU/LLFSMGenerate/actions/workflows/ci-windows.yml/badge.svg)](https://github.com/CPSLabGU/LLFSMGenerate/actions/workflows/ci-windows.yml)

`llfsmgenerate` is a command-line utility for transforming and compiling LLFSM formats that use the `VHDL`
`llfsm-generate` is a command-line utility for transforming and compiling LLFSM formats that use the `VHDL`
Hardware Description Language.
This program allows the transformation between [VHDL LLFSMs](https://github.com/mipalgu/VHDLMachines) and
other standard Javascript models, such as the [VHDL LLFSM editor](https://github.com/CPSLabGU/editor) that utilises *React*.
Expand All @@ -14,9 +14,9 @@ formal verification via Kripke structure generation.

## Requirements and Supported Platforms

- Swift 5.10 or later (See [Installing Swift](#installing-swift)).
- macOS 14 (Sonoma) or later.
- Linux (Ubuntu 20.04 or later).
- Swift 6.0 or later (See [Installing Swift](#installing-swift)).
- macOS 26 (Sonoma) or later.
- Linux (Ubuntu 24.04 or later).
- Windows 11.
- Windows Server Edition 2022.

Expand All @@ -28,22 +28,22 @@ cd LLFSMGenerate
swift build -c release
```

After the compilation, you will find the binary at `.build/release/llfsmgenerate`. It is preferred that the
After the compilation, you will find the binary at `.build/release/llfsm-generate`. It is preferred that the
binary is installed within a location accessible by your `PATH` variable. For example, you may install the
program within `/usr/local/`:
```shell
install -m 0755 .build/release/llfsmgenerate /usr/local/bin
install -m 0755 .build/release/llfsm-generate /usr/local/bin
```

The `llfsmgenerate` binary allows the transformation of LLFSM models that contain VHDL code within their
The `llfsm-generate` binary allows the transformation of LLFSM models that contain VHDL code within their
state actions. Most LLFSMs are created using an editor that places an easily parsable format within the
LLFSM directory. This format is very easy to parse using Javascript, however, it does not provide type
information that is extremely useful in formal verification and code generation. To generate VHDL code for a
given LLFSM, we need to first convert it from the Javascript-like format into the format that our
[code generator](https://github.com/mipalgu/VHDLMachines) understands. This is done by using the command:

```shell
llfsmgenerate model <path_to_LLFSM_folder>
llfsm-generate model <path_to_LLFSM_folder>
```

> [!IMPORTANT]
Expand All @@ -55,34 +55,34 @@ This command creates the type-aware model that our
Once this model is generated, we can then create the VHDL source files by using:

```shell
llfsmgenerate vhdl <path_to_LLFSM_folder>
llfsm-generate vhdl <path_to_LLFSM_folder>
```

This command creates the `.vhd` files located in `<path_to_LLFSM_folder>/build/vhdl`. We can also create
the Kripke structure generator that creates graph structures for formal verification.

```shell
llfsmgenerate vhdl --include-kripke-structure <path_to_LLFSM_folder>
llfsm-generate vhdl --include-kripke-structure <path_to_LLFSM_folder>
```

We may now copy our vhdl files into a directory that we can utilise for HDL projects. We have provided
a command called `install` to make this simpler.

```shell
llfsmgenerate install <path_to_LLFSM_folder> <path_to_install_location>
llfsm-generate install <path_to_LLFSM_folder> <path_to_install_location>
```

You may also specify a vivado project location by passing the `--vivado` flag.

```shell
llfsmgenerate install <path_to_LLFSM_folder> --vivado <path_to_vivado_project_directory>
llfsm-generate install <path_to_LLFSM_folder> --vivado <path_to_vivado_project_directory>
```

Please see the *help* section of the binary for a complete list of parameters and sub-commands.
```shell
OVERVIEW: A utility for performing operations on LLFSM formats.

USAGE: llfsmgenerate <subcommand>
USAGE: llfsm-generate <subcommand>

OPTIONS:
--version Show the version.
Expand All @@ -94,8 +94,9 @@ SUBCOMMANDS:
clean Clean the generated source files from the machine.
install Install the VHDL files into a specified directory.
graph Generate a graphviz file (.dot) for the entire kripke structure.
report Report Statistics about the generated machine.

See 'llfsmgenerate help <subcommand>' for detailed help.
See 'llfsm-generate help <subcommand>' for detailed help.
```

## Documentation
Expand All @@ -106,41 +107,5 @@ The latest documentation may be found on the
## Installing Swift

You may verify your swift installation by performing `swift --version`. The minimum required version for
`llfsmgenerate` is `5.7`. To install swift, follow the instructions below for your operating system.

### Linux

We prefer that you use [swiftenv](https://github.com/kylef/swiftenv) to install swift on linux. To install
`swiftenv`, clone the repository in your home directory.

```shell
git clone https://github.com/kylef/swiftenv.git ~/.swiftenv
```

Then place the following in your `.bash_profile` (or equivalent if using a different shell). Please note,
some systems will require modifying your `.bashrc` instead of `.bash_profile`.

```shell
echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bash_profile
echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(swiftenv init -)"' >> ~/.bash_profile
```

You may now install swift via:

```shell
source ~/.bash_profile
swiftenv install 6.0
```

The full instructions are provided in the
[swiftenv documentation](https://swiftenv.fuller.li/en/latest/installation.html).

### MacOS

Make sure you install the latest version of XCode through your App store or
[developer website](https://developer.apple.com/xcode/).

### Windows

The full instructions for installing swift may be found on the [swift website](https://www.swift.org/install/windows/).
`llfsm-generate` is `6.0`. To install swift, follow the [instructions](https://www.swift.org/install)
for your operating system.
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/CleanCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import Foundation
public struct CleanCommand: ParsableCommand {

/// The command configuration.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "clean",
abstract: "Clean the generated source files from the machine."
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/Generate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import VHDLMachineTransformations
public struct Generate: ParsableCommand {

/// The command configuration describing a sub-command.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "model",
abstract: "A utility for converting LLFSM formats."
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/GraphCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import VHDLKripkeStructures
public struct GraphCommand: ParsableCommand {

/// The configuration of this command.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "graph",
abstract: "Generate a graphviz file (.dot) for the entire kripke structure."
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/InstallCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Foundation
public struct InstallCommand: ParsableCommand {

/// The configuration of this command.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "install",
abstract: "Install the VHDL files into a specified directory."
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/LLFSMGenerate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import ArgumentParser
public struct LLFSMGenerate: ParsableCommand {

/// This struct acts as an umbrella struct to multiple `ParsableCommand` subcommands.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "llfsm-generate",
abstract: "A utility for performing operations on LLFSM formats.",
version: "3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion Sources/GeneratorCommands/ReportCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import VHDLKripkeStructures
public struct ReportCommand: ParsableCommand {

/// The command configuration.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "report",
abstract: "Report Statistics about the generated machine."
)
Expand Down
4 changes: 2 additions & 2 deletions Sources/GeneratorCommands/VHDLGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import VHDLParsing
public struct VHDLGenerator: ParsableCommand {

/// The configuration for the command.
public static var configuration = CommandConfiguration(
public static let configuration = CommandConfiguration(
commandName: "vhdl",
abstract: "A utility for generating VHDL source files from LLFSM definitions."
)
Expand Down Expand Up @@ -211,7 +211,7 @@ public struct VHDLGenerator: ParsableCommand {
message: "Failed to generate Kripke Structure for \(name.rawValue)."
)
}
try files.write(to: buildFolder, options: .atomic, originalContentsURL: nil)
try files.write(to: buildFolder, options: FileWrapper.WritingOptions.atomic, originalContentsURL: nil)
}

}
Loading
Loading