Compare commits
3 commits
51ce7b079e
...
bdbc6d89bd
Author | SHA1 | Date | |
---|---|---|---|
bdbc6d89bd | |||
10ae95fac1 | |||
053391b010 |
32 changed files with 143 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# See Notices.txt for copyright information
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -7,6 +9,8 @@ jobs:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v3
|
- uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- run: |
|
||||||
|
scripts/check-copyright.sh
|
||||||
- run: |
|
- run: |
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.80.1
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.80.1
|
||||||
source "$HOME/.cargo/env"
|
source "$HOME/.cargo/env"
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# See Notices.txt for copyright information
|
||||||
/target
|
/target
|
||||||
.vscode
|
.vscode
|
|
@ -1,3 +1,7 @@
|
||||||
|
<!--
|
||||||
|
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
See Notices.txt for copyright information
|
||||||
|
-->
|
||||||
# Fayalite
|
# Fayalite
|
||||||
|
|
||||||
Fayalite is a library for designing digital hardware -- a hardware description language (HDL) embedded in the Rust programming language. Fayalite's semantics are based on [FIRRTL] as interpreted by [LLVM CIRCT](https://circt.llvm.org/docs/Dialects/FIRRTL/FIRRTLAnnotations/).
|
Fayalite is a library for designing digital hardware -- a hardware description language (HDL) embedded in the Rust programming language. Fayalite's semantics are based on [FIRRTL] as interpreted by [LLVM CIRCT](https://circt.llvm.org/docs/Dialects/FIRRTL/FIRRTLAnnotations/).
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField,
|
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
hdl_type_common::{
|
hdl_type_common::{
|
||||||
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics,
|
common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::{fold::impl_fold, kw, Errors, HdlAttr, PairsIterExt};
|
use crate::{fold::impl_fold, kw, Errors, HdlAttr, PairsIterExt};
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{format_ident, quote_spanned, ToTokens};
|
use quote::{format_ident, quote_spanned, ToTokens};
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use fayalite::{cli, prelude::*};
|
use fayalite::{cli, prelude::*};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
|
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Fayalite Modules
|
//! # Fayalite Modules
|
||||||
//!
|
//!
|
||||||
//! The [`#[hdl_module]`][`crate::hdl_module`] attribute is applied to a Rust
|
//! The [`#[hdl_module]`][`crate::hdl_module`] attribute is applied to a Rust
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! These are for when you want to use modules written in
|
//! These are for when you want to use modules written in
|
||||||
//! some other language, such as Verilog.
|
//! some other language, such as Verilog.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Module Function Bodies
|
//! # Module Function Bodies
|
||||||
//!
|
//!
|
||||||
//! The `#[hdl_module]` attribute lets you have statements/expressions with `#[hdl]` annotations
|
//! The `#[hdl_module]` attribute lets you have statements/expressions with `#[hdl]` annotations
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # `#[hdl]` Array Expressions
|
//! # `#[hdl]` Array Expressions
|
||||||
//!
|
//!
|
||||||
//! `#[hdl]` can be used on Array Expressions to construct an [`Array<[T; N]>`][type@Array] expression:
|
//! `#[hdl]` can be used on Array Expressions to construct an [`Array<[T; N]>`][type@Array] expression:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # `#[hdl] if` Statements
|
//! # `#[hdl] if` Statements
|
||||||
//!
|
//!
|
||||||
//! `#[hdl] if` statements behave similarly to Rust `if` statements, except they end up as muxes
|
//! `#[hdl] if` statements behave similarly to Rust `if` statements, except they end up as muxes
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! ## `#[hdl] let` statements
|
//! ## `#[hdl] let` statements
|
||||||
|
|
||||||
pub mod inputs_outputs;
|
pub mod inputs_outputs;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! ### Inputs/Outputs
|
//! ### Inputs/Outputs
|
||||||
//!
|
//!
|
||||||
//! Inputs/Outputs create a Rust variable with type [`Expr<T>`] where `T` is the type of the input/output.
|
//! Inputs/Outputs create a Rust variable with type [`Expr<T>`] where `T` is the type of the input/output.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! ### Module Instances
|
//! ### Module Instances
|
||||||
//!
|
//!
|
||||||
//! module instances are kinda like the hardware equivalent of calling a function,
|
//! module instances are kinda like the hardware equivalent of calling a function,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Memories
|
//! # Memories
|
||||||
//!
|
//!
|
||||||
//! Memories are optimized for storing large amounts of data.
|
//! Memories are optimized for storing large amounts of data.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! ### Registers
|
//! ### Registers
|
||||||
//!
|
//!
|
||||||
//! Registers are memory devices that will change their state only on a clock
|
//! Registers are memory devices that will change their state only on a clock
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! ### Wires
|
//! ### Wires
|
||||||
//!
|
//!
|
||||||
//! Wires are kinda like variables, but unlike registers,
|
//! Wires are kinda like variables, but unlike registers,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # `_hdl`-suffixed literals
|
//! # `_hdl`-suffixed literals
|
||||||
//!
|
//!
|
||||||
//! You can have integer literals with an arbitrary number of bits like so:
|
//! You can have integer literals with an arbitrary number of bits like so:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # `#[hdl] match` Statements
|
//! # `#[hdl] match` Statements
|
||||||
//!
|
//!
|
||||||
//! `#[hdl] match` statements behave similarly to Rust `match` statements, except they end up as muxes
|
//! `#[hdl] match` statements behave similarly to Rust `match` statements, except they end up as muxes
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # `#[hdl]` Struct/Variant Expressions
|
//! # `#[hdl]` Struct/Variant Expressions
|
||||||
//!
|
//!
|
||||||
//! Note: Structs are also known as [Bundles] when used in Fayalite, the Bundle name comes from [FIRRTL].
|
//! Note: Structs are also known as [Bundles] when used in Fayalite, the Bundle name comes from [FIRRTL].
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Normal Modules
|
//! # Normal Modules
|
||||||
//!
|
//!
|
||||||
//! See also: [Extern Modules][`super::extern_module`]
|
//! See also: [Extern Modules][`super::extern_module`]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Fayalite Semantics
|
//! # Fayalite Semantics
|
||||||
//!
|
//!
|
||||||
//! Fayalite's semantics are based on [FIRRTL]. Due to their significance, some of the semantics are also documented here.
|
//! Fayalite's semantics are based on [FIRRTL]. Due to their significance, some of the semantics are also documented here.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
//! # Connection Semantics
|
//! # Connection Semantics
|
||||||
//!
|
//!
|
||||||
//! Fayalite's connection semantics are unlike assignments in software, so be careful!
|
//! Fayalite's connection semantics are unlike assignments in software, so be careful!
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
bundle::{Bundle, BundleType},
|
bundle::{Bundle, BundleType},
|
||||||
firrtl,
|
firrtl,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::{
|
use crate::{
|
||||||
array::Array,
|
array::Array,
|
||||||
bundle::{Bundle, BundleField},
|
bundle::{Bundle, BundleField},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
pub use crate::{
|
pub use crate::{
|
||||||
annotations::Annotation,
|
annotations::Annotation,
|
||||||
array::{Array, ArrayType},
|
array::{Array, ArrayType},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[hdl]
|
#[hdl]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
// See Notices.txt for copyright information
|
||||||
mod safety_boundary {
|
mod safety_boundary {
|
||||||
use std::{cell::Cell, ptr::NonNull};
|
use std::{cell::Cell, ptr::NonNull};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{
|
{
|
||||||
|
"license_header": [
|
||||||
|
"SPDX-License-Identifier: LGPL-3.0-or-later",
|
||||||
|
"See Notices.txt for copyright information"
|
||||||
|
],
|
||||||
"types": {
|
"types": {
|
||||||
"Module": {
|
"Module": {
|
||||||
"data": {
|
"data": {
|
||||||
|
|
74
scripts/check-copyright.sh
Executable file
74
scripts/check-copyright.sh
Executable file
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
# See Notices.txt for copyright information
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function fail()
|
||||||
|
{
|
||||||
|
local error="$1"
|
||||||
|
echo "error: $error" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function fail_file()
|
||||||
|
{
|
||||||
|
local file="$1" line="$2" error="$3"
|
||||||
|
fail "$file:$((line + 1)): $error"
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_file()
|
||||||
|
{
|
||||||
|
local file="$1" regexes=("${@:2}")
|
||||||
|
local lines
|
||||||
|
mapfile -t lines < "$file"
|
||||||
|
local line
|
||||||
|
for line in "${!regexes[@]}"; do
|
||||||
|
eval '[[ "${lines[i]}" =~ '"${regexes[i]}"' ]]' ||
|
||||||
|
fail_file "$file" "$line" "doesn't match regex: ${regexes[i]}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
POUND_HEADER=('^"# SPDX-License-Identifier: LGPL-3.0-or-later"$' '^"# See Notices.txt for copyright information"$')
|
||||||
|
SLASH_HEADER=('^"// SPDX-License-Identifier: LGPL-3.0-or-later"$' '^"// See Notices.txt for copyright information"$')
|
||||||
|
MD_HEADER=('^"<!--"$' '^"SPDX-License-Identifier: LGPL-3.0-or-later"$' '^"See Notices.txt for copyright information"$')
|
||||||
|
JSON_HEADER=('^"{"$' '^" \"license_header\": ["$' '^" \"SPDX-License-Identifier: LGPL-3.0-or-later\","$' '^" \"See Notices.txt for copyright information\""')
|
||||||
|
|
||||||
|
function main()
|
||||||
|
{
|
||||||
|
local IFS=$'\n'
|
||||||
|
[[ -z "$(git status --porcelain)" ]] || fail "git repo is dirty"
|
||||||
|
local file
|
||||||
|
for file in $(git ls-tree --name-only --full-tree -r HEAD); do
|
||||||
|
case "/$file" in
|
||||||
|
/Cargo.lock)
|
||||||
|
# generated file
|
||||||
|
;;
|
||||||
|
*/LICENSE.md|*/Notices.txt)
|
||||||
|
# copyright file
|
||||||
|
;;
|
||||||
|
/crates/fayalite/tests/ui/*.stderr)
|
||||||
|
# file that can't contain copyright header
|
||||||
|
;;
|
||||||
|
/.forgejo/workflows/*.yml|*/.gitignore|*.toml)
|
||||||
|
check_file "$file" "${POUND_HEADER[@]}"
|
||||||
|
;;
|
||||||
|
*.md)
|
||||||
|
check_file "$file" "${MD_HEADER[@]}"
|
||||||
|
;;
|
||||||
|
*.sh)
|
||||||
|
check_file "$file" '^'\''#!'\' "${POUND_HEADER[@]}"
|
||||||
|
;;
|
||||||
|
*.rs)
|
||||||
|
check_file "$file" "${SLASH_HEADER[@]}"
|
||||||
|
;;
|
||||||
|
*.json)
|
||||||
|
check_file "$file" "${JSON_HEADER[@]}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
fail_file "$file" 0 "unimplemented file kind -- you need to add it to $0"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
Loading…
Add table
Add a link
Reference in a new issue