def build(ports):
     m = NDArray((10), dtype=types.i32, name='m1')
     for i in range(9):
         m[i] = ports.in1
     # CHECK: ValueError: Unassigned sub-matrices:
     # CHECK: {{[[]}}{{[[]}}9{{[]]}}{{[]]}}
     m.to_circt()
Exemple #2
0
 def build(ports):
     # a 32xi32 ndarray.
     m = NDArray((32, ), dtype=types.i32, name='m2')
     for i in range(16):
         m[i] = ports.in1
     m[16:32] = ports.in0
     m = m.reshape((4, 8))
     ports.c = m.to_circt()
Exemple #3
0
    def build(ports):
        # a 32x32xi1 ndarray.
        # A dtype of i32 is fairly expensive wrt. the size of the output IR, but
        # but allows for assigning indiviudal bits.
        m = NDArray((32, 32), dtype=types.i1, name='m1')

        # Assign individual bits to the first 32 bits.
        for i in range(32):
            m[0, i] = hw.ConstantOp(types.i1, 1)

        # Fill the next 15 values with an i32. The ndarray knows how to convert
        # from i32 to <32xi1> to comply with the ndarray dtype.
        for i in range(1, 16):
            m[i] = ports.in1

        # Fill the upportmost 16 rows with the input array of in0 : 16xi32
        m[16:32] = ports.in0

        # We don't provide a method of reshaping the ndarray wrt. its dtype.
        # that is: 32x32xi1 => 32xi32
        # This has massive overhead in the generated IR, and can be easily
        # achieved by a bitcast.
        ports.c = hw.BitcastOp(M5.t_c, m.to_circt())
Exemple #4
0
 def build(ports):
     m = NDArray((3, 3), dtype=types.i32)
     for i in range(3):
         for j in range(3):
             m[i][j] = types.i32(i * 3 + j)
     ports.out = m.to_circt()
Exemple #5
0
 def build(ports):
     m = NDArray(from_value=ports.in1, name='m1')
     ports.out = m.to_circt(create_wire=False)
Exemple #6
0
 def build(ports):
     m = NDArray(from_value=ports.in1, name='m1')
     ports.out = m.to_circt()