17 | module Spidr.Compiler.DType
19 | import Spidr.Compiler.MLIR.IR.MLIRContext
20 | import Spidr.Compiler.MLIR.IR.Types
21 | import Spidr.Compiler.MLIR.IR.BuiltinTypes
25 | numBits : DType -> Bits16
38 | isSigned : DType -> Bool
39 | isSigned PRED = True
45 | isSigned U16 = False
46 | isSigned U32 = False
47 | isSigned U64 = False
51 | mlirType : HasIO io => MLIRContext -> DType -> io Type_
52 | mlirType ctx PRED = cast <$> IntegerType.get ctx 1 Signless
53 | mlirType ctx S8 = cast <$> IntegerType.get ctx 8 Signless
54 | mlirType ctx S16 = cast <$> IntegerType.get ctx 16 Signless
55 | mlirType ctx S32 = cast <$> IntegerType.get ctx 32 Signless
56 | mlirType ctx S64 = cast <$> IntegerType.get ctx 64 Signless
57 | mlirType ctx U8 = cast <$> IntegerType.get ctx 8 Unsigned
58 | mlirType ctx U16 = cast <$> IntegerType.get ctx 16 Unsigned
59 | mlirType ctx U32 = cast <$> IntegerType.get ctx 32 Unsigned
60 | mlirType ctx U64 = cast <$> IntegerType.get ctx 64 Unsigned
61 | mlirType ctx F64 = cast <$> Float64Type.get ctx