WIP: use HdlOption[the_type_var] or UInt[123 + n] for creating types

This commit is contained in:
Jacob Lifshay 2024-08-07 03:16:29 -07:00
parent cd99dbc849
commit 5835b995a9
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c
63 changed files with 13500 additions and 13210 deletions

View file

@ -0,0 +1,26 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// See Notices.txt for copyright information
use fayalite::{
array::ArrayType,
hdl,
int::{IntType, Size, UInt},
};
#[hdl(outline_generated)]
pub struct S<T: IntType, Len: Size> {
pub a: T,
b: UInt<3>,
pub(crate) c: ArrayType<UInt<1>, Len>,
}
#[hdl(outline_generated)]
pub enum E<T> {
A,
B(UInt<3>),
C(T),
}
#[hdl(outline_generated)]
pub struct S2<T = ()> {
pub v: E<T>,
}

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// See Notices.txt for copyright information
use fayalite::ty::Value;
use fayalite::hdl;
#[derive(Value)]
#[hdl]
union U {
a: (),
}

View file

@ -0,0 +1,7 @@
error: top-level #[hdl] can only be used on structs or enums
--> tests/ui/hdl_types.rs:5:1
|
5 | #[hdl]
| ^^^^^^
|
= note: this error originates in the attribute macro `hdl` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error: derive(Value) can only be used on structs or enums
--> tests/ui/value_derive.rs:5:10
|
5 | #[derive(Value)]
| ^^^^^
|
= note: this error originates in the derive macro `Value` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,32 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// See Notices.txt for copyright information
use fayalite::{
int::UInt,
ty::{StaticValue, Value},
};
#[derive(Value, Clone, Hash, PartialEq, Eq, Debug)]
#[hdl(outline_generated)]
pub struct S<T> {
pub a: T,
b: UInt<3>,
}
#[derive(Value, Clone, Hash, PartialEq, Eq, Debug)]
#[hdl(outline_generated)]
pub enum E<T> {
A,
B {},
C(),
D(UInt<3>),
E { a: UInt<3> },
F(UInt<3>, UInt<3>),
G(T),
H(T, UInt<1>),
}
#[derive(Value, Clone, Hash, PartialEq, Eq, Debug)]
#[hdl(outline_generated, static, where(T: StaticValue))]
pub struct S2<T> {
pub v: E<T>,
}