Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nbingham1 opened this issue Jul 24, 2016 · 1 comment

Comments

@nbingham1
Copy link

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
@fangism
Copy link
Owner

fangism commented Jul 25, 2016

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 fangism changed the title Source that was never released puts token on channel channel-source-args doesn't completely reset previous channel-rsource effect Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants