rename fire/fire_data to firing/firing_data
This commit is contained in:
parent
e05c368688
commit
2e8b73d2fc
|
@ -12,28 +12,28 @@ pub struct ReadyValid<T> {
|
|||
|
||||
impl<T: Type> ReadyValid<T> {
|
||||
#[hdl]
|
||||
pub fn fire(expr: Expr<Self>) -> Expr<Bool> {
|
||||
pub fn firing(expr: Expr<Self>) -> Expr<Bool> {
|
||||
#[hdl]
|
||||
let fire: Bool = wire();
|
||||
let firing: Bool = wire();
|
||||
#[hdl]
|
||||
match expr.data {
|
||||
HdlNone => connect(fire, false),
|
||||
HdlSome(_) => connect(fire, expr.ready),
|
||||
HdlNone => connect(firing, false),
|
||||
HdlSome(_) => connect(firing, expr.ready),
|
||||
}
|
||||
fire
|
||||
firing
|
||||
}
|
||||
#[hdl]
|
||||
pub fn fire_data(expr: impl ToExpr<Type = Self>) -> Expr<HdlOption<T>> {
|
||||
pub fn firing_data(expr: impl ToExpr<Type = Self>) -> Expr<HdlOption<T>> {
|
||||
let expr = expr.to_expr();
|
||||
let option_ty = Expr::ty(expr).data;
|
||||
#[hdl]
|
||||
let fire_data = wire(option_ty);
|
||||
connect(fire_data, option_ty.HdlNone());
|
||||
let firing_data = wire(option_ty);
|
||||
connect(firing_data, option_ty.HdlNone());
|
||||
#[hdl]
|
||||
if expr.ready {
|
||||
connect(fire_data, expr.data);
|
||||
connect(firing_data, expr.data);
|
||||
}
|
||||
fire_data
|
||||
firing_data
|
||||
}
|
||||
#[hdl]
|
||||
pub fn map<R: Type>(
|
||||
|
@ -82,11 +82,11 @@ pub fn queue<T: Type>(
|
|||
let write_port = mem.new_write_port();
|
||||
|
||||
#[hdl]
|
||||
let inp_fire: Bool = wire();
|
||||
connect(inp_fire, ReadyValid::fire(inp));
|
||||
let inp_firing: Bool = wire();
|
||||
connect(inp_firing, ReadyValid::firing(inp));
|
||||
#[hdl]
|
||||
let out_fire: Bool = wire();
|
||||
connect(out_fire, ReadyValid::fire(out));
|
||||
let out_firing: Bool = wire();
|
||||
connect(out_firing, ReadyValid::firing(out));
|
||||
#[hdl]
|
||||
let indexes_equal: Bool = wire();
|
||||
connect(indexes_equal, inp_index_reg.cmp_eq(out_index_reg));
|
||||
|
@ -101,7 +101,7 @@ pub fn queue<T: Type>(
|
|||
connect(read_port.en, true);
|
||||
connect(read_port.clk, cd.clk);
|
||||
connect(write_port.addr, inp_index_reg);
|
||||
connect(write_port.en, inp_fire);
|
||||
connect(write_port.en, inp_firing);
|
||||
connect(write_port.clk, cd.clk);
|
||||
connect(write_port.data, HdlOption::unwrap_or(inp.data, ty.uninit()));
|
||||
connect(write_port.mask, splat_mask(ty, true.to_expr()));
|
||||
|
@ -126,12 +126,12 @@ pub fn queue<T: Type>(
|
|||
}
|
||||
|
||||
#[hdl]
|
||||
if inp_fire.cmp_ne(out_fire) {
|
||||
connect(maybe_full_reg, inp_fire);
|
||||
if inp_firing.cmp_ne(out_firing) {
|
||||
connect(maybe_full_reg, inp_firing);
|
||||
}
|
||||
|
||||
#[hdl]
|
||||
if inp_fire {
|
||||
if inp_firing {
|
||||
#[hdl]
|
||||
if inp_index_reg.cmp_eq(capacity.get() - 1) {
|
||||
connect_any(inp_index_reg, 0_hdl_u0);
|
||||
|
@ -141,7 +141,7 @@ pub fn queue<T: Type>(
|
|||
}
|
||||
|
||||
#[hdl]
|
||||
if out_fire {
|
||||
if out_firing {
|
||||
#[hdl]
|
||||
if out_index_reg.cmp_eq(capacity.get() - 1) {
|
||||
connect_any(out_index_reg, 0_hdl_u0);
|
||||
|
@ -258,9 +258,9 @@ mod tests {
|
|||
connect(next_expected_count, expected_count_reg);
|
||||
connect(expected_count_reg, next_expected_count);
|
||||
#[hdl]
|
||||
if ReadyValid::fire(dut.inp) & !ReadyValid::fire(dut.out) {
|
||||
if ReadyValid::firing(dut.inp) & !ReadyValid::firing(dut.out) {
|
||||
connect_any(next_expected_count, expected_count_reg + 1u8);
|
||||
} else if !ReadyValid::fire(dut.inp) & ReadyValid::fire(dut.out) {
|
||||
} else if !ReadyValid::firing(dut.inp) & ReadyValid::firing(dut.out) {
|
||||
connect_any(next_expected_count, expected_count_reg - 1u8);
|
||||
}
|
||||
hdl_assert(cd.clk, expected_count_reg.cmp_eq(dut.count), "");
|
||||
|
@ -289,7 +289,7 @@ mod tests {
|
|||
let stored_inp_data_reg = reg_builder().clock_domain(cd).reset(0u8);
|
||||
|
||||
#[hdl]
|
||||
if let HdlSome(data) = ReadyValid::fire_data(dut.inp) {
|
||||
if let HdlSome(data) = ReadyValid::firing_data(dut.inp) {
|
||||
#[hdl]
|
||||
if inp_index_reg.cmp_lt(index_max) {
|
||||
connect_any(inp_index_reg, inp_index_reg + 1u8);
|
||||
|
@ -311,7 +311,7 @@ mod tests {
|
|||
let stored_out_data_reg = reg_builder().clock_domain(cd).reset(0u8);
|
||||
|
||||
#[hdl]
|
||||
if let HdlSome(data) = ReadyValid::fire_data(dut.out) {
|
||||
if let HdlSome(data) = ReadyValid::firing_data(dut.out) {
|
||||
#[hdl]
|
||||
if out_index_reg.cmp_lt(index_max) {
|
||||
connect_any(out_index_reg, out_index_reg + 1u8);
|
||||
|
|
Loading…
Reference in a new issue