[−][src]Struct kaze::Signal
A collection of 1 or more bits driven by some source.
A Signal
can be created by several Module
methods (eg. lit
) or as a result of combining existing Signal
s (eg. concat
). Signal
s are local to their respective Module
s.
A Signal
behaves similarly to a wire
in Verilog, except that it's always driven.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let a = m.lit(0xffu8, 8); // 8-bit signal let b = m.input("my_input", 27); // 27-bit signal let c = b.bits(7, 0); // 8-bit signal let d = a + c; // 8-bit signal m.output("my_output", d); // 8-bit output driven by d
Implementations
impl<'a> Signal<'a>
[src]
#[must_use]pub fn bit_width(&self) -> u32
[src]
Returns the bit width of the given Signal
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); assert_eq!(m.lit(42u32, 7).bit_width(), 7); assert_eq!(m.input("i", 27).bit_width(), 27); assert_eq!(m.reg("some_reg", 46).value.bit_width(), 46); assert_eq!((!m.low()).bit_width(), 1); assert_eq!((m.lit(25u8, 8) + m.lit(42u8, 8)).bit_width(), 8); assert_eq!((m.lit(1u8, 1) * m.lit(2u8, 2)).bit_width(), 3); assert_eq!(m.lit(1u8, 1).mul_signed(m.lit(2u8, 2)).bit_width(), 3); assert_eq!(m.lit(false, 1).reg_next("some_other_reg").bit_width(), 1); assert_eq!(m.lit(true, 1).reg_next_with_default("yet_another_reg", false).bit_width(), 1); assert_eq!((m.high() & m.low()).bit_width(), 1); assert_eq!((m.high() | m.low()).bit_width(), 1); assert_eq!(m.lit(12u32, 100).bit(30).bit_width(), 1); assert_eq!(m.lit(1u32, 99).bits(37, 29).bit_width(), 9); assert_eq!(m.high().repeat(35).bit_width(), 35); assert_eq!(m.lit(1u32, 20).concat(m.high()).bit_width(), 21); assert_eq!((m.lit(0x80u32, 8) << m.lit(true, 1)).bit_width(), 8); assert_eq!((m.lit(0x80u32, 8) >> m.lit(true, 1)).bit_width(), 8); assert_eq!(m.lit(0x80u32, 8).shr_arithmetic(m.lit(true, 1)).bit_width(), 8); assert_eq!(m.lit(0xaau32, 8).eq(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.lit(0xaau32, 8).ne(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.lit(0xaau32, 8).lt(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.lit(0xaau32, 8).le(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.lit(0xaau32, 8).gt(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.lit(0xaau32, 8).ge(m.lit(0xaau32, 8)).bit_width(), 1); assert_eq!(m.mux(m.low(), m.lit(5u32, 4), m.lit(6u32, 4)).bit_width(), 4);
pub fn bit(&'a self, index: u32) -> &Signal<'a>
[src]
Creates a Signal
that represents the value of the single bit of this Signal
at index index
, where index
equal to 0
represents this Signal
's least significant bit.
Panics
Panics if index
is greater than or equal to this Signal
's bit_width
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit = m.lit(0b0110u32, 4); let bit_0 = lit.bit(0); // Represents 0 let bit_1 = lit.bit(1); // Represents 1 let bit_2 = lit.bit(2); // Represents 1 let bit_3 = lit.bit(3); // Represents 0
pub fn bits(&'a self, range_high: u32, range_low: u32) -> &Signal<'a>
[src]
Creates a Signal
that represents a contiguous subset of the bits of this Signal
, starting at range_low
as the least significant bit and ending at range_high
as the most significant bit, inclusive.
Panics
Panics if either range_low
or range_high
is greater than or equal to the bit width of this Signal
, or if range_low
is greater than range_high
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit = m.lit(0b0110u32, 4); let bits_210 = lit.bits(2, 0); // Represents 0b110 let bits_321 = lit.bits(3, 1); // Represents 0b011 let bits_10 = lit.bits(1, 0); // Represents 0b10 let bits_32 = lit.bits(3, 2); // Represents 0b01 let bits_2 = lit.bits(2, 2); // Represents 1, equivalent to lit.bit(2)
pub fn repeat(&'a self, count: u32) -> &Signal<'a>
[src]
Creates a Signal
that represents this Signal
repeated count
times.
Panics
Panics if self.bit_width() * count
is less than MIN_SIGNAL_BIT_WIDTH
or greater than MAX_SIGNAL_BIT_WIDTH
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit = m.lit(0xau32, 4); let repeat_1 = lit.repeat(1); // Equivalent to just lit let repeat_2 = lit.repeat(2); // Equivalent to 8-bit lit with value 0xaa let repeat_5 = lit.repeat(5); // Equivalent to 20-bit lit with value 0xaaaaa let repeat_8 = lit.repeat(8); // Equivalent to 32-bit lit with value 0xaaaaaaaa
pub fn concat(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents this Signal
concatenated with rhs
.
self
represents the upper bits in the resulting Signal
, and rhs
represents the lower bits.
Panics
Panics if self.bit_width() + rhs.bit_width()
is greater than MAX_SIGNAL_BIT_WIDTH
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xffu32, 8); let concat_1 = lit_a.concat(lit_b); // Equivalent to 12-bit lit with value 0xaff let concat_2 = lit_b.concat(lit_a); // Equivalent to 12-bit lit with value 0xffa let concat_3 = lit_a.concat(lit_a); // Equivalent to 8-bit lit with value 0xaa
pub fn eq(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a bitwise boolean equality comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let eq_1 = lit_a.eq(lit_a); // Equivalent to m.high() let eq_2 = lit_b.eq(lit_b); // Equivalent to m.high() let eq_3 = lit_a.eq(lit_b); // Equivalent to m.low() let eq_4 = lit_b.eq(lit_a); // Equivalent to m.low()
pub fn ne(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a bitwise boolean inequality comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let ne_1 = lit_a.ne(lit_a); // Equivalent to m.low() let ne_2 = lit_b.ne(lit_b); // Equivalent to m.low() let ne_3 = lit_a.ne(lit_b); // Equivalent to m.high() let ne_4 = lit_b.ne(lit_a); // Equivalent to m.high()
pub fn lt(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of an unsigned <
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let lt_1 = lit_a.lt(lit_a); // Equivalent to m.low() let lt_2 = lit_b.lt(lit_b); // Equivalent to m.low() let lt_3 = lit_a.lt(lit_b); // Equivalent to m.high() let lt_4 = lit_b.lt(lit_a); // Equivalent to m.low()
pub fn le(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of an unsigned <=
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let le_1 = lit_a.le(lit_a); // Equivalent to m.high() let le_2 = lit_b.le(lit_b); // Equivalent to m.high() let le_3 = lit_a.le(lit_b); // Equivalent to m.high() let le_4 = lit_b.le(lit_a); // Equivalent to m.low()
pub fn gt(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of an unsigned >
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let gt_1 = lit_a.gt(lit_a); // Equivalent to m.low() let gt_2 = lit_b.gt(lit_b); // Equivalent to m.low() let gt_3 = lit_a.gt(lit_b); // Equivalent to m.low() let gt_4 = lit_b.gt(lit_a); // Equivalent to m.high()
pub fn ge(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of an unsigned >=
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, or if the bit widths of self
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let ge_1 = lit_a.ge(lit_a); // Equivalent to m.high() let ge_2 = lit_b.ge(lit_b); // Equivalent to m.high() let ge_3 = lit_a.ge(lit_b); // Equivalent to m.low() let ge_4 = lit_b.ge(lit_a); // Equivalent to m.high()
pub fn lt_signed(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a signed <
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, if the bit widths of self
and rhs
aren't equal, or if the bit widths of self
and rhs
are 1.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let lt_signed_1 = lit_a.lt_signed(lit_a); // Equivalent to m.low() let lt_signed_2 = lit_b.lt_signed(lit_b); // Equivalent to m.low() let lt_signed_3 = lit_a.lt_signed(lit_b); // Equivalent to m.high() let lt_signed_4 = lit_b.lt_signed(lit_a); // Equivalent to m.low()
pub fn le_signed(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a signed <=
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, if the bit widths of self
and rhs
aren't equal, or if the bit widths of self
and rhs
are 1.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let le_signed_1 = lit_a.le_signed(lit_a); // Equivalent to m.high() let le_signed_2 = lit_b.le_signed(lit_b); // Equivalent to m.high() let le_signed_3 = lit_a.le_signed(lit_b); // Equivalent to m.high() let le_signed_4 = lit_b.le_signed(lit_a); // Equivalent to m.low()
pub fn gt_signed(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a signed >
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, if the bit widths of self
and rhs
aren't equal, or if the bit widths of self
and rhs
are 1.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let gt_signed_1 = lit_a.gt_signed(lit_a); // Equivalent to m.low() let gt_signed_2 = lit_b.gt_signed(lit_b); // Equivalent to m.low() let gt_signed_3 = lit_a.gt_signed(lit_b); // Equivalent to m.low() let gt_signed_4 = lit_b.gt_signed(lit_a); // Equivalent to m.high()
pub fn ge_signed(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Creates a Signal
that represents the single-bit result of a signed >=
comparison between self
and rhs
.
Panics
Panics if self
and rhs
belong to different Module
s, if the bit widths of self
and rhs
aren't equal, or if the bit widths of self
and rhs
are 1.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lit_a = m.lit(0xau32, 4); let lit_b = m.lit(0xbu32, 4); let ge_signed_1 = lit_a.ge_signed(lit_a); // Equivalent to m.high() let ge_signed_2 = lit_b.ge_signed(lit_b); // Equivalent to m.high() let ge_signed_3 = lit_a.ge_signed(lit_b); // Equivalent to m.low() let ge_signed_4 = lit_b.ge_signed(lit_a); // Equivalent to m.high()
pub fn shr_arithmetic(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Combines two Signal
s, producing a new Signal
that represents self
arithmetically shifted right by rhs
bits.
The result is truncated to self
's bit_width
. If rhs
specifies a value that's greater than or equal to self
's bit_width
, the resulting value will be all self
's top bit repeated self
's bit_width
times.
Panics
Panics if lhs
and rhs
belong to different Module
s.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(0x80000000u32, 32); let rhs = m.lit(1u32, 1); let shifted = lhs.shr_arithmetic(rhs); // Equivalent to m.lit(0xc0000000u32, 32)
pub fn mul_signed(&'a self, rhs: &'a Signal<'a>) -> &Signal<'a>
[src]
Combines two Signal
s, producing a new Signal
that represents the signed product of the original two Signal
s.
The product's bit_width
is equal to self.bit_width() + rhs.bit_width()
.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if self.bit_width() + rhs.bit_width()
is greater than MAX_SIGNAL_BIT_WIDTH
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(4u32, 3); // -4 let rhs = m.lit(5u32, 4); let sum = lhs.mul_signed(rhs); // Equivalent to m.lit(108u32, 7), -20
pub fn mux(
&'a self,
when_true: &'a Signal<'a>,
when_false: &'a Signal<'a>
) -> &Signal<'a>
[src]
&'a self,
when_true: &'a Signal<'a>,
when_false: &'a Signal<'a>
) -> &Signal<'a>
Creates a 2:1 multiplexer that represents when_true
's value when self
is high, and when_false
's value when self
is low.
This is a convenience wrapper for Module::mux
.
Panics
Panics if when_true
or when_false
belong to a different Module
than self
, if self
's bit width is not 1, or if the bit widths of when_true
and when_false
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let cond = m.input("cond", 1); let a = m.input("a", 8); let b = m.input("b", 8); m.output("my_output", cond.mux(a, b)); // Outputs a when cond is high, b otherwise
pub fn reg_next<S: Into<String>>(&'a self, name: S) -> &Signal<'a>
[src]
Creates a Signal
that represents the same value as this Signal
, but delayed by one cycle.
This is achieved by creating a new Register
called name
, and specifying this Signal
as the next value for the Register
. Note that no default value is provided for this Register
, so the returned Signal
's value is undefined until the first clock edge, and its value is not affected by its Module
's implicit reset. If a default value is desired, use reg_next_with_default
instead.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let a = m.lit(true, 1); let a_delayed = a.reg_next("a_delayed");
pub fn reg_next_with_default<S: Into<String>, C: Into<Constant>>(
&'a self,
name: S,
default_value: C
) -> &Signal<'a>
[src]
&'a self,
name: S,
default_value: C
) -> &Signal<'a>
Creates a Signal
that represents the same value as this Signal
, but delayed by one cycle, except when this Signal
's Module
's implicit reset is asserted, at which point it will represent default_value
.
This is achieved by creating a new Register
called name
, specifying default_value
as its default value, and specifying this Signal
as the next value for the Register
. If a default value is not desired, use reg_next
instead.
Panics
Panics if the specified value
doesn't fit into this Signal
's bit width.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let a = m.lit(true, 1); let a_delayed = a.reg_next_with_default("a_delayed", false);
Trait Implementations
impl<'a> Add<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
that represents the sum of the original two Signal
s.
The sum is truncated to the Signal
's bit_width
. If a carry bit is desired, the operands can be concat
enated with a 0
bit before the operation.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if the bit widths of lhs
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(1u32, 32); let rhs = m.lit(2u32, 32); let sum = lhs + rhs; // Equivalent to m.lit(3u32, 32) let lhs = m.low().concat(m.lit(0xffffffffu32, 32)); // Concat 0 bits with operands for carry let rhs = m.low().concat(m.lit(0x00000001u32, 32)); let carry_sum = lhs + rhs; // Equivalent to m.lit(0x100000000u64, 33) let sum = carry_sum.bits(31, 0); // Equivalent to m.lit(0u32, 32) let carry = carry_sum.bit(32); // Equivalent to m.lit(true, 1)
impl<'a> BitAnd<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the &
operator.
pub fn bitand(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
whose bits represent the bitwise &
of each of the bits of the original two Signal
s.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if the bit widths of lhs
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.low(); let rhs = m.high(); let single_bitand = lhs & rhs; let lhs = m.input("in1", 3); let rhs = m.input("in2", 3); let multi_bitand = lhs & rhs;
impl<'a> BitOr<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the |
operator.
pub fn bitor(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
whose bits represent the bitwise |
of each of the bits of the original two Signal
s.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if the bit widths of lhs
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.low(); let rhs = m.high(); let single_bitor = lhs | rhs; let lhs = m.input("in1", 3); let rhs = m.input("in2", 3); let multi_bitor = lhs | rhs;
impl<'a> BitXor<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the ^
operator.
pub fn bitxor(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
whose bits represent the bitwise ^
of each of the bits of the original two Signal
s.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if the bit widths of lhs
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.low(); let rhs = m.high(); let single_bitxor = lhs ^ rhs; let lhs = m.input("in1", 3); let rhs = m.input("in2", 3); let multi_bitxor = lhs ^ rhs;
impl<'a> Eq for &'a Signal<'a>
[src]
impl<'a> Hash for &'a Signal<'a>
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Mul<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
that represents the unsigned product of the original two Signal
s.
The product's bit_width
is equal to self.bit_width() + rhs.bit_width()
.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if self.bit_width() + rhs.bit_width()
is greater than MAX_SIGNAL_BIT_WIDTH
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(4u32, 3); let rhs = m.lit(5u32, 4); let sum = lhs * rhs; // Equivalent to m.lit(20u32, 7)
impl<'a> Not for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the !
operator.
pub fn not(self) -> Self
[src]
Produces a new Signal
whose bits represent the bitwise !
of each of the bits of the original Signal
.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let input1 = m.input("input1", 1); let single_not = !input1; let input2 = m.input("input2", 6); let multi_not = !input2;
impl<'a> PartialEq<&'a Signal<'a>> for &'a Signal<'a>
[src]
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> Shl<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the <<
operator.
pub fn shl(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
that represents self
logically shifted left by rhs
bits.
The result is truncated to self
's bit_width
. If rhs
specifies a value that's greater than or equal to self
's bit_width
, the resulting value will be zero.
Panics
Panics if lhs
and rhs
belong to different Module
s.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(3u32, 32); let rhs = m.lit(2u32, 2); let shifted = lhs << rhs; // Equivalent to m.lit(12u32, 32)
impl<'a> Shr<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the >>
operator.
pub fn shr(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
that represents self
logically shifted right by rhs
bits.
The result is truncated to self
's bit_width
. If rhs
specifies a value that's greater than or equal to self
's bit_width
, the resulting value will be zero.
Panics
Panics if lhs
and rhs
belong to different Module
s.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(12u32, 32); let rhs = m.lit(2u32, 2); let shifted = lhs >> rhs; // Equivalent to m.lit(3u32, 32)
impl<'a> Sub<&'a Signal<'a>> for &'a Signal<'a>
[src]
type Output = Self
The resulting type after applying the -
operator.
pub fn sub(self, rhs: Self) -> Self
[src]
Combines two Signal
s, producing a new Signal
that represents the difference of the original two Signal
s.
The difference is truncated to the Signal
's bit_width
.
Panics
Panics if lhs
and rhs
belong to different Module
s, or if the bit widths of lhs
and rhs
aren't equal.
Examples
use kaze::*; let c = Context::new(); let m = c.module("MyModule"); let lhs = m.lit(3u32, 32); let rhs = m.lit(2u32, 32); let difference = lhs - rhs; // Equivalent to m.lit(1u32, 32)
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Signal<'a>
[src]
impl<'a> !Send for Signal<'a>
[src]
impl<'a> !Sync for Signal<'a>
[src]
impl<'a> Unpin for Signal<'a>
[src]
impl<'a> !UnwindSafe for Signal<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,