-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
880 additions
and
883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
use core::fmt::{Debug, Formatter}; | ||
use crate::design::StreamletHandle; | ||
use crate::error::Result; | ||
use crate::Name; | ||
|
||
///Trait for general implementation backends | ||
pub trait ImplementationBackend { | ||
fn name(&self) -> Name; | ||
fn streamlet_handle(&self) -> StreamletHandle; | ||
fn connect_action(&self) -> Result<()> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
impl Debug for dyn ImplementationBackend { | ||
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result { | ||
unimplemented!() | ||
} | ||
} | ||
use crate::design::StreamletHandle; | ||
use crate::error::Result; | ||
use crate::Name; | ||
use core::fmt::{Debug, Formatter}; | ||
|
||
///Trait for general implementation backends | ||
pub trait ImplementationBackend { | ||
fn name(&self) -> Name; | ||
fn streamlet_handle(&self) -> StreamletHandle; | ||
fn connect_action(&self) -> Result<()> { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
impl Debug for dyn ImplementationBackend { | ||
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result { | ||
unimplemented!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 40 additions & 42 deletions
82
src/stdlib/common/architecture/assignment/array_assignment.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,40 @@ | ||
use indexmap::IndexMap; | ||
|
||
use crate::{ | ||
stdlib::common::architecture::assignment::{AssignmentKind, RangeConstraint}, | ||
}; | ||
|
||
/// An enum for describing complete assignment to an array | ||
#[derive(Debug, Clone)] | ||
pub enum ArrayAssignment { | ||
/// Assigning all of an array directly (may concatenate objects) | ||
Direct(Vec<AssignmentKind>), | ||
/// Assign some fields directly, and may assign all other fields a single value (e.g. ( 1 => '1', others => '0' ), or ( 1 downto 0 => '1', others => '0' )) | ||
Sliced { | ||
direct: IndexMap<RangeConstraint, AssignmentKind>, | ||
others: Option<Box<AssignmentKind>>, | ||
}, | ||
/// Assigning a single value to all of an array | ||
Others(Box<AssignmentKind>), | ||
} | ||
|
||
impl ArrayAssignment { | ||
pub fn direct(values: Vec<AssignmentKind>) -> ArrayAssignment { | ||
ArrayAssignment::Direct(values) | ||
} | ||
|
||
pub fn partial( | ||
direct: IndexMap<RangeConstraint, AssignmentKind>, | ||
others: Option<AssignmentKind>, | ||
) -> ArrayAssignment { | ||
ArrayAssignment::Sliced { | ||
direct, | ||
others: match others { | ||
Some(value) => Some(Box::new(value)), | ||
None => None, | ||
}, | ||
} | ||
} | ||
|
||
pub fn others(value: AssignmentKind) -> ArrayAssignment { | ||
ArrayAssignment::Others(Box::new(value)) | ||
} | ||
} | ||
use indexmap::IndexMap; | ||
|
||
use crate::stdlib::common::architecture::assignment::{AssignmentKind, RangeConstraint}; | ||
|
||
/// An enum for describing complete assignment to an array | ||
#[derive(Debug, Clone)] | ||
pub enum ArrayAssignment { | ||
/// Assigning all of an array directly (may concatenate objects) | ||
Direct(Vec<AssignmentKind>), | ||
/// Assign some fields directly, and may assign all other fields a single value (e.g. ( 1 => '1', others => '0' ), or ( 1 downto 0 => '1', others => '0' )) | ||
Sliced { | ||
direct: IndexMap<RangeConstraint, AssignmentKind>, | ||
others: Option<Box<AssignmentKind>>, | ||
}, | ||
/// Assigning a single value to all of an array | ||
Others(Box<AssignmentKind>), | ||
} | ||
|
||
impl ArrayAssignment { | ||
pub fn direct(values: Vec<AssignmentKind>) -> ArrayAssignment { | ||
ArrayAssignment::Direct(values) | ||
} | ||
|
||
pub fn partial( | ||
direct: IndexMap<RangeConstraint, AssignmentKind>, | ||
others: Option<AssignmentKind>, | ||
) -> ArrayAssignment { | ||
ArrayAssignment::Sliced { | ||
direct, | ||
others: match others { | ||
Some(value) => Some(Box::new(value)), | ||
None => None, | ||
}, | ||
} | ||
} | ||
|
||
pub fn others(value: AssignmentKind) -> ArrayAssignment { | ||
ArrayAssignment::Others(Box::new(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.