hackt icon indicating copy to clipboard operation
hackt copied to clipboard

channel-source-args doesn't completely reset previous channel-rsource effect

Open nbingham1 opened this issue 8 years ago • 1 comments

deftype _c1of2 <: int (bool d[2], f, t) {
  spec {
    excllo(d)               // all nodes: d[0..N-1]
  }

  f = d[0];
  t = d[1];
}

deftype c1of2 <: int (bool d[2], f, t) {
  spec {
    exclhi(d)               // all nodes: d[0..N-1]
  }

  f = d[0];
  t = d[1];
}

defchan e1of2 <: chan(int) (c1of2 b; bool e, f, t, d[2]) {
  // hacprsim channel command: e:[01] b:M d:N
  d = b.d;
  f = b.f;
  t = b.t;
}

defproc buffer(bool Reset; e1of2? L; e1of2! R) {
  L?; R!;
  _c1of2 _R;

  prs {
    R.e & L.f -> _R.f-
    R.e & L.t -> _R.t-
    ~_R.f -> R.f+
    ~_R.t -> R.t+
    Reset | R.f | R.t -> L.e-
    ~R.e & ~L.f -> _R.f+
    ~R.e & ~L.t -> _R.t+
    _R.f -> R.f-
    _R.t -> R.t-
    ~Reset & ~R.f & ~R.t -> L.e+
  }
}


e1of2 L;
e1of2 R;
bool Reset;
buffer dut(Reset, L, R);
echo-commands on
initialize
watchall
channel L e:0 :0 d:2
channel R e:0 :0 d:2
channel-sink R
channel-expect-args R 1 1 1 1 1
channel-rsource L
channel-reset-all
set Reset 1
cycle
set Reset 0
channel-show-all
channel-source-args L 1 1 1 1 1
channel-release-all
channel-show-all
cycle
prsim> source test.prsimrc
# initialize 
# watchall 
# channel L e:0 :0 d:2 
# channel R e:0 :0 d:2 
# channel-sink R 
# channel-expect-args R 1 1 1 1 1 
# channel-rsource L 
# channel-reset-all 
# set Reset 1 
# cycle 
        0       Reset : 1
        10      L.f : 0
        10      L.t : 0
        10      R.e : 0
        10      L.e : 0 [by Reset:=1]
        20      dut._R.d[0] : 1 [by R.e:=0]
        20      dut._R.d[1] : 1 [by R.e:=0]
        30      R.f : 0 [by dut._R.d[0]:=1]
        30      R.t : 0 [by dut._R.d[1]:=1]
# set Reset 0 
# channel-show-all 
channels:
L : .e(init:0)  1x1of2 source-random,stopped, timing: global
R : .e(init:0)  1x1of2 sink,expect,stopped, timing: global {1,1,1,1,1,} @0
# channel-source-args L 1 1 1 1 1 
Warning: reconfiguring channel from old source to new source.
# channel-release-all 
# channel-show-all 
channels:
L : .e(init:0)  1x1of2 source, timing: global {0,1,1,1,1,1,} @0
R : .e(init:0)  1x1of2 sink,expect, timing: global {1,1,1,1,1,} @0
# cycle 
        30      Reset : 0
        40      R.e : 1
        40      L.e : 1 [by Reset:=0]
        50      L.f : 1 [by L.e:=1]
        60      dut._R.d[0] : 0 [by L.f:=1]
channel-assert: value assertion failed on channel R, expected: 1, but got: 0
        70      R.f : 1 [by dut._R.d[0]:=0]
ERROR: value assertion failed on channel `R' at index [0].
        expected: 1, got: 0
... at line 17
Error encountered during source "test.prsimrc".
error at line 1

nbingham1 avatar Jul 24 '16 19:07 nbingham1

So

# channel-source-args L 1 1 1 1 1

should have clobbered the effect of

# channel-rsource L

but instead we see:

L : .e(init:0)  1x1of2 source, timing: global {0,1,1,1,1,1,} @0

Where does that stray leading 0 come from?

fangism avatar Jul 25 '16 20:07 fangism