aboutsummaryrefslogtreecommitdiff
path: root/test/chisel3/MemorySearch.fir
blob: a2df4671ac907425f919bfd4703c8c746ad18428 (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(0, 3)
    reg index : UInt(3)
    index.init := T_35
    node T_36 = UInt(0, 1)
    node T_37 = UInt(4, 3)
    node T_38 = UInt(15, 4)
    node T_39 = UInt(14, 4)
    node T_40 = UInt(2, 2)
    node T_41 = UInt(5, 3)
    node T_42 = UInt(13, 4)
    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(7, 3)
    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(0, 1)
      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