forked from libre-chip/fayalite
WIP: use HdlOption[the_type_var] or UInt[123 + n] for creating types
This commit is contained in:
parent
cd99dbc849
commit
5835b995a9
63 changed files with 13500 additions and 13210 deletions
26
crates/fayalite/tests/hdl_types.rs
Normal file
26
crates/fayalite/tests/hdl_types.rs
Normal 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
|
@ -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: (),
|
||||
}
|
7
crates/fayalite/tests/ui/hdl_types.stderr
Normal file
7
crates/fayalite/tests/ui/hdl_types.stderr
Normal 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)
|
|
@ -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)
|
|
@ -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>,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue