packages feed

clash-prelude-1.0.0: tests/Clash/Tests/DerivingDataReprTypes.hs

{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}

module Clash.Tests.DerivingDataReprTypes where

import Clash.Sized.Unsigned
import Clash.Annotations.BitRepresentation.Deriving

type SmallInt = Unsigned 2

data Train
  = Passenger
      -- Number of wagons:
      SmallInt
  | Freight
      -- Number of wagons:
      SmallInt
      -- Max weight:
      SmallInt
  | Maintenance
  | Toy


data RGB
  = R
  | G
  | B

deriveDefaultAnnotation [t| RGB |]
deriveBitPack [t| RGB |]