pub struct Memory {
pub depth: usize,
pub width: usize,
pub init_value: Const,
pub write_ports: Vec<MemoryWritePort>,
pub read_ports: Vec<MemoryReadPort>,
}
Expand description
An all-in-one random-access memory cell.
A memory is made of depth
rows, each of them width
bits wide. While a memory row
is considered to be the basic access unit, we support the notion of “wide ports”,
which access a (naturally aligned) power-of-two number of memory rows at once.
While any number and combination of read and write ports is considered valid in the netlist, the rules for what memories can actually be realized in hardware depend on the target, and can be quite byzantine.
There are no priority rules among write ports. If more than one port writes to the same memory bit at the same time, the value written is undefined.
The output of the memory cell consists of the read data from all the read ports, concatenated in order.
Fields§
§depth: usize
The number of rows in the memory.
For every port on the memory, depth
must be evenly divisible
by port.data_len / memory.width
. This ensures that, for wide ports, every access
is either completely in-bounds, or completely out-of-bounds.
width: usize
The width of single memory row.
init_value: Const
Initial value for the memory, with all the rows concatenated in order.
Must have a length equal to depth * width
.
write_ports: Vec<MemoryWritePort>
§read_ports: Vec<MemoryReadPort>
Implementations§
Trait Implementations§
impl Eq for Memory
impl StructuralPartialEq for Memory
Auto Trait Implementations§
impl Freeze for Memory
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.