aboutsummaryrefslogtreecommitdiff
path: root/test/chisel3/MemorySearch.fir
blob: e62f35ba742c31ff78a98b3bbf43af35064f53e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
; RUN: firrtl -i %s -o %s.flo -x X -p c | tee %s.out | FileCheck %s
; CHECK: Done!
circuit MemorySearch : 
  module MemorySearch : 
    input target : UInt<4>
    output address : UInt<3>
    input en : UInt<1>
    output odone : UInt<1>
    
    node T_35 = UInt<3>(0)
    reg index : UInt<3>
    on-reset index := T_35
    node T_36 = UInt<1>(0)
    node T_37 = UInt<3>(4)
    node T_38 = UInt<4>(15)
    node T_39 = UInt<4>(14)
    node T_40 = UInt<2>(2)
    node T_41 = UInt<3>(5)
    node T_42 = UInt<4>(13)
    wire elts : UInt<1>[7]
    elts[0] := T_36
    elts[1] := T_37
    elts[2] := T_38
    elts[3] := T_39
    elts[4] := T_40
    elts[5] := T_41
    elts[6] := T_42
    accessor elt = elts[index]
    node T_43 = bit-not(en)
    node T_44 = eq(elt, target)
    node T_45 = UInt<3>(7)
    node T_46 = eq(index, T_45)
    node T_47 = bit-or(T_44, T_46)
    node done = bit-and(T_43, T_47)
    when en : 
      node T_48 = UInt<1>(0)
      index := T_48
    else : 
      node T_49 = bit-not(done)
      when T_49 : 
        node T_50 = UInt<1>(1)
        node T_51 = add(index, T_50)
        index := T_51
    odone := done
    address := index