const generics on hdl_module work!
All checks were successful
/ test (push) Successful in 4m54s

This commit is contained in:
Jacob Lifshay 2024-09-17 15:39:23 -07:00
parent 76ea7f82c3
commit 2c1afd1cd6
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c
3 changed files with 355 additions and 86 deletions

View file

@ -6,6 +6,7 @@ use fayalite::{
intern::Intern,
module::transform::simplify_enums::{simplify_enums, SimplifyEnumsKind},
prelude::*,
ty::StaticType,
};
use serde_json::json;
@ -133,9 +134,11 @@ circuit my_module:
};
}
#[cfg(todo)]
#[hdl_module(outline_generated)]
pub fn check_array_repeat<const N: usize>() {
pub fn check_array_repeat<const N: usize>()
where
ConstUsize<N>: KnownSize,
{
#[hdl]
let i: UInt<8> = m.input();
#[hdl]
@ -147,7 +150,6 @@ pub fn check_array_repeat<const N: usize>() {
);
}
#[cfg(todo)]
#[test]
fn test_array_repeat() {
let _n = SourceLocation::normalize_files_for_tests();
@ -188,21 +190,21 @@ circuit check_array_repeat_1:
};
}
#[cfg(todo)]
#[hdl_module(outline_generated)]
pub fn check_skipped_generics<T, #[hdl(skip)] U, const N: usize, #[hdl(skip)] const M: usize>(v: U)
where
T: StaticValue,
T: StaticType,
ConstUsize<N>: KnownSize,
U: std::fmt::Display,
{
dbg!(M);
#[hdl]
let i: T = m.input();
#[hdl]
let o: Array<[T; N]> = m.output();
let o: Array<T, N> = m.output();
let bytes = v.to_string().as_bytes().to_expr();
#[hdl]
let o2: Array<[UInt<8>]> = m.output(bytes.ty());
let o2: Array<UInt<8>> = m.output(Expr::ty(bytes));
connect(
o,
#[hdl]
@ -211,7 +213,6 @@ where
connect(o2, bytes);
}
#[cfg(todo)]
#[test]
fn test_skipped_generics() {
let _n = SourceLocation::normalize_files_for_tests();