This commit is contained in:
parent
def406ab52
commit
3f5dd61e46
10 changed files with 1468 additions and 218 deletions
|
|
@ -6,6 +6,7 @@ use fayalite::{
|
|||
int::{UIntInRange, UIntInRangeInclusive},
|
||||
intern::Intern,
|
||||
module::transform::simplify_enums::SimplifyEnumsKind,
|
||||
platform::PlatformIOBuilder,
|
||||
prelude::*,
|
||||
reset::ResetType,
|
||||
ty::StaticType,
|
||||
|
|
@ -4631,3 +4632,55 @@ circuit check_uint_in_range:
|
|||
",
|
||||
};
|
||||
}
|
||||
|
||||
#[hdl_module(outline_generated)]
|
||||
pub fn check_platform_io(platform_io_builder: PlatformIOBuilder<'_>) {
|
||||
#[hdl]
|
||||
let io = m.add_platform_io(platform_io_builder);
|
||||
}
|
||||
|
||||
#[cfg(todo)]
|
||||
#[test]
|
||||
fn test_platform_io() {
|
||||
let _n = SourceLocation::normalize_files_for_tests();
|
||||
let m = check_platform_io(todo!());
|
||||
dbg!(m);
|
||||
#[rustfmt::skip] // work around https://github.com/rust-lang/rustfmt/issues/6161
|
||||
assert_export_firrtl! {
|
||||
m =>
|
||||
"/test/check_platform_io.fir": r"FIRRTL version 3.2.0
|
||||
circuit check_platform_io:
|
||||
type Ty0 = {value: UInt<0>, range: {}}
|
||||
type Ty1 = {value: UInt<1>, range: {}}
|
||||
type Ty2 = {value: UInt<2>, range: {}}
|
||||
type Ty3 = {value: UInt<2>, range: {}}
|
||||
type Ty4 = {value: UInt<3>, range: {}}
|
||||
type Ty5 = {value: UInt<3>, range: {}}
|
||||
type Ty6 = {value: UInt<4>, range: {}}
|
||||
type Ty7 = {value: UInt<0>, range: {}}
|
||||
type Ty8 = {value: UInt<1>, range: {}}
|
||||
type Ty9 = {value: UInt<2>, range: {}}
|
||||
type Ty10 = {value: UInt<2>, range: {}}
|
||||
type Ty11 = {value: UInt<3>, range: {}}
|
||||
type Ty12 = {value: UInt<3>, range: {}}
|
||||
type Ty13 = {value: UInt<4>, range: {}}
|
||||
type Ty14 = {value: UInt<4>, range: {}}
|
||||
module check_platform_io: @[module-XXXXXXXXXX.rs 1:1]
|
||||
input i_0_to_1: Ty0 @[module-XXXXXXXXXX.rs 2:1]
|
||||
input i_0_to_2: Ty1 @[module-XXXXXXXXXX.rs 3:1]
|
||||
input i_0_to_3: Ty2 @[module-XXXXXXXXXX.rs 4:1]
|
||||
input i_0_to_4: Ty3 @[module-XXXXXXXXXX.rs 5:1]
|
||||
input i_0_to_7: Ty4 @[module-XXXXXXXXXX.rs 6:1]
|
||||
input i_0_to_8: Ty5 @[module-XXXXXXXXXX.rs 7:1]
|
||||
input i_0_to_9: Ty6 @[module-XXXXXXXXXX.rs 8:1]
|
||||
input i_0_through_0: Ty7 @[module-XXXXXXXXXX.rs 9:1]
|
||||
input i_0_through_1: Ty8 @[module-XXXXXXXXXX.rs 10:1]
|
||||
input i_0_through_2: Ty9 @[module-XXXXXXXXXX.rs 11:1]
|
||||
input i_0_through_3: Ty10 @[module-XXXXXXXXXX.rs 12:1]
|
||||
input i_0_through_4: Ty11 @[module-XXXXXXXXXX.rs 13:1]
|
||||
input i_0_through_7: Ty12 @[module-XXXXXXXXXX.rs 14:1]
|
||||
input i_0_through_8: Ty13 @[module-XXXXXXXXXX.rs 15:1]
|
||||
input i_0_through_9: Ty14 @[module-XXXXXXXXXX.rs 16:1]
|
||||
",
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,20 @@ pub fn my_module(a: i32, m: u32, (m, _): (i32, u32)) {
|
|||
let o: UInt<8> = m.output();
|
||||
}
|
||||
|
||||
#[hdl_module]
|
||||
pub fn my_module2(platform_io_builder: PlatformIOBuilder<'_>) {
|
||||
#[hdl]
|
||||
let a: UInt<8> = m.input();
|
||||
#[hdl]
|
||||
let b: UInt<8> = m.output();
|
||||
#[hdl]
|
||||
let io = m.add_platform_io(platform_io_builder);
|
||||
#[hdl]
|
||||
let c: UInt<8> = m.input();
|
||||
#[hdl]
|
||||
let d: UInt<8> = m.output();
|
||||
#[hdl]
|
||||
let io = m.add_platform_io(platform_io_builder);
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,47 @@
|
|||
error: name conflicts with implicit `m: &mut ModuleBuilder<_>`
|
||||
error: name conflicts with implicit `m: &ModuleBuilder`
|
||||
--> tests/ui/module.rs:7:26
|
||||
|
|
||||
7 | pub fn my_module(a: i32, m: u32, (m, _): (i32, u32)) {
|
||||
| ^
|
||||
|
||||
error: name conflicts with implicit `m: &mut ModuleBuilder<_>`
|
||||
error: name conflicts with implicit `m: &ModuleBuilder`
|
||||
--> tests/ui/module.rs:7:35
|
||||
|
|
||||
7 | pub fn my_module(a: i32, m: u32, (m, _): (i32, u32)) {
|
||||
| ^
|
||||
|
||||
error: name conflicts with implicit `m: &mut ModuleBuilder<_>`
|
||||
error: name conflicts with implicit `m: &ModuleBuilder`
|
||||
--> tests/ui/module.rs:9:9
|
||||
|
|
||||
9 | let m: UInt<8> = m.input();
|
||||
| ^
|
||||
|
||||
error: can't have other inputs/outputs in a module using m.add_platform_io()
|
||||
--> tests/ui/module.rs:17:24
|
||||
|
|
||||
17 | let a: UInt<8> = m.input();
|
||||
| ^^^^^
|
||||
|
||||
error: can't have other inputs/outputs in a module using m.add_platform_io()
|
||||
--> tests/ui/module.rs:19:24
|
||||
|
|
||||
19 | let b: UInt<8> = m.output();
|
||||
| ^^^^^^
|
||||
|
||||
error: can't have other inputs/outputs in a module using m.add_platform_io()
|
||||
--> tests/ui/module.rs:23:24
|
||||
|
|
||||
23 | let c: UInt<8> = m.input();
|
||||
| ^^^^^
|
||||
|
||||
error: can't have other inputs/outputs in a module using m.add_platform_io()
|
||||
--> tests/ui/module.rs:25:24
|
||||
|
|
||||
25 | let d: UInt<8> = m.output();
|
||||
| ^^^^^^
|
||||
|
||||
error: can't use m.add_platform_io() more than once in a single module
|
||||
--> tests/ui/module.rs:27:16
|
||||
|
|
||||
27 | let io = m.add_platform_io(platform_io_builder);
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue