From ee7404348ca163dbd8b93e6f6f9ec5c2e0a8ec6f Mon Sep 17 00:00:00 2001 From: Rowan Goemans Date: Mon, 8 Apr 2024 18:48:32 +0200 Subject: [PATCH] Handle Christiaan and Peter comments #2 --- clash-cores/clash-cores.cabal | 4 - clash-cores/src/Clash/Cores/Crc/Catalog.hs | 834 +++++++++++--------- clash-cores/src/Clash/Cores/Crc/Internal.hs | 181 +++-- clash-cores/test/Test/Cores/Crc.hs | 267 ++++--- 4 files changed, 692 insertions(+), 594 deletions(-) diff --git a/clash-cores/clash-cores.cabal b/clash-cores/clash-cores.cabal index 8f25fc6455..659435a952 100644 --- a/clash-cores/clash-cores.cabal +++ b/clash-cores/clash-cores.cabal @@ -126,10 +126,6 @@ library Clash.Cores.Crc Clash.Cores.Crc.Internal Clash.Cores.Crc.Catalog - Clash.Cores.CRC - Clash.Cores.CRC.Internal - Clash.Cores.CRC.Catalog - Clash.Cores.CRC.Derive Clash.Cores.LatticeSemi.ECP5.Blackboxes.IO Clash.Cores.LatticeSemi.ECP5.IO Clash.Cores.LatticeSemi.ICE40.Blackboxes.IO diff --git a/clash-cores/src/Clash/Cores/Crc/Catalog.hs b/clash-cores/src/Clash/Cores/Crc/Catalog.hs index 1522db4890..9c3c5d482b 100644 --- a/clash-cores/src/Clash/Cores/Crc/Catalog.hs +++ b/clash-cores/src/Clash/Cores/Crc/Catalog.hs @@ -8,23 +8,20 @@ CRC parameter catalog This module provides a variety of common CRCs All entries are from https://reveng.sourceforge.io/crc-catalogue/all.htm -Every CRC expects a datawidth input which indicates what width in bits of data -will be fed into it. -} {-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE UndecidableInstances #-} module Clash.Cores.Crc.Catalog where import Clash.Prelude import Clash.Cores.Crc.Internal -data Crc3_gsm +data Crc3_gsm = Crc3_gsm deriving Show instance KnownCrc Crc3_gsm where type CrcWidth Crc3_gsm = 3 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3 , _crcInitial = 0x0 , _crcReflectInput = False @@ -32,12 +29,11 @@ instance KnownCrc Crc3_gsm where , _crcXorOutput = 0x7 } -data Crc3_rohc +data Crc3_rohc = Crc3_rohc deriving Show instance KnownCrc Crc3_rohc where type CrcWidth Crc3_rohc = 3 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3 , _crcInitial = 0x7 , _crcReflectInput = True @@ -45,26 +41,28 @@ instance KnownCrc Crc3_rohc where , _crcXorOutput = 0x0 } -data Crc4_g_704 +data Crc4_g_704 = Crc4_g_704 deriving Show instance KnownCrc Crc4_g_704 where type CrcWidth Crc4_g_704 = 4 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3 , _crcInitial = 0x0 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x0 } -type Crc4_itu = Crc4_g_704 -data Crc4_interlaken +data Crc4_itu = Crc4_itu deriving Show +instance KnownCrc Crc4_itu where + type CrcWidth Crc4_itu = CrcWidth Crc4_g_704 + crcParams _ = crcParams Crc4_g_704 + +data Crc4_interlaken = Crc4_interlaken deriving Show instance KnownCrc Crc4_interlaken where type CrcWidth Crc4_interlaken = 4 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3 , _crcInitial = 0xf , _crcReflectInput = False @@ -72,40 +70,45 @@ instance KnownCrc Crc4_interlaken where , _crcXorOutput = 0xf } -data Crc5_epc_c1g2 +data Crc5_epc_c1g2 = Crc5_epc_c1g2 deriving Show instance KnownCrc Crc5_epc_c1g2 where type CrcWidth Crc5_epc_c1g2 = 5 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x09 , _crcInitial = 0x09 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x00 } -type Crc5_epc = Crc5_epc_c1g2 -data Crc5_g_704 +data Crc5_epc = Crc5_epc deriving Show +instance KnownCrc Crc5_epc where + type CrcWidth Crc5_epc = CrcWidth Crc5_epc_c1g2 + crcParams _ = crcParams Crc5_epc_c1g2 + +data Crc5_g_704 = Crc5_g_704 deriving Show instance KnownCrc Crc5_g_704 where type CrcWidth Crc5_g_704 = 5 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x15 , _crcInitial = 0x00 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x00 } -type Crc5_itu = Crc5_g_704 -data Crc5_usb +data Crc5_itu = Crc5_itu deriving Show +instance KnownCrc Crc5_itu where + type CrcWidth Crc5_itu = CrcWidth Crc5_g_704 + crcParams _ = crcParams Crc5_g_704 + +data Crc5_usb = Crc5_usb deriving Show instance KnownCrc Crc5_usb where type CrcWidth Crc5_usb = 5 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x05 , _crcInitial = 0x1f , _crcReflectInput = True @@ -113,12 +116,11 @@ instance KnownCrc Crc5_usb where , _crcXorOutput = 0x1f } -data Crc6_cdma2000_a +data Crc6_cdma2000_a = Crc6_cdma2000_a deriving Show instance KnownCrc Crc6_cdma2000_a where type CrcWidth Crc6_cdma2000_a = 6 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x27 , _crcInitial = 0x3f , _crcReflectInput = False @@ -126,12 +128,11 @@ instance KnownCrc Crc6_cdma2000_a where , _crcXorOutput = 0x00 } -data Crc6_cdma2000_b +data Crc6_cdma2000_b = Crc6_cdma2000_b deriving Show instance KnownCrc Crc6_cdma2000_b where type CrcWidth Crc6_cdma2000_b = 6 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x07 , _crcInitial = 0x3f , _crcReflectInput = False @@ -139,12 +140,11 @@ instance KnownCrc Crc6_cdma2000_b where , _crcXorOutput = 0x00 } -data Crc6_darc +data Crc6_darc = Crc6_darc deriving Show instance KnownCrc Crc6_darc where type CrcWidth Crc6_darc = 6 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x19 , _crcInitial = 0x00 , _crcReflectInput = True @@ -152,26 +152,28 @@ instance KnownCrc Crc6_darc where , _crcXorOutput = 0x00 } -data Crc6_g_704 +data Crc6_g_704 = Crc6_g_704 deriving Show instance KnownCrc Crc6_g_704 where type CrcWidth Crc6_g_704 = 6 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x03 , _crcInitial = 0x00 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x00 } -type Crc6_itu = Crc6_g_704 -data Crc6_gsm +data Crc6_itu = Crc6_itu deriving Show +instance KnownCrc Crc6_itu where + type CrcWidth Crc6_itu = CrcWidth Crc6_g_704 + crcParams _ = crcParams Crc6_g_704 + +data Crc6_gsm = Crc6_gsm deriving Show instance KnownCrc Crc6_gsm where type CrcWidth Crc6_gsm = 6 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x2f , _crcInitial = 0x00 , _crcReflectInput = False @@ -179,12 +181,11 @@ instance KnownCrc Crc6_gsm where , _crcXorOutput = 0x3f } -data Crc7_mmc +data Crc7_mmc = Crc7_mmc deriving Show instance KnownCrc Crc7_mmc where type CrcWidth Crc7_mmc = 7 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x09 , _crcInitial = 0x00 , _crcReflectInput = False @@ -192,12 +193,11 @@ instance KnownCrc Crc7_mmc where , _crcXorOutput = 0x00 } -data Crc7_rohc +data Crc7_rohc = Crc7_rohc deriving Show instance KnownCrc Crc7_rohc where type CrcWidth Crc7_rohc = 7 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x4f , _crcInitial = 0x7f , _crcReflectInput = True @@ -205,12 +205,11 @@ instance KnownCrc Crc7_rohc where , _crcXorOutput = 0x00 } -data Crc7_umts +data Crc7_umts = Crc7_umts deriving Show instance KnownCrc Crc7_umts where type CrcWidth Crc7_umts = 7 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x45 , _crcInitial = 0x00 , _crcReflectInput = False @@ -218,12 +217,11 @@ instance KnownCrc Crc7_umts where , _crcXorOutput = 0x00 } -data Crc8_autosar +data Crc8_autosar = Crc8_autosar deriving Show instance KnownCrc Crc8_autosar where type CrcWidth Crc8_autosar = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x2f , _crcInitial = 0xff , _crcReflectInput = False @@ -231,12 +229,11 @@ instance KnownCrc Crc8_autosar where , _crcXorOutput = 0xff } -data Crc8_bluetooth +data Crc8_bluetooth = Crc8_bluetooth deriving Show instance KnownCrc Crc8_bluetooth where type CrcWidth Crc8_bluetooth = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xa7 , _crcInitial = 0x00 , _crcReflectInput = True @@ -244,12 +241,11 @@ instance KnownCrc Crc8_bluetooth where , _crcXorOutput = 0x00 } -data Crc8_cdma2000 +data Crc8_cdma2000 = Crc8_cdma2000 deriving Show instance KnownCrc Crc8_cdma2000 where type CrcWidth Crc8_cdma2000 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x9b , _crcInitial = 0xff , _crcReflectInput = False @@ -257,12 +253,11 @@ instance KnownCrc Crc8_cdma2000 where , _crcXorOutput = 0x00 } -data Crc8_darc +data Crc8_darc = Crc8_darc deriving Show instance KnownCrc Crc8_darc where type CrcWidth Crc8_darc = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x39 , _crcInitial = 0x00 , _crcReflectInput = True @@ -270,12 +265,11 @@ instance KnownCrc Crc8_darc where , _crcXorOutput = 0x00 } -data Crc8_dvb_s2 +data Crc8_dvb_s2 = Crc8_dvb_s2 deriving Show instance KnownCrc Crc8_dvb_s2 where type CrcWidth Crc8_dvb_s2 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xd5 , _crcInitial = 0x00 , _crcReflectInput = False @@ -283,12 +277,11 @@ instance KnownCrc Crc8_dvb_s2 where , _crcXorOutput = 0x00 } -data Crc8_gsm_a +data Crc8_gsm_a = Crc8_gsm_a deriving Show instance KnownCrc Crc8_gsm_a where type CrcWidth Crc8_gsm_a = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0x00 , _crcReflectInput = False @@ -296,12 +289,11 @@ instance KnownCrc Crc8_gsm_a where , _crcXorOutput = 0x00 } -data Crc8_gsm_b +data Crc8_gsm_b = Crc8_gsm_b deriving Show instance KnownCrc Crc8_gsm_b where type CrcWidth Crc8_gsm_b = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x49 , _crcInitial = 0x00 , _crcReflectInput = False @@ -309,12 +301,11 @@ instance KnownCrc Crc8_gsm_b where , _crcXorOutput = 0xff } -data Crc8_hitag +data Crc8_hitag = Crc8_hitag deriving Show instance KnownCrc Crc8_hitag where type CrcWidth Crc8_hitag = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0xff , _crcReflectInput = False @@ -322,26 +313,28 @@ instance KnownCrc Crc8_hitag where , _crcXorOutput = 0x00 } -data Crc8_i_432_1 +data Crc8_i_432_1 = Crc8_i_432_1 deriving Show instance KnownCrc Crc8_i_432_1 where type CrcWidth Crc8_i_432_1 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x07 , _crcInitial = 0x00 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x55 } -type Crc8_itu = Crc8_i_432_1 -data Crc8_i_code +data Crc8_itu = Crc8_itu deriving Show +instance KnownCrc Crc8_itu where + type CrcWidth Crc8_itu = CrcWidth Crc8_i_432_1 + crcParams _ = crcParams Crc8_i_432_1 + +data Crc8_i_code = Crc8_i_code deriving Show instance KnownCrc Crc8_i_code where type CrcWidth Crc8_i_code = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0xfd , _crcReflectInput = False @@ -349,12 +342,11 @@ instance KnownCrc Crc8_i_code where , _crcXorOutput = 0x00 } -data Crc8_lte +data Crc8_lte = Crc8_lte deriving Show instance KnownCrc Crc8_lte where type CrcWidth Crc8_lte = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x9b , _crcInitial = 0x00 , _crcReflectInput = False @@ -362,26 +354,28 @@ instance KnownCrc Crc8_lte where , _crcXorOutput = 0x00 } -data Crc8_maxim_dow +data Crc8_maxim_dow = Crc8_maxim_dow deriving Show instance KnownCrc Crc8_maxim_dow where type CrcWidth Crc8_maxim_dow = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x31 , _crcInitial = 0x00 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x00 } -type Crc8_maxim = Crc8_maxim_dow -data Crc8_mifare_mad +data Crc8_maxim = Crc8_maxim deriving Show +instance KnownCrc Crc8_maxim where + type CrcWidth Crc8_maxim = CrcWidth Crc8_maxim_dow + crcParams _ = crcParams Crc8_maxim_dow + +data Crc8_mifare_mad = Crc8_mifare_mad deriving Show instance KnownCrc Crc8_mifare_mad where type CrcWidth Crc8_mifare_mad = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0xc7 , _crcReflectInput = False @@ -389,12 +383,11 @@ instance KnownCrc Crc8_mifare_mad where , _crcXorOutput = 0x00 } -data Crc8_nrsc_5 +data Crc8_nrsc_5 = Crc8_nrsc_5 deriving Show instance KnownCrc Crc8_nrsc_5 where type CrcWidth Crc8_nrsc_5 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x31 , _crcInitial = 0xff , _crcReflectInput = False @@ -402,12 +395,11 @@ instance KnownCrc Crc8_nrsc_5 where , _crcXorOutput = 0x00 } -data Crc8_opensafety +data Crc8_opensafety = Crc8_opensafety deriving Show instance KnownCrc Crc8_opensafety where type CrcWidth Crc8_opensafety = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x2f , _crcInitial = 0x00 , _crcReflectInput = False @@ -415,12 +407,11 @@ instance KnownCrc Crc8_opensafety where , _crcXorOutput = 0x00 } -data Crc8_rohc +data Crc8_rohc = Crc8_rohc deriving Show instance KnownCrc Crc8_rohc where type CrcWidth Crc8_rohc = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x07 , _crcInitial = 0xff , _crcReflectInput = True @@ -428,12 +419,11 @@ instance KnownCrc Crc8_rohc where , _crcXorOutput = 0x00 } -data Crc8_sae_j1850 +data Crc8_sae_j1850 = Crc8_sae_j1850 deriving Show instance KnownCrc Crc8_sae_j1850 where type CrcWidth Crc8_sae_j1850 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0xff , _crcReflectInput = False @@ -441,12 +431,11 @@ instance KnownCrc Crc8_sae_j1850 where , _crcXorOutput = 0xff } -data Crc8_smbus +data Crc8_smbus = Crc8_smbus deriving Show instance KnownCrc Crc8_smbus where type CrcWidth Crc8_smbus = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x07 , _crcInitial = 0x00 , _crcReflectInput = False @@ -454,27 +443,33 @@ instance KnownCrc Crc8_smbus where , _crcXorOutput = 0x00 } -data Crc8_tech_3250 +data Crc8_tech_3250 = Crc8_tech_3250 deriving Show instance KnownCrc Crc8_tech_3250 where type CrcWidth Crc8_tech_3250 = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1d , _crcInitial = 0xff , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x00 } -type Crc8_aes = Crc8_tech_3250 -type Crc8_etu = Crc8_tech_3250 -data Crc8_wcdma +data Crc8_aes = Crc8_aes deriving Show +instance KnownCrc Crc8_aes where + type CrcWidth Crc8_aes = CrcWidth Crc8_tech_3250 + crcParams _ = crcParams Crc8_tech_3250 + +data Crc8_etu = Crc8_etu deriving Show +instance KnownCrc Crc8_etu where + type CrcWidth Crc8_etu = CrcWidth Crc8_tech_3250 + crcParams _ = crcParams Crc8_tech_3250 + +data Crc8_wcdma = Crc8_wcdma deriving Show instance KnownCrc Crc8_wcdma where type CrcWidth Crc8_wcdma = 8 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x9b , _crcInitial = 0x00 , _crcReflectInput = True @@ -482,26 +477,28 @@ instance KnownCrc Crc8_wcdma where , _crcXorOutput = 0x00 } -data Crc10_atm +data Crc10_atm = Crc10_atm deriving Show instance KnownCrc Crc10_atm where type CrcWidth Crc10_atm = 10 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x233 , _crcInitial = 0x000 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x000 } -type Crc10_i_610 = Crc10_atm -data Crc10_cdma2000 +data Crc10_i_610 = Crc10_i_610 deriving Show +instance KnownCrc Crc10_i_610 where + type CrcWidth Crc10_i_610 = CrcWidth Crc10_atm + crcParams _ = crcParams Crc10_atm + +data Crc10_cdma2000 = Crc10_cdma2000 deriving Show instance KnownCrc Crc10_cdma2000 where type CrcWidth Crc10_cdma2000 = 10 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3d9 , _crcInitial = 0x3ff , _crcReflectInput = False @@ -509,12 +506,11 @@ instance KnownCrc Crc10_cdma2000 where , _crcXorOutput = 0x000 } -data Crc10_gsm +data Crc10_gsm = Crc10_gsm deriving Show instance KnownCrc Crc10_gsm where type CrcWidth Crc10_gsm = 10 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x175 , _crcInitial = 0x000 , _crcReflectInput = False @@ -522,12 +518,11 @@ instance KnownCrc Crc10_gsm where , _crcXorOutput = 0x3ff } -data Crc11_flexray +data Crc11_flexray = Crc11_flexray deriving Show instance KnownCrc Crc11_flexray where type CrcWidth Crc11_flexray = 11 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x385 , _crcInitial = 0x01a , _crcReflectInput = False @@ -535,12 +530,11 @@ instance KnownCrc Crc11_flexray where , _crcXorOutput = 0x000 } -data Crc11_umts +data Crc11_umts = Crc11_umts deriving Show instance KnownCrc Crc11_umts where type CrcWidth Crc11_umts = 11 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x307 , _crcInitial = 0x000 , _crcReflectInput = False @@ -548,12 +542,11 @@ instance KnownCrc Crc11_umts where , _crcXorOutput = 0x000 } -data Crc12_cdma2000 +data Crc12_cdma2000 = Crc12_cdma2000 deriving Show instance KnownCrc Crc12_cdma2000 where type CrcWidth Crc12_cdma2000 = 12 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xf13 , _crcInitial = 0xfff , _crcReflectInput = False @@ -561,12 +554,11 @@ instance KnownCrc Crc12_cdma2000 where , _crcXorOutput = 0x000 } -data Crc12_dect +data Crc12_dect = Crc12_dect deriving Show instance KnownCrc Crc12_dect where type CrcWidth Crc12_dect = 12 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x80f , _crcInitial = 0x000 , _crcReflectInput = False @@ -574,12 +566,11 @@ instance KnownCrc Crc12_dect where , _crcXorOutput = 0x000 } -data Crc12_gsm +data Crc12_gsm = Crc12_gsm deriving Show instance KnownCrc Crc12_gsm where type CrcWidth Crc12_gsm = 12 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xd31 , _crcInitial = 0x000 , _crcReflectInput = False @@ -587,26 +578,28 @@ instance KnownCrc Crc12_gsm where , _crcXorOutput = 0xfff } -data Crc12_umts +data Crc12_umts = Crc12_umts deriving Show instance KnownCrc Crc12_umts where type CrcWidth Crc12_umts = 12 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x80f , _crcInitial = 0x000 , _crcReflectInput = False , _crcReflectOutput = True , _crcXorOutput = 0x000 } -type Crc12_3gpp = Crc12_umts -data Crc13_bbc +data Crc12_3gpp = Crc12_3gpp deriving Show +instance KnownCrc Crc12_3gpp where + type CrcWidth Crc12_3gpp = CrcWidth Crc12_umts + crcParams _ = crcParams Crc12_umts + +data Crc13_bbc = Crc13_bbc deriving Show instance KnownCrc Crc13_bbc where type CrcWidth Crc13_bbc = 13 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1cf5 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -614,12 +607,11 @@ instance KnownCrc Crc13_bbc where , _crcXorOutput = 0x0000 } -data Crc14_darc +data Crc14_darc = Crc14_darc deriving Show instance KnownCrc Crc14_darc where type CrcWidth Crc14_darc = 14 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x0805 , _crcInitial = 0x0000 , _crcReflectInput = True @@ -627,12 +619,11 @@ instance KnownCrc Crc14_darc where , _crcXorOutput = 0x0000 } -data Crc14_gsm +data Crc14_gsm = Crc14_gsm deriving Show instance KnownCrc Crc14_gsm where type CrcWidth Crc14_gsm = 14 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x202d , _crcInitial = 0x0000 , _crcReflectInput = False @@ -640,12 +631,11 @@ instance KnownCrc Crc14_gsm where , _crcXorOutput = 0x3fff } -data Crc15_can +data Crc15_can = Crc15_can deriving Show instance KnownCrc Crc15_can where type CrcWidth Crc15_can = 15 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x4599 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -653,12 +643,11 @@ instance KnownCrc Crc15_can where , _crcXorOutput = 0x0000 } -data Crc15_mpt1327 +data Crc15_mpt1327 = Crc15_mpt1327 deriving Show instance KnownCrc Crc15_mpt1327 where type CrcWidth Crc15_mpt1327 = 15 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x6815 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -666,26 +655,28 @@ instance KnownCrc Crc15_mpt1327 where , _crcXorOutput = 0x0001 } -data Crc16_arc +data Crc16_arc = Crc16_arc deriving Show instance KnownCrc Crc16_arc where type CrcWidth Crc16_arc = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0x0000 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x0000 } -type Crc16_ibm = Crc16_arc -data Crc16_cdma2000 +data Crc16_ibm = Crc16_ibm deriving Show +instance KnownCrc Crc16_ibm where + type CrcWidth Crc16_ibm = CrcWidth Crc16_arc + crcParams _ = crcParams Crc16_arc + +data Crc16_cdma2000 = Crc16_cdma2000 deriving Show instance KnownCrc Crc16_cdma2000 where type CrcWidth Crc16_cdma2000 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xc867 , _crcInitial = 0xffff , _crcReflectInput = False @@ -693,12 +684,11 @@ instance KnownCrc Crc16_cdma2000 where , _crcXorOutput = 0x0000 } -data Crc16_cms +data Crc16_cms = Crc16_cms deriving Show instance KnownCrc Crc16_cms where type CrcWidth Crc16_cms = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0xffff , _crcReflectInput = False @@ -706,12 +696,11 @@ instance KnownCrc Crc16_cms where , _crcXorOutput = 0x0000 } -data Crc16_dds_110 +data Crc16_dds_110 = Crc16_dds_110 deriving Show instance KnownCrc Crc16_dds_110 where type CrcWidth Crc16_dds_110 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0x800d , _crcReflectInput = False @@ -719,12 +708,11 @@ instance KnownCrc Crc16_dds_110 where , _crcXorOutput = 0x0000 } -data Crc16_dect_r +data Crc16_dect_r = Crc16_dect_r deriving Show instance KnownCrc Crc16_dect_r where type CrcWidth Crc16_dect_r = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x0589 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -732,12 +720,11 @@ instance KnownCrc Crc16_dect_r where , _crcXorOutput = 0x0001 } -data Crc16_dect_x +data Crc16_dect_x = Crc16_dect_x deriving Show instance KnownCrc Crc16_dect_x where type CrcWidth Crc16_dect_x = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x0589 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -745,12 +732,11 @@ instance KnownCrc Crc16_dect_x where , _crcXorOutput = 0x0000 } -data Crc16_dnp +data Crc16_dnp = Crc16_dnp deriving Show instance KnownCrc Crc16_dnp where type CrcWidth Crc16_dnp = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3d65 , _crcInitial = 0x0000 , _crcReflectInput = True @@ -758,12 +744,11 @@ instance KnownCrc Crc16_dnp where , _crcXorOutput = 0xffff } -data Crc16_en_13757 +data Crc16_en_13757 = Crc16_en_13757 deriving Show instance KnownCrc Crc16_en_13757 where type CrcWidth Crc16_en_13757 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x3d65 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -771,29 +756,43 @@ instance KnownCrc Crc16_en_13757 where , _crcXorOutput = 0xffff } -data Crc16_genibus +data Crc16_genibus = Crc16_genibus deriving Show instance KnownCrc Crc16_genibus where type CrcWidth Crc16_genibus = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xffff , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0xffff } -type Crc16_darc = Crc16_genibus -type Crc16_epc = Crc16_genibus -type Crc16_epc_c1g2 = Crc16_genibus -type Crc16_i_code = Crc16_genibus -data Crc16_gsm +data Crc16_darc = Crc16_darc deriving Show +instance KnownCrc Crc16_darc where + type CrcWidth Crc16_darc = CrcWidth Crc16_genibus + crcParams _ = crcParams Crc16_genibus + +data Crc16_epc = Crc16_epc deriving Show +instance KnownCrc Crc16_epc where + type CrcWidth Crc16_epc = CrcWidth Crc16_genibus + crcParams _ = crcParams Crc16_genibus + +data Crc16_epc_c1g2 = Crc16_epc_c1g2 deriving Show +instance KnownCrc Crc16_epc_c1g2 where + type CrcWidth Crc16_epc_c1g2 = CrcWidth Crc16_genibus + crcParams _ = crcParams Crc16_genibus + +data Crc16_i_code = Crc16_i_code deriving Show +instance KnownCrc Crc16_i_code where + type CrcWidth Crc16_i_code = CrcWidth Crc16_genibus + crcParams _ = crcParams Crc16_genibus + +data Crc16_gsm = Crc16_gsm deriving Show instance KnownCrc Crc16_gsm where type CrcWidth Crc16_gsm = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -801,43 +800,60 @@ instance KnownCrc Crc16_gsm where , _crcXorOutput = 0xffff } -data Crc16_ibm_3740 +data Crc16_ibm_3740 = Crc16_ibm_3740 deriving Show instance KnownCrc Crc16_ibm_3740 where type CrcWidth Crc16_ibm_3740 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xffff , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x0000 } -type Crc16_autosar = Crc16_ibm_3740 -type Crc16_ccitt_false = Crc16_ibm_3740 -data Crc16_ibm_sdlc +data Crc16_autosar = Crc16_autosar deriving Show +instance KnownCrc Crc16_autosar where + type CrcWidth Crc16_autosar = CrcWidth Crc16_ibm_3740 + crcParams _ = crcParams Crc16_ibm_3740 + +data Crc16_ccitt_false = Crc16_ccitt_false deriving Show +instance KnownCrc Crc16_ccitt_false where + type CrcWidth Crc16_ccitt_false = CrcWidth Crc16_ibm_3740 + crcParams _ = crcParams Crc16_ibm_3740 + +data Crc16_ibm_sdlc = Crc16_ibm_sdlc deriving Show instance KnownCrc Crc16_ibm_sdlc where type CrcWidth Crc16_ibm_sdlc = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xffff , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0xffff } -type Crc16_iso_hdlc = Crc16_ibm_sdlc -type Crc16_iso_iec_14443_3_b = Crc16_ibm_sdlc -type Crc16_x25 = Crc16_ibm_sdlc -data Crc16_iso_iec_14443_3_a +data Crc16_iso_hdlc = Crc16_iso_hdlc deriving Show +instance KnownCrc Crc16_iso_hdlc where + type CrcWidth Crc16_iso_hdlc = CrcWidth Crc16_ibm_sdlc + crcParams _ = crcParams Crc16_ibm_sdlc + +data Crc16_iso_iec_14443_3_b = Crc16_iso_iec_14443_3_b deriving Show +instance KnownCrc Crc16_iso_iec_14443_3_b where + type CrcWidth Crc16_iso_iec_14443_3_b = CrcWidth Crc16_ibm_sdlc + crcParams _ = crcParams Crc16_ibm_sdlc + +data Crc16_x25 = Crc16_x25 deriving Show +instance KnownCrc Crc16_x25 where + type CrcWidth Crc16_x25 = CrcWidth Crc16_ibm_sdlc + crcParams _ = crcParams Crc16_ibm_sdlc + +data Crc16_iso_iec_14443_3_a = Crc16_iso_iec_14443_3_a deriving Show instance KnownCrc Crc16_iso_iec_14443_3_a where type CrcWidth Crc16_iso_iec_14443_3_a = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xc6c6 , _crcReflectInput = True @@ -845,29 +861,43 @@ instance KnownCrc Crc16_iso_iec_14443_3_a where , _crcXorOutput = 0x0000 } -data Crc16_kermit +data Crc16_kermit = Crc16_kermit deriving Show instance KnownCrc Crc16_kermit where type CrcWidth Crc16_kermit = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0x0000 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0x0000 } -type Crc16_bluetooth = Crc16_kermit -type Crc16_ccitt = Crc16_kermit -type Crc16_ccitt_true = Crc16_kermit -type Crc16_v_41_lsb = Crc16_kermit -data Crc16_lj1200 +data Crc16_bluetooth = Crc16_bluetooth deriving Show +instance KnownCrc Crc16_bluetooth where + type CrcWidth Crc16_bluetooth = CrcWidth Crc16_kermit + crcParams _ = crcParams Crc16_kermit + +data Crc16_ccitt = Crc16_ccitt deriving Show +instance KnownCrc Crc16_ccitt where + type CrcWidth Crc16_ccitt = CrcWidth Crc16_kermit + crcParams _ = crcParams Crc16_kermit + +data Crc16_ccitt_true = Crc16_ccitt_true deriving Show +instance KnownCrc Crc16_ccitt_true where + type CrcWidth Crc16_ccitt_true = CrcWidth Crc16_kermit + crcParams _ = crcParams Crc16_kermit + +data Crc16_v_41_lsb = Crc16_v_41_lsb deriving Show +instance KnownCrc Crc16_v_41_lsb where + type CrcWidth Crc16_v_41_lsb = CrcWidth Crc16_kermit + crcParams _ = crcParams Crc16_kermit + +data Crc16_lj1200 = Crc16_lj1200 deriving Show instance KnownCrc Crc16_lj1200 where type CrcWidth Crc16_lj1200 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x6f63 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -875,12 +905,11 @@ instance KnownCrc Crc16_lj1200 where , _crcXorOutput = 0x0000 } -data Crc16_m17 +data Crc16_m17 = Crc16_m17 deriving Show instance KnownCrc Crc16_m17 where type CrcWidth Crc16_m17 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x5935 , _crcInitial = 0xffff , _crcReflectInput = False @@ -888,26 +917,28 @@ instance KnownCrc Crc16_m17 where , _crcXorOutput = 0x0000 } -data Crc16_maxim_dow +data Crc16_maxim_dow = Crc16_maxim_dow deriving Show instance KnownCrc Crc16_maxim_dow where type CrcWidth Crc16_maxim_dow = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0x0000 , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0xffff } -type Crc16_maxim = Crc16_maxim_dow -data Crc16_mcrf4xx +data Crc16_maxim = Crc16_maxim deriving Show +instance KnownCrc Crc16_maxim where + type CrcWidth Crc16_maxim = CrcWidth Crc16_maxim_dow + crcParams _ = crcParams Crc16_maxim_dow + +data Crc16_mcrf4xx = Crc16_mcrf4xx deriving Show instance KnownCrc Crc16_mcrf4xx where type CrcWidth Crc16_mcrf4xx = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xffff , _crcReflectInput = True @@ -915,12 +946,11 @@ instance KnownCrc Crc16_mcrf4xx where , _crcXorOutput = 0x0000 } -data Crc16_modbus +data Crc16_modbus = Crc16_modbus deriving Show instance KnownCrc Crc16_modbus where type CrcWidth Crc16_modbus = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0xffff , _crcReflectInput = True @@ -928,12 +958,11 @@ instance KnownCrc Crc16_modbus where , _crcXorOutput = 0x0000 } -data Crc16_nrsc_5 +data Crc16_nrsc_5 = Crc16_nrsc_5 deriving Show instance KnownCrc Crc16_nrsc_5 where type CrcWidth Crc16_nrsc_5 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x080b , _crcInitial = 0xffff , _crcReflectInput = True @@ -941,12 +970,11 @@ instance KnownCrc Crc16_nrsc_5 where , _crcXorOutput = 0x0000 } -data Crc16_opensafety_a +data Crc16_opensafety_a = Crc16_opensafety_a deriving Show instance KnownCrc Crc16_opensafety_a where type CrcWidth Crc16_opensafety_a = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x5935 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -954,12 +982,11 @@ instance KnownCrc Crc16_opensafety_a where , _crcXorOutput = 0x0000 } -data Crc16_opensafety_b +data Crc16_opensafety_b = Crc16_opensafety_b deriving Show instance KnownCrc Crc16_opensafety_b where type CrcWidth Crc16_opensafety_b = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x755b , _crcInitial = 0x0000 , _crcReflectInput = False @@ -967,26 +994,28 @@ instance KnownCrc Crc16_opensafety_b where , _crcXorOutput = 0x0000 } -data Crc16_profibus +data Crc16_profibus = Crc16_profibus deriving Show instance KnownCrc Crc16_profibus where type CrcWidth Crc16_profibus = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1dcf , _crcInitial = 0xffff , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0xffff } -type Crc16_iec_61158_2 = Crc16_profibus -data Crc16_riello +data Crc16_iec_61158_2 = Crc16_iec_61158_2 deriving Show +instance KnownCrc Crc16_iec_61158_2 where + type CrcWidth Crc16_iec_61158_2 = CrcWidth Crc16_profibus + crcParams _ = crcParams Crc16_profibus + +data Crc16_riello = Crc16_riello deriving Show instance KnownCrc Crc16_riello where type CrcWidth Crc16_riello = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0xb2aa , _crcReflectInput = True @@ -994,26 +1023,28 @@ instance KnownCrc Crc16_riello where , _crcXorOutput = 0x0000 } -data Crc16_spi_fujitsu +data Crc16_spi_fujitsu = Crc16_spi_fujitsu deriving Show instance KnownCrc Crc16_spi_fujitsu where type CrcWidth Crc16_spi_fujitsu = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0x1d0f , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x0000 } -type Crc16_aug_ccitt = Crc16_spi_fujitsu -data Crc16_t10_dif +data Crc16_aug_ccitt = Crc16_aug_ccitt deriving Show +instance KnownCrc Crc16_aug_ccitt where + type CrcWidth Crc16_aug_ccitt = CrcWidth Crc16_spi_fujitsu + crcParams _ = crcParams Crc16_spi_fujitsu + +data Crc16_t10_dif = Crc16_t10_dif deriving Show instance KnownCrc Crc16_t10_dif where type CrcWidth Crc16_t10_dif = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8bb7 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -1021,12 +1052,11 @@ instance KnownCrc Crc16_t10_dif where , _crcXorOutput = 0x0000 } -data Crc16_teledisk +data Crc16_teledisk = Crc16_teledisk deriving Show instance KnownCrc Crc16_teledisk where type CrcWidth Crc16_teledisk = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xa097 , _crcInitial = 0x0000 , _crcReflectInput = False @@ -1034,12 +1064,11 @@ instance KnownCrc Crc16_teledisk where , _crcXorOutput = 0x0000 } -data Crc16_tms37157 +data Crc16_tms37157 = Crc16_tms37157 deriving Show instance KnownCrc Crc16_tms37157 where type CrcWidth Crc16_tms37157 = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0x89ec , _crcReflectInput = True @@ -1047,27 +1076,33 @@ instance KnownCrc Crc16_tms37157 where , _crcXorOutput = 0x0000 } -data Crc16_umts +data Crc16_umts = Crc16_umts deriving Show instance KnownCrc Crc16_umts where type CrcWidth Crc16_umts = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0x0000 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x0000 } -type Crc16_verifone = Crc16_umts -type Crc16_buypass = Crc16_umts -data Crc16_usb +data Crc16_verifone = Crc16_verifone deriving Show +instance KnownCrc Crc16_verifone where + type CrcWidth Crc16_verifone = CrcWidth Crc16_umts + crcParams _ = crcParams Crc16_umts + +data Crc16_buypass = Crc16_buypass deriving Show +instance KnownCrc Crc16_buypass where + type CrcWidth Crc16_buypass = CrcWidth Crc16_umts + crcParams _ = crcParams Crc16_umts + +data Crc16_usb = Crc16_usb deriving Show instance KnownCrc Crc16_usb where type CrcWidth Crc16_usb = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8005 , _crcInitial = 0xffff , _crcReflectInput = True @@ -1075,29 +1110,43 @@ instance KnownCrc Crc16_usb where , _crcXorOutput = 0xffff } -data Crc16_xmodem +data Crc16_xmodem = Crc16_xmodem deriving Show instance KnownCrc Crc16_xmodem where type CrcWidth Crc16_xmodem = 16 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1021 , _crcInitial = 0x0000 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0x0000 } -type Crc16_acorn = Crc16_xmodem -type Crc16_lte = Crc16_xmodem -type Crc16_v_41_msb = Crc16_xmodem -type Crc16_zmodem = Crc16_xmodem -data Crc17_can_fd +data Crc16_acorn = Crc16_acorn deriving Show +instance KnownCrc Crc16_acorn where + type CrcWidth Crc16_acorn = CrcWidth Crc16_xmodem + crcParams _ = crcParams Crc16_xmodem + +data Crc16_lte = Crc16_lte deriving Show +instance KnownCrc Crc16_lte where + type CrcWidth Crc16_lte = CrcWidth Crc16_xmodem + crcParams _ = crcParams Crc16_xmodem + +data Crc16_v_41_msb = Crc16_v_41_msb deriving Show +instance KnownCrc Crc16_v_41_msb where + type CrcWidth Crc16_v_41_msb = CrcWidth Crc16_xmodem + crcParams _ = crcParams Crc16_xmodem + +data Crc16_zmodem = Crc16_zmodem deriving Show +instance KnownCrc Crc16_zmodem where + type CrcWidth Crc16_zmodem = CrcWidth Crc16_xmodem + crcParams _ = crcParams Crc16_xmodem + +data Crc17_can_fd = Crc17_can_fd deriving Show instance KnownCrc Crc17_can_fd where type CrcWidth Crc17_can_fd = 17 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1685b , _crcInitial = 0x00000 , _crcReflectInput = False @@ -1105,12 +1154,11 @@ instance KnownCrc Crc17_can_fd where , _crcXorOutput = 0x00000 } -data Crc21_can_fd +data Crc21_can_fd = Crc21_can_fd deriving Show instance KnownCrc Crc21_can_fd where type CrcWidth Crc21_can_fd = 21 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x102899 , _crcInitial = 0x000000 , _crcReflectInput = False @@ -1118,12 +1166,11 @@ instance KnownCrc Crc21_can_fd where , _crcXorOutput = 0x000000 } -data Crc24_ble +data Crc24_ble = Crc24_ble deriving Show instance KnownCrc Crc24_ble where type CrcWidth Crc24_ble = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x00065b , _crcInitial = 0x555555 , _crcReflectInput = True @@ -1131,12 +1178,11 @@ instance KnownCrc Crc24_ble where , _crcXorOutput = 0x000000 } -data Crc24_flexray_a +data Crc24_flexray_a = Crc24_flexray_a deriving Show instance KnownCrc Crc24_flexray_a where type CrcWidth Crc24_flexray_a = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x5d6dcb , _crcInitial = 0xfedcba , _crcReflectInput = False @@ -1144,12 +1190,11 @@ instance KnownCrc Crc24_flexray_a where , _crcXorOutput = 0x000000 } -data Crc24_flexray_b +data Crc24_flexray_b = Crc24_flexray_b deriving Show instance KnownCrc Crc24_flexray_b where type CrcWidth Crc24_flexray_b = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x5d6dcb , _crcInitial = 0xabcdef , _crcReflectInput = False @@ -1157,12 +1202,11 @@ instance KnownCrc Crc24_flexray_b where , _crcXorOutput = 0x000000 } -data Crc24_interlaken +data Crc24_interlaken = Crc24_interlaken deriving Show instance KnownCrc Crc24_interlaken where type CrcWidth Crc24_interlaken = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x328b63 , _crcInitial = 0xffffff , _crcReflectInput = False @@ -1170,12 +1214,11 @@ instance KnownCrc Crc24_interlaken where , _crcXorOutput = 0xffffff } -data Crc24_lte_a +data Crc24_lte_a = Crc24_lte_a deriving Show instance KnownCrc Crc24_lte_a where type CrcWidth Crc24_lte_a = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x864cfb , _crcInitial = 0x000000 , _crcReflectInput = False @@ -1183,12 +1226,11 @@ instance KnownCrc Crc24_lte_a where , _crcXorOutput = 0x000000 } -data Crc24_lte_b +data Crc24_lte_b = Crc24_lte_b deriving Show instance KnownCrc Crc24_lte_b where type CrcWidth Crc24_lte_b = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x800063 , _crcInitial = 0x000000 , _crcReflectInput = False @@ -1196,12 +1238,11 @@ instance KnownCrc Crc24_lte_b where , _crcXorOutput = 0x000000 } -data Crc24_openpgp +data Crc24_openpgp = Crc24_openpgp deriving Show instance KnownCrc Crc24_openpgp where type CrcWidth Crc24_openpgp = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x864cfb , _crcInitial = 0xb704ce , _crcReflectInput = False @@ -1209,12 +1250,11 @@ instance KnownCrc Crc24_openpgp where , _crcXorOutput = 0x000000 } -data Crc24_os_9 +data Crc24_os_9 = Crc24_os_9 deriving Show instance KnownCrc Crc24_os_9 where type CrcWidth Crc24_os_9 = 24 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x800063 , _crcInitial = 0xffffff , _crcReflectInput = False @@ -1222,12 +1262,11 @@ instance KnownCrc Crc24_os_9 where , _crcXorOutput = 0xffffff } -data Crc30_cdma +data Crc30_cdma = Crc30_cdma deriving Show instance KnownCrc Crc30_cdma where type CrcWidth Crc30_cdma = 30 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x2030b9c7 , _crcInitial = 0x3fffffff , _crcReflectInput = False @@ -1235,12 +1274,11 @@ instance KnownCrc Crc30_cdma where , _crcXorOutput = 0x3fffffff } -data Crc31_philips +data Crc31_philips = Crc31_philips deriving Show instance KnownCrc Crc31_philips where type CrcWidth Crc31_philips = 31 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0x7fffffff , _crcReflectInput = False @@ -1248,12 +1286,11 @@ instance KnownCrc Crc31_philips where , _crcXorOutput = 0x7fffffff } -data Crc32_aixm +data Crc32_aixm = Crc32_aixm deriving Show instance KnownCrc Crc32_aixm where type CrcWidth Crc32_aixm = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x814141ab , _crcInitial = 0x00000000 , _crcReflectInput = False @@ -1261,12 +1298,11 @@ instance KnownCrc Crc32_aixm where , _crcXorOutput = 0x00000000 } -data Crc32_autosar +data Crc32_autosar = Crc32_autosar deriving Show instance KnownCrc Crc32_autosar where type CrcWidth Crc32_autosar = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xf4acfb13 , _crcInitial = 0xffffffff , _crcReflectInput = True @@ -1274,12 +1310,11 @@ instance KnownCrc Crc32_autosar where , _crcXorOutput = 0xffffffff } -data Crc32_base91_d +data Crc32_base91_d = Crc32_base91_d deriving Show instance KnownCrc Crc32_base91_d where type CrcWidth Crc32_base91_d = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xa833982b , _crcInitial = 0xffffffff , _crcReflectInput = True @@ -1287,27 +1322,33 @@ instance KnownCrc Crc32_base91_d where , _crcXorOutput = 0xffffffff } -data Crc32_bzip2 +data Crc32_bzip2 = Crc32_bzip2 deriving Show instance KnownCrc Crc32_bzip2 where type CrcWidth Crc32_bzip2 = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0xffffffff , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0xffffffff } -type Crc32_aal5 = Crc32_bzip2 -type Crc32_dect_b = Crc32_bzip2 -data Crc32_cd_rom_edc +data Crc32_aal5 = Crc32_aal5 deriving Show +instance KnownCrc Crc32_aal5 where + type CrcWidth Crc32_aal5 = CrcWidth Crc32_bzip2 + crcParams _ = crcParams Crc32_bzip2 + +data Crc32_dect_b = Crc32_dect_b deriving Show +instance KnownCrc Crc32_dect_b where + type CrcWidth Crc32_dect_b = CrcWidth Crc32_bzip2 + crcParams _ = crcParams Crc32_bzip2 + +data Crc32_cd_rom_edc = Crc32_cd_rom_edc deriving Show instance KnownCrc Crc32_cd_rom_edc where type CrcWidth Crc32_cd_rom_edc = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x8001801b , _crcInitial = 0x00000000 , _crcReflectInput = True @@ -1315,60 +1356,92 @@ instance KnownCrc Crc32_cd_rom_edc where , _crcXorOutput = 0x00000000 } -data Crc32_cksum +data Crc32_cksum = Crc32_cksum deriving Show instance KnownCrc Crc32_cksum where type CrcWidth Crc32_cksum = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0x00000000 , _crcReflectInput = False , _crcReflectOutput = False , _crcXorOutput = 0xffffffff } -type Crc32_posix = Crc32_cksum -data Crc32_iscsi +data Crc32_posix = Crc32_posix deriving Show +instance KnownCrc Crc32_posix where + type CrcWidth Crc32_posix = CrcWidth Crc32_cksum + crcParams _ = crcParams Crc32_cksum + +data Crc32_iscsi = Crc32_iscsi deriving Show instance KnownCrc Crc32_iscsi where type CrcWidth Crc32_iscsi = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x1edc6f41 , _crcInitial = 0xffffffff , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0xffffffff } -type Crc32_base91_c = Crc32_iscsi -type Crc32_castagnoli = Crc32_iscsi -type Crc32_interlaken = Crc32_iscsi -data Crc32_iso_hdlc +data Crc32_base91_c = Crc32_base91_c deriving Show +instance KnownCrc Crc32_base91_c where + type CrcWidth Crc32_base91_c = CrcWidth Crc32_iscsi + crcParams _ = crcParams Crc32_iscsi + +data Crc32_castagnoli = Crc32_castagnoli deriving Show +instance KnownCrc Crc32_castagnoli where + type CrcWidth Crc32_castagnoli = CrcWidth Crc32_iscsi + crcParams _ = crcParams Crc32_iscsi + +data Crc32_interlaken = Crc32_interlaken deriving Show +instance KnownCrc Crc32_interlaken where + type CrcWidth Crc32_interlaken = CrcWidth Crc32_iscsi + crcParams _ = crcParams Crc32_iscsi + +data Crc32_iso_hdlc = Crc32_iso_hdlc deriving Show instance KnownCrc Crc32_iso_hdlc where type CrcWidth Crc32_iso_hdlc = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0xffffffff , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0xffffffff } -type Crc32_adccp = Crc32_iso_hdlc -type Crc32_v_42 = Crc32_iso_hdlc -type Crc32_xz = Crc32_iso_hdlc -type Crc32_pkzip = Crc32_iso_hdlc -type Crc32_ethernet = Crc32_iso_hdlc -data Crc32_jamcrc +data Crc32_adccp = Crc32_adccp deriving Show +instance KnownCrc Crc32_adccp where + type CrcWidth Crc32_adccp = CrcWidth Crc32_iso_hdlc + crcParams _ = crcParams Crc32_iso_hdlc + +data Crc32_v_42 = Crc32_v_42 deriving Show +instance KnownCrc Crc32_v_42 where + type CrcWidth Crc32_v_42 = CrcWidth Crc32_iso_hdlc + crcParams _ = crcParams Crc32_iso_hdlc + +data Crc32_xz = Crc32_xz deriving Show +instance KnownCrc Crc32_xz where + type CrcWidth Crc32_xz = CrcWidth Crc32_iso_hdlc + crcParams _ = crcParams Crc32_iso_hdlc + +data Crc32_pkzip = Crc32_pkzip deriving Show +instance KnownCrc Crc32_pkzip where + type CrcWidth Crc32_pkzip = CrcWidth Crc32_iso_hdlc + crcParams _ = crcParams Crc32_iso_hdlc + +data Crc32_ethernet = Crc32_ethernet deriving Show +instance KnownCrc Crc32_ethernet where + type CrcWidth Crc32_ethernet = CrcWidth Crc32_iso_hdlc + crcParams _ = crcParams Crc32_iso_hdlc + +data Crc32_jamcrc = Crc32_jamcrc deriving Show instance KnownCrc Crc32_jamcrc where type CrcWidth Crc32_jamcrc = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0xffffffff , _crcReflectInput = True @@ -1376,12 +1449,11 @@ instance KnownCrc Crc32_jamcrc where , _crcXorOutput = 0x00000000 } -data Crc32_mef +data Crc32_mef = Crc32_mef deriving Show instance KnownCrc Crc32_mef where type CrcWidth Crc32_mef = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x741b8cd7 , _crcInitial = 0xffffffff , _crcReflectInput = True @@ -1389,12 +1461,11 @@ instance KnownCrc Crc32_mef where , _crcXorOutput = 0x00000000 } -data Crc32_mpeg_2 +data Crc32_mpeg_2 = Crc32_mpeg_2 deriving Show instance KnownCrc Crc32_mpeg_2 where type CrcWidth Crc32_mpeg_2 = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x04c11db7 , _crcInitial = 0xffffffff , _crcReflectInput = False @@ -1402,12 +1473,11 @@ instance KnownCrc Crc32_mpeg_2 where , _crcXorOutput = 0x00000000 } -data Crc32_xfer +data Crc32_xfer = Crc32_xfer deriving Show instance KnownCrc Crc32_xfer where type CrcWidth Crc32_xfer = 32 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x000000af , _crcInitial = 0x00000000 , _crcReflectInput = False @@ -1415,12 +1485,11 @@ instance KnownCrc Crc32_xfer where , _crcXorOutput = 0x00000000 } -data Crc40_gsm +data Crc40_gsm = Crc40_gsm deriving Show instance KnownCrc Crc40_gsm where type CrcWidth Crc40_gsm = 40 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x0004820009 , _crcInitial = 0x0000000000 , _crcReflectInput = False @@ -1428,12 +1497,11 @@ instance KnownCrc Crc40_gsm where , _crcXorOutput = 0xffffffffff } -data Crc64_ecma_182 +data Crc64_ecma_182 = Crc64_ecma_182 deriving Show instance KnownCrc Crc64_ecma_182 where type CrcWidth Crc64_ecma_182 = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x42f0e1eba9ea3693 , _crcInitial = 0x0000000000000000 , _crcReflectInput = False @@ -1441,12 +1509,11 @@ instance KnownCrc Crc64_ecma_182 where , _crcXorOutput = 0x0000000000000000 } -data Crc64_go_iso +data Crc64_go_iso = Crc64_go_iso deriving Show instance KnownCrc Crc64_go_iso where type CrcWidth Crc64_go_iso = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x000000000000001b , _crcInitial = 0xffffffffffffffff , _crcReflectInput = True @@ -1454,12 +1521,11 @@ instance KnownCrc Crc64_go_iso where , _crcXorOutput = 0xffffffffffffffff } -data Crc64_ms +data Crc64_ms = Crc64_ms deriving Show instance KnownCrc Crc64_ms where type CrcWidth Crc64_ms = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x259c84cba6426349 , _crcInitial = 0xffffffffffffffff , _crcReflectInput = True @@ -1467,12 +1533,11 @@ instance KnownCrc Crc64_ms where , _crcXorOutput = 0x0000000000000000 } -data Crc64_redis +data Crc64_redis = Crc64_redis deriving Show instance KnownCrc Crc64_redis where type CrcWidth Crc64_redis = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0xad93d23594c935a9 , _crcInitial = 0x0000000000000000 , _crcReflectInput = True @@ -1480,12 +1545,11 @@ instance KnownCrc Crc64_redis where , _crcXorOutput = 0x0000000000000000 } -data Crc64_we +data Crc64_we = Crc64_we deriving Show instance KnownCrc Crc64_we where type CrcWidth Crc64_we = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x42f0e1eba9ea3693 , _crcInitial = 0xffffffffffffffff , _crcReflectInput = False @@ -1493,26 +1557,28 @@ instance KnownCrc Crc64_we where , _crcXorOutput = 0xffffffffffffffff } -data Crc64_xz +data Crc64_xz = Crc64_xz deriving Show instance KnownCrc Crc64_xz where type CrcWidth Crc64_xz = 64 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x42f0e1eba9ea3693 , _crcInitial = 0xffffffffffffffff , _crcReflectInput = True , _crcReflectOutput = True , _crcXorOutput = 0xffffffffffffffff } -type Crc64_ecma = Crc64_xz -data Crc82_darc +data Crc64_ecma = Crc64_ecma deriving Show +instance KnownCrc Crc64_ecma where + type CrcWidth Crc64_ecma = CrcWidth Crc64_xz + crcParams _ = crcParams Crc64_xz + +data Crc82_darc = Crc82_darc deriving Show instance KnownCrc Crc82_darc where type CrcWidth Crc82_darc = 82 - crcParams _ dataWidth = CrcParams + crcParams _ = CrcParams { _crcWidth = SNat - , _crcDataWidth = dataWidth , _crcPolynomial = 0x0308c0111011401440411 , _crcInitial = 0x000000000000000000000 , _crcReflectInput = True diff --git a/clash-cores/src/Clash/Cores/Crc/Internal.hs b/clash-cores/src/Clash/Cores/Crc/Internal.hs index 592e2b5f10..02ed954c63 100644 --- a/clash-cores/src/Clash/Cores/Crc/Internal.hs +++ b/clash-cores/src/Clash/Cores/Crc/Internal.hs @@ -1,8 +1,14 @@ {-| - Copyright : (C) 2024, Rowan Goemans + Copyright : (C) 2023, Amaranth HDL contributors + 2024, Rowan Goemans License : BSD2 (see the file LICENSE) Maintainer : QBayLogic B.V. +This is partially based on the [Amaranth CRC core](https://github.com/amaranth-lang/amaranth/blob/main/amaranth/lib/crc/__init__.py) + +The algorithm for the Software CRC and the computation of the FG Matrices were +rewritten directly from their sources. + -} {-# LANGUAGE RecordWildCards #-} @@ -30,13 +36,11 @@ import qualified Language.Haskell.TH.Syntax as TH import Type.Reflection -- | Contains all the parameters to generate a CRC implementation -data CrcParams (crcWidth :: Nat) (dataWidth :: Nat) +data CrcParams (crcWidth :: Nat) = CrcParams { _crcWidth :: SNat crcWidth -- ^ Bit width of CRC word. Also known as "width" in the Williams model. -- See http://techref.massmind.org/techref/method/math/crcguide.html - , _crcDataWidth :: SNat dataWidth - -- ^ Bit width of data words , _crcPolynomial :: BitVector crcWidth -- ^ CRC polynomial to use, without the implicit -- @x^crc_width@ term. Polynomial is always specified with the highest @@ -64,7 +68,7 @@ data CrcParams (crcWidth :: Nat) (dataWidth :: Nat) deriving (Generic, Show, ShowX, Lift) -- | No domain in 'CrcParams' -type instance TryDomain t (CrcParams crcWidth dataWidth) = 'NotFound +type instance TryDomain t (CrcParams crcWidth) = 'NotFound -- | This class is used to define CRCs -- @@ -72,31 +76,31 @@ type instance TryDomain t (CrcParams crcWidth dataWidth) = 'NotFound -- create a 'KnownCrc' instance for that type which contains your CRC parameters: -- -- @ --- data MyCrc +-- data MyCrc = MyCrc -- instance KnownCrc MyCrc where --- type CrcWidth MyCrc = ... --- crcParams _ dataWidth = CrcParams --- { _crcWidth = SNat --- , _crcDataWidth = dataWidth --- , _crcPolynomial = .. --- , _crcInitial = .. --- , _crcReflectInput = .. --- , _crcReflectOutput = .. --- , _crcXorOutput = .. --- } +-- type CrcWidth MyCrc = ... +-- crcParams _ = CrcParams +-- { _crcWidth = SNat +-- , _crcPolynomial = .. +-- , _crcInitial = .. +-- , _crcReflectInput = .. +-- , _crcReflectOutput = .. +-- , _crcXorOutput = .. +-- } -- @ -- -- See "Clash.Cores.Crc.Catalog" for many definition examples. class (KnownNat (CrcWidth crc), 1 <= (CrcWidth crc)) => KnownCrc (crc :: Type) where type CrcWidth crc :: Nat - crcParams :: Proxy crc -> SNat dataWidth -> CrcParams (CrcWidth crc) dataWidth + crcParams :: crc -> CrcParams (CrcWidth crc) -- | Allow one to compute values for the CRC -- -- __NB__: NOT for use in hardware data SoftwareCrc (crcWidth :: Nat) (dataWidth :: Nat) = SoftwareCrc - { _crcParams :: CrcParams crcWidth dataWidth + { _crcParams :: CrcParams crcWidth + , _crcDataWidth :: SNat dataWidth , _crcTopBitMask :: BitVector (crcWidth + dataWidth) , _crcpolyShifted :: BitVector (crcWidth + dataWidth) , _crcCurrent :: BitVector (crcWidth + dataWidth) @@ -133,11 +137,12 @@ reverseBV = v2bv . reverse . bv2v -- __NB__: NOT for use in hardware mkSoftwareCrcFromParams :: forall (crcWidth :: Nat) (dataWidth :: Nat) - . CrcParams crcWidth dataWidth + . CrcParams crcWidth + -> SNat dataWidth -> SoftwareCrc crcWidth dataWidth -mkSoftwareCrcFromParams _crcParams@CrcParams{..} = go _crcParams +mkSoftwareCrcFromParams _crcParams@CrcParams{..} _crcDataWidth@SNat = go _crcParams where - go (CrcParams SNat SNat _ _ _ _ _) = reset $ SoftwareCrc { .. } + go (CrcParams SNat _ _ _ _ _) = reset $ SoftwareCrc { .. } where combSNat = addSNat _crcWidth _crcDataWidth _crcTopBitMask = shiftL 1 (snatToNum combSNat - 1) @@ -150,12 +155,12 @@ mkSoftwareCrcFromParams _crcParams@CrcParams{..} = go _crcParams mkSoftwareCrc :: forall (crc :: Type) (dataWidth :: Nat) . KnownCrc crc - => Proxy crc + => crc -- ^ The CRC to use -> SNat dataWidth -- ^ The @dataWidth@ of the words to feed -> SoftwareCrc (CrcWidth crc) dataWidth -mkSoftwareCrc p dataWidth = mkSoftwareCrcFromParams $ crcParams p dataWidth +mkSoftwareCrc crc dataWidth = mkSoftwareCrcFromParams (crcParams crc) dataWidth -- | Reset the 'SoftwareCrc'. If you want to reuse it for multiple messages -- you need to reset it in between messages. @@ -165,10 +170,10 @@ reset -- ^ Current CRC engine -> SoftwareCrc crcWidth dataWidth -- ^ CRC engine fresh to be used -reset engine@(SoftwareCrc {..}) = go _crcParams +reset engine@(SoftwareCrc {..}) = go _crcDataWidth _crcParams where CrcParams {..} = _crcParams - go (CrcParams SNat SNat _ _ _ _ _) = engine { _crcCurrent = initialCrc } + go SNat (CrcParams SNat _ _ _ _ _) = engine { _crcCurrent = initialCrc } where initial :: BitVector (crcWidth + dataWidth) initial = extend _crcInitial @@ -183,16 +188,16 @@ feed -- ^ Update 'SoftwareCrc' with this input -> SoftwareCrc crcWidth dataWidth -- ^ 'SoftwareCrc' with update processed -feed engine@(SoftwareCrc {..}) word = go _crcParams +feed engine@(SoftwareCrc {..}) word = go _crcDataWidth _crcParams where CrcParams {..} = _crcParams - go (CrcParams SNat SNat _ _ _ _ _) = engine { _crcCurrent = nextCrc } + go SNat (CrcParams SNat _ _ _ _ _) = engine { _crcCurrent = nextCrc } where applyPolyBit crcB | crcB .&. _crcTopBitMask > 0 = (shiftL crcB 1) `xor` _crcpolyShifted | otherwise = shiftL crcB 1 applyPoly crcW = L.iterate applyPolyBit crcW L.!! snatToNum _crcDataWidth - applyCrc crc w = applyPoly $ crc `xor` (shiftL (extend w) (snatToNum _crcWidth)) + applyCrc crc w = applyPoly $ crc `xor` shiftL (extend w) (snatToNum _crcWidth) nextCrc = applyCrc _crcCurrent $ applyWhen _crcReflectInput reverseBV word -- | Get current CRC state. This is the value before any output reflection and output XOR. @@ -200,9 +205,9 @@ getCrcState :: forall (crcWidth :: Nat) (dataWidth :: Nat) . SoftwareCrc crcWidth dataWidth -> BitVector crcWidth -getCrcState (SoftwareCrc {..}) = go _crcParams +getCrcState (SoftwareCrc {..}) = go _crcDataWidth _crcParams where - go (CrcParams SNat SNat _ _ _ _ _) = fst $ split _crcCurrent + go SNat (CrcParams SNat _ _ _ _ _) = fst $ split _crcCurrent -- | Generate the CRC -- @@ -212,9 +217,9 @@ digest :: forall (crcWidth :: Nat) (dataWidth :: Nat) . SoftwareCrc crcWidth dataWidth -> BitVector crcWidth -digest params@(SoftwareCrc {..}) = go _crcParams +digest params@(SoftwareCrc {..}) = go _crcDataWidth _crcParams where - go (CrcParams SNat SNat _ _ _ _ _) = outputCrcRev `xor` _crcXorOutput + go SNat (CrcParams SNat _ _ _ _ _) = outputCrcRev `xor` _crcXorOutput where CrcParams {..} = _crcParams outputCrcRev = applyWhen _crcReflectOutput reverseBV $ getCrcState params @@ -237,20 +242,20 @@ digest params@(SoftwareCrc {..}) = go _crcParams rawResidue :: forall (crc :: Type) . KnownCrc crc - => Proxy crc + => crc -- ^ The CRC to use -> Int -- ^ How many invalid(zero) bits the stream is padded with -> BitVector (CrcWidth crc) -- ^ The residue -rawResidue p nExtra = rawResi +rawResidue crc nExtra = rawResi where dataWidth = d1 - CrcParams {..} = crcParams p dataWidth - swCrc = mkSoftwareCrc p dataWidth + CrcParams {..} = crcParams crc + swCrc = mkSoftwareCrc crc dataWidth crcVal = applyWhen _crcReflectOutput reverse $ bv2v $ digest swCrc bitsToFeed = fmap (v2bv . reverse . singleton) $ - (V.toList crcVal) L.++ (L.replicate nExtra 0) + V.toList crcVal L.++ L.replicate nExtra 0 rawResi = getCrcState $ L.foldl' feed swCrc bitsToFeed -- | Compute the residue value for these 'CrcParams', which is the value left in the @@ -258,13 +263,13 @@ rawResidue p nExtra = rawResi residue :: forall (crc :: Type) . KnownCrc crc - => Proxy crc + => crc -- ^ The CRC to use -> BitVector (CrcWidth crc) -- ^ The residue -residue p = applyWhen _crcReflectOutput reverseBV $ rawResidue p 0 +residue crc = applyWhen _crcReflectOutput reverseBV $ rawResidue crc 0 where - CrcParams {..} = crcParams p d1 + CrcParams {..} = crcParams crc -- | The @F@ and @G@ Matrices for parallel CRC computation, treating -- the CRC as a linear time-invariant system described by the state @@ -301,19 +306,19 @@ type instance TryDomain t (FGMatrices crcWidth dataWidth) = 'NotFound mkFGMatrices :: forall (crc :: Type) (dataWidth :: Nat) . KnownCrc crc - => Proxy crc + => crc -> SNat dataWidth -> FGMatrices (CrcWidth crc) dataWidth mkFGMatrices crc dataWidth@SNat = FGMatrices f g where - params = crcParams crc dataWidth + params = crcParams crc newParams = params { _crcReflectOutput = False , _crcXorOutput = 0 } - withInitCrc i = mkSoftwareCrcFromParams $ newParams { _crcInitial = i } + withInitCrc i = mkSoftwareCrcFromParams (newParams { _crcInitial = i }) dataWidth runCrc initial dat = digest $ feed (withInitCrc initial) dat - onehots n = (shiftL 1) . fromIntegral <$> (indices n) + onehots n = shiftL 1 . fromIntegral <$> indices n postProcess x = v2bv . reverse <$> transpose x f = postProcess $ bv2v . (\p -> runCrc p 0) <$> onehots (SNat @(CrcWidth crc)) g = postProcess $ bv2v . (\p -> runCrc 0 p) <$> onehots dataWidth @@ -324,7 +329,7 @@ partitionMat => SNat p -> Vec n (BitVector (p * q)) -> Vec n (Vec p (BitVector q)) -partitionMat SNat mat = fmap (fmap v2bv . unconcatI . bv2v) mat +partitionMat SNat mat = fmap unpack mat -- | Flatten vertically partitioned matrix unPartitionMat @@ -332,7 +337,7 @@ unPartitionMat => KnownNat p => Vec n (Vec p (BitVector q)) -> Vec n (BitVector (p * q)) -unPartitionMat mat = fmap (v2bv . concat . fmap bv2v) mat +unPartitionMat mat = fmap pack mat -- | Helper type that contains the flattened @F@ and @G@ matrices for each lane data CrcLaneParams (crcWidth :: Nat) (dataWidth :: Nat) (nLanes :: Nat) where @@ -363,8 +368,9 @@ type instance TryDomain t (CrcLaneParams crcWidth dataWidth nLanes) = 'NotFound -- | Contains all necessary parameters for the hardware CRC implementation data CrcHardwareParams (crcWidth :: Nat) (dataWidth :: Nat) (nLanes :: Nat) = CrcHardwareParams - { _crcNlanes :: SNat nLanes - , _crcBaseParams :: CrcParams crcWidth dataWidth + { _crcDataWidthHW :: SNat dataWidth + , _crcNlanes :: SNat nLanes + , _crcBaseParams :: CrcParams crcWidth , _crcLaneParams :: CrcLaneParams crcWidth dataWidth nLanes , _crcResidues :: Vec nLanes (BitVector crcWidth) } @@ -379,14 +385,14 @@ type instance TryDomain t (CrcHardwareParams crcWidth dataWidth nLanes) = 'NotFo -- process in a single cycle. For example the stream could be byte-oriented, -- but processing is done @n@ bytes at a time. -- --- Use the 'Clash.Cores.Crc.Derive.deriveHardwareCrc' to create an instance. --- No instances should be implemented by hand due to requiring compile --- time evaluation. +-- Use the 'Clash.Cores.Crc.deriveHardwareCrc' to create an instance. +-- No instances should be implemented by hand, because a proper instance +-- requires compile-time evaluation. class ( KnownCrc crc, KnownNat dataWidth, 1 <= dataWidth, KnownNat nLanes, 1 <= nLanes) => HardwareCrc (crc :: Type) (dataWidth :: Nat) (nLanes :: Nat) where crcHardwareParams - :: Proxy crc + :: crc -- ^ Which CRC -> Proxy dataWidth -- ^ What word size in bits the hardware implementation can handle @@ -422,7 +428,7 @@ flattenFGMatrices (FGMatrices f g) = zipWith (++#) f g mkCrcLaneParams :: KnownCrc crc => 1 <= nLanes - => Proxy crc + => crc -> SNat dataWidth -> SNat nLanes -> CrcLaneParams (CrcWidth crc) dataWidth nLanes @@ -431,11 +437,11 @@ mkCrcLaneParams crc dataWidth@SNat nLanes@SNat SNatEQ2 -> CrcLane1 (flattenFGMatrices $ mkFGMatrices crc dataWidth) SNatLT2 -> CrcLaneN nLanes fg (mkCrcLaneParams crc dataWidth $ subSNat nLanes d1) where - reflectInput = _crcReflectInput $ crcParams crc d1 + reflectInput = _crcReflectInput $ crcParams crc (FGMatrices f g) = mkFGMatrices crc (mulSNat nLanes dataWidth) reverseLanes = unPartitionMat . fmap reverse . partitionMat nLanes fg = flattenFGMatrices $ FGMatrices f (applyWhen reflectInput reverseLanes g) - _ -> clashCompileError "mkCrcLaneParams: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" + _ -> error "mkCrcLaneParams: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" -- | Get the flattened @F|G@ Matrix for a given lane getFGMatrix @@ -447,12 +453,12 @@ getFGMatrix getFGMatrix (CrcLane1 fg) lane = case compareSNat2 d1 lane of SNatEQ2 -> fg - _ -> clashCompileError "getFGMatrix, CrcLane1: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" + _ -> error "getFGMatrix, CrcLane1: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" getFGMatrix (CrcLaneN lanes fg next) lane = case compareSNat2 lane lanes of SNatLT2 -> getFGMatrix next lane SNatEQ2 -> fg - _ -> clashCompileError "getFGMatrix, CrcLaneN: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" + _ -> error "getFGMatrix, CrcLaneN: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" -- | Construct parameters for a parallel hardware CRC implementation mkCrcHardwareParams @@ -461,7 +467,7 @@ mkCrcHardwareParams (nLanes :: Nat) . KnownCrc crc => 1 <= nLanes - => Proxy crc + => crc -- ^ The CRC to instantiate parallel implementation for -> SNat dataWidth -- ^ The width of the word to feed @@ -474,10 +480,11 @@ mkCrcHardwareParams crc dataWidth nLanes@SNat computeResidue = rawResidue crc . (snatToNum dataWidth *) . fromIntegral hwParams = CrcHardwareParams - { _crcNlanes = nLanes - , _crcBaseParams = crcParams crc dataWidth + { _crcDataWidthHW = dataWidth + , _crcNlanes = nLanes + , _crcBaseParams = crcParams crc , _crcLaneParams = mkCrcLaneParams crc dataWidth nLanes - , _crcResidues = fmap computeResidue $ reverse indicesI + , _crcResidues = computeResidue <$> reverse indicesI } typeRepToTHType :: SomeTypeRep -> TH.Type @@ -495,11 +502,11 @@ typeRepToTHType _ = error "typeRepToTHType: Absurd, Report this to the Clash com -- For example, the following derives a 'HardwareCrc' instance for the 32-bit Ethernet CRC -- where you can feed it 8, 16, 24 or 32 bits at a time: -- --- @ --- {\-\# LANGUAGE MultiParamTypeClasses \#-\} +-- @ +-- {\-\# LANGUAGE MultiParamTypeClasses \#-\} -- --- $(deriveHardwareCrc (Proxy \@Crc32_ethernet) d8 d4) --- @ +-- deriveHardwareCrc (Proxy \@Crc32_ethernet) d8 d4 +-- @ -- -- For the derivation to work the @MultiParamTypeClasses@ pragma must be enabled in -- the module that uses 'deriveHardwareCrc'. @@ -507,11 +514,14 @@ typeRepToTHType _ = error "typeRepToTHType: Absurd, Report this to the Clash com -- See 'HardwareCrc', 'crcEngine' and 'crcValidator' for more information about what -- the arguments mean. deriveHardwareCrc - :: Typeable crc + :: forall (crc :: Type) + (dataWidth :: Nat) + (nLanes :: Nat) + . Typeable crc => KnownCrc crc => 1 <= dataWidth => 1 <= nLanes - => Proxy crc + => crc -- ^ For which CRC to derive the instance -> SNat dataWidth -- ^ The width in bits of the words it can handle every clock cycle @@ -519,7 +529,7 @@ deriveHardwareCrc -- ^ The number of lanes -> TH.Q [TH.Dec] deriveHardwareCrc crc dataWidth@SNat nLanes@SNat = do - let crcTy = pure $ typeRepToTHType $ someTypeRep crc + let crcTy = pure $ typeRepToTHType $ someTypeRep (Proxy @crc) dataWidthTy = pure $ TH.LitT $ TH.NumTyLit $ snatToNum dataWidth nLanesTy = pure $ TH.LitT $ TH.NumTyLit $ snatToNum nLanes hwParams = lift $ mkCrcHardwareParams crc dataWidth nLanes @@ -572,14 +582,13 @@ takeLe SNat vs = leToPlus @n @m $ takeI vs laneStep :: CrcHardwareParams crcWidth dataWidth nLanes -> SNat lanePrev - -> () -> BitVector crcWidth -> Vec nLanes (BitVector dataWidth) -> BitVector crcWidth -laneStep (CrcHardwareParams nLanes@SNat (CrcParams SNat SNat _ _ _ _ _) laneParams _) lanePrev@SNat _ crc input +laneStep (CrcHardwareParams SNat nLanes@SNat (CrcParams SNat _ _ _ _ _) laneParams _) lanePrev@SNat crc input = let lane = addSNat lanePrev d1 in case compareSNat lane nLanes of SNatLE -> matVecMul (getFGMatrix laneParams lane) (crc ++# (pack $ takeLe lane input)) - _ -> clashCompileError "laneStep: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" + _ -> error "laneStep: Absurd, Report this to the Clash compiler team: https://github.com/clash-lang/clash-compiler/issues" -- | A parallel multilane CRC engine and validator -- @@ -600,8 +609,11 @@ crcEngine (nLanes :: Nat) . HiddenClockResetEnable dom => HardwareCrc crc dataWidth nLanes - => Proxy crc + => crc -- ^ The CRC + -> Signal dom Bool + -- ^ Reset the CRC engine. This reset can be asserted in the same cycle as + -- giving the first word. -> Signal dom (Maybe (Index nLanes, Vec nLanes (BitVector dataWidth))) -- ^ The input data. @Index nLanes@ indicates how many @dataWidth@ words are -- valid in the vector minus 1. @@ -624,15 +636,16 @@ crcEngineFromParams => KnownNat dataWidth => KnownNat nLanes => CrcHardwareParams crcWidth dataWidth nLanes + -> Signal dom Bool -> Signal dom (Maybe (Index nLanes, Vec nLanes (BitVector dataWidth))) -> Signal dom (BitVector crcWidth) -crcEngineFromParams hwParams@(CrcHardwareParams _ CrcParams{..} _ _) inDat = crcOut +crcEngineFromParams hwParams@(CrcHardwareParams _ _ CrcParams{..} _ _) resetCrc inDat = crcOut where - steps = smap (laneStep hwParams) (repeat @nLanes ()) + steps = smap (\sn _ -> laneStep hwParams sn) (repeat @nLanes ()) (validLanesX, datX) = unbundle $ fromJustX <$> inDat step = fmap (steps !!) validLanesX - nextCrcState = step <*> crcState <*> datX + nextCrcState = step <*> (mux resetCrc (pure _crcInitial) crcState) <*> datX crcState = regEn _crcInitial (isJust <$> inDat) nextCrcState crcOut = xor _crcXorOutput <$> (applyWhen _crcReflectOutput reverseBV <$> crcState) @@ -653,14 +666,15 @@ crcValidator (nLanes :: Nat) . HiddenClockResetEnable dom => HardwareCrc crc dataWidth nLanes - => Proxy crc + => crc -- ^ The CRC + -> Signal dom Bool + -- ^ Reset the CRC validator. This has no delay. So this reset can be asserted + -- in the same cycle as giving the first word. -> Signal dom (Maybe (Index nLanes, Vec nLanes (BitVector dataWidth))) -- ^ The input data -> Signal dom Bool - -- ^ Whether the CRC is valid. This is valid on the transfer of the last - -- word in the message + crc. So there is no one clock cycle delay, - -- in contrast with 'crcEngine'. + -- ^ Whether the CRC is valid. There is a delay of a single cycle from input to output. crcValidator crc = crcValidatorFromParams $ crcHardwareParams crc Proxy Proxy -- | Like 'crcValidator' but uses 'CrcHardwareParams' instead of a 'HardwareCrc' constraint @@ -675,15 +689,16 @@ crcValidatorFromParams => KnownNat nLanes => 1 <= nLanes => CrcHardwareParams crcWidth dataWidth nLanes + -> Signal dom Bool -> Signal dom (Maybe (Index nLanes, Vec nLanes (BitVector dataWidth))) -> Signal dom Bool -crcValidatorFromParams hwParams@(CrcHardwareParams _ CrcParams{..} _ residues) inDat = match +crcValidatorFromParams hwParams@(CrcHardwareParams _ _ CrcParams{..} _ residues) resetCrc inDat = match where - step = laneStep hwParams (subSNatLe (SNat @nLanes) d1) () + step = laneStep hwParams (subSNatLe (SNat @nLanes) d1) (validLanesX, datX) = unbundle $ fromJustX <$> inDat - nextCrcState = step <$> crcState <*> datX + nextCrcState = step <$> (mux resetCrc (pure _crcInitial) crcState) <*> datX crcState = regEn _crcInitial (isJust <$> inDat) nextCrcState - matches = zipWith (==) residues <$> (fmap pure crcState) + matches = zipWith (==) residues <$> fmap pure crcState rawMatch = (!!) <$> matches <*> register undefined validLanesX match = (register False $ isJust <$> inDat) .&&. rawMatch diff --git a/clash-cores/test/Test/Cores/Crc.hs b/clash-cores/test/Test/Cores/Crc.hs index 1dd5ee6cf0..e6f4b767ea 100644 --- a/clash-cores/test/Test/Cores/Crc.hs +++ b/clash-cores/test/Test/Cores/Crc.hs @@ -77,21 +77,41 @@ checkProp . (checkWords * dataWidth) ~ 72 => KnownNat checkWords => KnownCrc crc - => Proxy crc + => crc -> BitVector (CrcWidth crc) -> SNat dataWidth -> TestTree checkProp crc checkVal dataWidth = QC.testProperty testName $ checkVal QC.=== resultCheckVal where - CrcParams {..} = crcParams crc dataWidth + CrcParams {..} = crcParams crc testName = ("datawidth ~ " List.++ (show (snatToNum dataWidth :: Integer))) wordsToFeed = getCheckInput (SNat @checkWords) dataWidth _crcReflectInput resultCheckVal = digest $ List.foldl' feed (mkSoftwareCrc crc dataWidth) wordsToFeed +crcEngineResetProp + :: KnownCrc crc + => crc + -> BitVector (CrcWidth crc) + -> [BitVector 8] + -> QC.Property +crcEngineResetProp crc checkVal inp = hwCrc QC.=== checkVal + where + dw = d8 + CrcParams {..} = crcParams crc + hwParams = mkCrcHardwareParams crc dw d1 + crcEngine' = exposeClockResetEnable crcEngineFromParams systemClockGen resetGen enableGen hwParams + + resetInp = List.replicate (1 + List.length inp) False List.++ [True] List.++ (List.repeat False) + toInp b = Just (0, singleton b) + someInp = toInp <$> inp List.++ (getCheckInput SNat dw _crcReflectInput) + + hwOut = crcEngine' (fromList resetInp) (fromList $ Nothing:someInp) + hwCrc = List.last $ sampleN (2 + List.length someInp) hwOut + crcEngineEqSoftware :: forall crc . KnownCrc crc - => Proxy crc + => crc -- ^ Which crc -> Index 7 -- ^ nLanes @@ -124,7 +144,7 @@ crcEngineEqSoftware crc nLanesI dataWidthCfg inpI inps = fmap (fmap fromIntegral) inpI hwParams = mkCrcHardwareParams crc dataWidth nLanes - crcEngine' = exposeClockResetEnable crcEngineFromParams systemClockGen resetGen enableGen hwParams + crcEngine' = exposeClockResetEnable crcEngineFromParams systemClockGen resetGen enableGen hwParams (pure False) swCrc = digest $ List.foldl' feed (mkSoftwareCrc crc dataWidth) (catMaybes inps) hwInp = Nothing : (toVecN inps) @@ -134,7 +154,7 @@ crcEngineEqSoftware crc nLanesI dataWidthCfg inpI crcValidatorEqSoftware :: forall crc . KnownCrc crc - => Proxy crc + => crc -- ^ Which crc -> Index 7 -- ^ nLanes @@ -163,7 +183,7 @@ crcValidatorEqSoftware crc nLanesI dataWidthCfg inpI -> QC.Property prop nLanes@SNat dataWidth@SNat = hwOk QC.=== True where - CrcParams{..} = crcParams crc dataWidth + CrcParams{..} = crcParams crc inp :: [Maybe (BitVector dataWidth)] inp = fmap (fmap fromIntegral) inpI @@ -179,7 +199,7 @@ crcValidatorEqSoftware crc nLanesI dataWidthCfg inpI inpsWithCrc = inpJusts List.++ (V.toList swCrcVec) hwParams = mkCrcHardwareParams crc dataWidth nLanes - crcValidator' = exposeClockResetEnable crcValidatorFromParams systemClockGen resetGen enableGen hwParams + crcValidator' = exposeClockResetEnable crcValidatorFromParams systemClockGen resetGen enableGen hwParams (pure False) hwInp = Nothing : (toVecN $ fmap Just inpsWithCrc) hwOut = crcValidator' (fromList hwInp) @@ -189,12 +209,12 @@ crcValidatorEqSoftware crc nLanesI dataWidthCfg inpI mkCrcProps :: forall (crc :: Type) . KnownCrc crc - => String - -> Proxy crc + => Show crc + => crc -> BitVector (CrcWidth crc) -> BitVector (CrcWidth crc) -> TestTree -mkCrcProps crcName crc checkVal residueVal = props +mkCrcProps crc checkVal residueVal = props where checkProp' :: forall checkWords n @@ -204,13 +224,14 @@ mkCrcProps crcName crc checkVal residueVal = props -> TestTree checkProp' dw'@SNat = checkProp @checkWords crc checkVal dw' props - = testGroup crcName + = testGroup (show crc) [ QC.testProperty "Residue" $ residueVal QC.=== residue crc , testGroup "Software check" [ checkProp' d1 , checkProp' d2 , checkProp' d3 , checkProp' d8 , checkProp' d9 , checkProp' d12 , checkProp' d24, checkProp' d36, checkProp' d72 ] + , QC.testProperty "crcEngine reset" $ crcEngineResetProp crc checkVal , QC.testProperty "crcEngine ~ SoftwareCrc" $ crcEngineEqSoftware crc , QC.testProperty "crcValidator ~ SoftwareCrc" $ crcValidatorEqSoftware crc ] @@ -219,116 +240,116 @@ mkCrcProps crcName crc checkVal residueVal = props -- https://reveng.sourceforge.io/crc-catalogue/all.htm tests :: TestTree tests = testGroup "Crc" - [ mkCrcProps "Crc3_gsm" (Proxy @Crc3_gsm) 0x4 0x2 - , mkCrcProps "Crc3_rohc" (Proxy @Crc3_rohc) 0x6 0x0 - , mkCrcProps "Crc4_g_704" (Proxy @Crc4_g_704) 0x7 0x0 - , mkCrcProps "Crc4_interlaken" (Proxy @Crc4_interlaken) 0xb 0x2 - , mkCrcProps "Crc5_epc_c1g2" (Proxy @Crc5_epc_c1g2) 0x00 0x00 - , mkCrcProps "Crc5_g_704" (Proxy @Crc5_g_704) 0x07 0x00 - , mkCrcProps "Crc5_usb" (Proxy @Crc5_usb) 0x19 0x06 - , mkCrcProps "Crc6_cdma2000_a" (Proxy @Crc6_cdma2000_a) 0x0d 0x00 - , mkCrcProps "Crc6_cdma2000_b" (Proxy @Crc6_cdma2000_b) 0x3b 0x00 - , mkCrcProps "Crc6_darc" (Proxy @Crc6_darc) 0x26 0x00 - , mkCrcProps "Crc6_g_704" (Proxy @Crc6_g_704) 0x06 0x00 - , mkCrcProps "Crc6_gsm" (Proxy @Crc6_gsm) 0x13 0x3a - , mkCrcProps "Crc7_mmc" (Proxy @Crc7_mmc) 0x75 0x00 - , mkCrcProps "Crc7_rohc" (Proxy @Crc7_rohc) 0x53 0x00 - , mkCrcProps "Crc7_umts" (Proxy @Crc7_umts) 0x61 0x00 - , mkCrcProps "Crc8_autosar" (Proxy @Crc8_autosar) 0xdf 0x42 - , mkCrcProps "Crc8_bluetooth" (Proxy @Crc8_bluetooth) 0x26 0x00 - , mkCrcProps "Crc8_cdma2000" (Proxy @Crc8_cdma2000) 0xda 0x00 - , mkCrcProps "Crc8_darc" (Proxy @Crc8_darc) 0x15 0x00 - , mkCrcProps "Crc8_dvb_s2" (Proxy @Crc8_dvb_s2) 0xbc 0x00 - , mkCrcProps "Crc8_gsm_a" (Proxy @Crc8_gsm_a) 0x37 0x00 - , mkCrcProps "Crc8_gsm_b" (Proxy @Crc8_gsm_b) 0x94 0x53 - , mkCrcProps "Crc8_hitag" (Proxy @Crc8_hitag) 0xb4 0x00 - , mkCrcProps "Crc8_i_432_1" (Proxy @Crc8_i_432_1) 0xa1 0xac - , mkCrcProps "Crc8_i_code" (Proxy @Crc8_i_code) 0x7e 0x00 - , mkCrcProps "Crc8_lte" (Proxy @Crc8_lte) 0xea 0x00 - , mkCrcProps "Crc8_maxim_dow" (Proxy @Crc8_maxim_dow) 0xa1 0x00 - , mkCrcProps "Crc8_mifare_mad" (Proxy @Crc8_mifare_mad) 0x99 0x00 - , mkCrcProps "Crc8_nrsc_5" (Proxy @Crc8_nrsc_5) 0xf7 0x00 - , mkCrcProps "Crc8_opensafety" (Proxy @Crc8_opensafety) 0x3e 0x00 - , mkCrcProps "Crc8_rohc" (Proxy @Crc8_rohc) 0xd0 0x00 - , mkCrcProps "Crc8_sae_j1850" (Proxy @Crc8_sae_j1850) 0x4b 0xc4 - , mkCrcProps "Crc8_smbus" (Proxy @Crc8_smbus) 0xf4 0x00 - , mkCrcProps "Crc8_tech_3250" (Proxy @Crc8_tech_3250) 0x97 0x00 - , mkCrcProps "Crc8_wcdma" (Proxy @Crc8_wcdma) 0x25 0x00 - , mkCrcProps "Crc10_atm" (Proxy @Crc10_atm) 0x199 0x000 - , mkCrcProps "Crc10_cdma2000" (Proxy @Crc10_cdma2000) 0x233 0x000 - , mkCrcProps "Crc10_gsm" (Proxy @Crc10_gsm) 0x12a 0x0c6 - , mkCrcProps "Crc11_flexray" (Proxy @Crc11_flexray) 0x5a3 0x000 - , mkCrcProps "Crc11_umts" (Proxy @Crc11_umts) 0x061 0x000 - , mkCrcProps "Crc12_cdma2000" (Proxy @Crc12_cdma2000) 0xd4d 0x000 - , mkCrcProps "Crc12_dect" (Proxy @Crc12_dect) 0xf5b 0x000 - , mkCrcProps "Crc12_gsm" (Proxy @Crc12_gsm) 0xb34 0x178 - , mkCrcProps "Crc12_umts" (Proxy @Crc12_umts) 0xdaf 0x000 - , mkCrcProps "Crc13_bbc" (Proxy @Crc13_bbc) 0x04fa 0x0000 - , mkCrcProps "Crc14_darc" (Proxy @Crc14_darc) 0x082d 0x0000 - , mkCrcProps "Crc14_gsm" (Proxy @Crc14_gsm) 0x30ae 0x031e - , mkCrcProps "Crc15_can" (Proxy @Crc15_can) 0x059e 0x0000 - , mkCrcProps "Crc15_mpt1327" (Proxy @Crc15_mpt1327) 0x2566 0x6815 - , mkCrcProps "Crc16_arc" (Proxy @Crc16_arc) 0xbb3d 0x0000 - , mkCrcProps "Crc16_cdma2000" (Proxy @Crc16_cdma2000) 0x4c06 0x0000 - , mkCrcProps "Crc16_cms" (Proxy @Crc16_cms) 0xaee7 0x0000 - , mkCrcProps "Crc16_dds_110" (Proxy @Crc16_dds_110) 0x9ecf 0x0000 - , mkCrcProps "Crc16_dect_r" (Proxy @Crc16_dect_r) 0x007e 0x0589 - , mkCrcProps "Crc16_dect_x" (Proxy @Crc16_dect_x) 0x007f 0x0000 - , mkCrcProps "Crc16_dnp" (Proxy @Crc16_dnp) 0xea82 0x66c5 - , mkCrcProps "Crc16_en_13757" (Proxy @Crc16_en_13757) 0xc2b7 0xa366 - , mkCrcProps "Crc16_genibus" (Proxy @Crc16_genibus) 0xd64e 0x1d0f - , mkCrcProps "Crc16_gsm" (Proxy @Crc16_gsm) 0xce3c 0x1d0f - , mkCrcProps "Crc16_ibm_3740" (Proxy @Crc16_ibm_3740) 0x29b1 0x0000 - , mkCrcProps "Crc16_ibm_sdlc" (Proxy @Crc16_ibm_sdlc) 0x906e 0xf0b8 - , mkCrcProps "Crc16_iso_iec_14443_3_a" (Proxy @Crc16_iso_iec_14443_3_a) 0xbf05 0x0000 - , mkCrcProps "Crc16_kermit" (Proxy @Crc16_kermit) 0x2189 0x0000 - , mkCrcProps "Crc16_lj1200" (Proxy @Crc16_lj1200) 0xbdf4 0x0000 - , mkCrcProps "Crc16_m17" (Proxy @Crc16_m17) 0x772b 0x0000 - , mkCrcProps "Crc16_maxim_dow" (Proxy @Crc16_maxim_dow) 0x44c2 0xb001 - , mkCrcProps "Crc16_mcrf4xx" (Proxy @Crc16_mcrf4xx) 0x6f91 0x0000 - , mkCrcProps "Crc16_modbus" (Proxy @Crc16_modbus) 0x4b37 0x0000 - , mkCrcProps "Crc16_nrsc_5" (Proxy @Crc16_nrsc_5) 0xa066 0x0000 - , mkCrcProps "Crc16_opensafety_a" (Proxy @Crc16_opensafety_a) 0x5d38 0x0000 - , mkCrcProps "Crc16_opensafety_b" (Proxy @Crc16_opensafety_b) 0x20fe 0x0000 - , mkCrcProps "Crc16_profibus" (Proxy @Crc16_profibus) 0xa819 0xe394 - , mkCrcProps "Crc16_riello" (Proxy @Crc16_riello) 0x63d0 0x0000 - , mkCrcProps "Crc16_spi_fujitsu" (Proxy @Crc16_spi_fujitsu) 0xe5cc 0x0000 - , mkCrcProps "Crc16_t10_dif" (Proxy @Crc16_t10_dif) 0xd0db 0x0000 - , mkCrcProps "Crc16_teledisk" (Proxy @Crc16_teledisk) 0x0fb3 0x0000 - , mkCrcProps "Crc16_tms37157" (Proxy @Crc16_tms37157) 0x26b1 0x0000 - , mkCrcProps "Crc16_umts" (Proxy @Crc16_umts) 0xfee8 0x0000 - , mkCrcProps "Crc16_usb" (Proxy @Crc16_usb) 0xb4c8 0xb001 - , mkCrcProps "Crc16_xmodem" (Proxy @Crc16_xmodem) 0x31c3 0x0000 - , mkCrcProps "Crc17_can_fd" (Proxy @Crc17_can_fd) 0x04f03 0x00000 - , mkCrcProps "Crc21_can_fd" (Proxy @Crc21_can_fd) 0x0ed841 0x000000 - , mkCrcProps "Crc24_ble" (Proxy @Crc24_ble) 0xc25a56 0x000000 - , mkCrcProps "Crc24_flexray_a" (Proxy @Crc24_flexray_a) 0x7979bd 0x000000 - , mkCrcProps "Crc24_flexray_b" (Proxy @Crc24_flexray_b) 0x1f23b8 0x000000 - , mkCrcProps "Crc24_interlaken" (Proxy @Crc24_interlaken) 0xb4f3e6 0x144e63 - , mkCrcProps "Crc24_lte_a" (Proxy @Crc24_lte_a) 0xcde703 0x000000 - , mkCrcProps "Crc24_lte_b" (Proxy @Crc24_lte_b) 0x23ef52 0x000000 - , mkCrcProps "Crc24_openpgp" (Proxy @Crc24_openpgp) 0x21cf02 0x000000 - , mkCrcProps "Crc24_os_9" (Proxy @Crc24_os_9) 0x200fa5 0x800fe3 - , mkCrcProps "Crc30_cdma" (Proxy @Crc30_cdma) 0x04c34abf 0x34efa55a - , mkCrcProps "Crc31_philips" (Proxy @Crc31_philips) 0x0ce9e46c 0x4eaf26f1 - , mkCrcProps "Crc32_aixm" (Proxy @Crc32_aixm) 0x3010bf7f 0x00000000 - , mkCrcProps "Crc32_autosar" (Proxy @Crc32_autosar) 0x1697d06a 0x904cddbf - , mkCrcProps "Crc32_base91_d" (Proxy @Crc32_base91_d) 0x87315576 0x45270551 - , mkCrcProps "Crc32_bzip2" (Proxy @Crc32_bzip2) 0xfc891918 0xc704dd7b - , mkCrcProps "Crc32_cd_rom_edc" (Proxy @Crc32_cd_rom_edc) 0x6ec2edc4 0x00000000 - , mkCrcProps "Crc32_cksum" (Proxy @Crc32_cksum) 0x765e7680 0xc704dd7b - , mkCrcProps "Crc32_iscsi" (Proxy @Crc32_iscsi) 0xe3069283 0xb798b438 - , mkCrcProps "Crc32_iso_hdlc" (Proxy @Crc32_iso_hdlc) 0xcbf43926 0xdebb20e3 - , mkCrcProps "Crc32_jamcrc" (Proxy @Crc32_jamcrc) 0x340bc6d9 0x00000000 - , mkCrcProps "Crc32_mef" (Proxy @Crc32_mef) 0xd2c22f51 0x00000000 - , mkCrcProps "Crc32_mpeg_2" (Proxy @Crc32_mpeg_2) 0x0376e6e7 0x00000000 - , mkCrcProps "Crc32_xfer" (Proxy @Crc32_xfer) 0xbd0be338 0x00000000 - , mkCrcProps "Crc40_gsm" (Proxy @Crc40_gsm) 0xd4164fc646 0xc4ff8071ff - , mkCrcProps "Crc64_ecma_182" (Proxy @Crc64_ecma_182) 0x6c40df5f0b497347 0x0000000000000000 - , mkCrcProps "Crc64_go_iso" (Proxy @Crc64_go_iso) 0xb90956c775a41001 0x5300000000000000 - , mkCrcProps "Crc64_ms" (Proxy @Crc64_ms) 0x75d4b74f024eceea 0x0000000000000000 - , mkCrcProps "Crc64_redis" (Proxy @Crc64_redis) 0xe9c6d914c4b8d9ca 0x0000000000000000 - , mkCrcProps "Crc64_we" (Proxy @Crc64_we) 0x62ec59e3f1a4f00a 0xfcacbebd5931a992 - , mkCrcProps "Crc64_xz" (Proxy @Crc64_xz) 0x995dc9bbdf1939fa 0x49958c9abd7d353f - , mkCrcProps "Crc82_darc" (Proxy @Crc82_darc) 0x09ea83f625023801fd612 0x000000000000000000000 + [ mkCrcProps Crc3_gsm 0x4 0x2 + , mkCrcProps Crc3_rohc 0x6 0x0 + , mkCrcProps Crc4_g_704 0x7 0x0 + , mkCrcProps Crc4_interlaken 0xb 0x2 + , mkCrcProps Crc5_epc_c1g2 0x00 0x00 + , mkCrcProps Crc5_g_704 0x07 0x00 + , mkCrcProps Crc5_usb 0x19 0x06 + , mkCrcProps Crc6_cdma2000_a 0x0d 0x00 + , mkCrcProps Crc6_cdma2000_b 0x3b 0x00 + , mkCrcProps Crc6_darc 0x26 0x00 + , mkCrcProps Crc6_g_704 0x06 0x00 + , mkCrcProps Crc6_gsm 0x13 0x3a + , mkCrcProps Crc7_mmc 0x75 0x00 + , mkCrcProps Crc7_rohc 0x53 0x00 + , mkCrcProps Crc7_umts 0x61 0x00 + , mkCrcProps Crc8_autosar 0xdf 0x42 + , mkCrcProps Crc8_bluetooth 0x26 0x00 + , mkCrcProps Crc8_cdma2000 0xda 0x00 + , mkCrcProps Crc8_darc 0x15 0x00 + , mkCrcProps Crc8_dvb_s2 0xbc 0x00 + , mkCrcProps Crc8_gsm_a 0x37 0x00 + , mkCrcProps Crc8_gsm_b 0x94 0x53 + , mkCrcProps Crc8_hitag 0xb4 0x00 + , mkCrcProps Crc8_i_432_1 0xa1 0xac + , mkCrcProps Crc8_i_code 0x7e 0x00 + , mkCrcProps Crc8_lte 0xea 0x00 + , mkCrcProps Crc8_maxim_dow 0xa1 0x00 + , mkCrcProps Crc8_mifare_mad 0x99 0x00 + , mkCrcProps Crc8_nrsc_5 0xf7 0x00 + , mkCrcProps Crc8_opensafety 0x3e 0x00 + , mkCrcProps Crc8_rohc 0xd0 0x00 + , mkCrcProps Crc8_sae_j1850 0x4b 0xc4 + , mkCrcProps Crc8_smbus 0xf4 0x00 + , mkCrcProps Crc8_tech_3250 0x97 0x00 + , mkCrcProps Crc8_wcdma 0x25 0x00 + , mkCrcProps Crc10_atm 0x199 0x000 + , mkCrcProps Crc10_cdma2000 0x233 0x000 + , mkCrcProps Crc10_gsm 0x12a 0x0c6 + , mkCrcProps Crc11_flexray 0x5a3 0x000 + , mkCrcProps Crc11_umts 0x061 0x000 + , mkCrcProps Crc12_cdma2000 0xd4d 0x000 + , mkCrcProps Crc12_dect 0xf5b 0x000 + , mkCrcProps Crc12_gsm 0xb34 0x178 + , mkCrcProps Crc12_umts 0xdaf 0x000 + , mkCrcProps Crc13_bbc 0x04fa 0x0000 + , mkCrcProps Crc14_darc 0x082d 0x0000 + , mkCrcProps Crc14_gsm 0x30ae 0x031e + , mkCrcProps Crc15_can 0x059e 0x0000 + , mkCrcProps Crc15_mpt1327 0x2566 0x6815 + , mkCrcProps Crc16_arc 0xbb3d 0x0000 + , mkCrcProps Crc16_cdma2000 0x4c06 0x0000 + , mkCrcProps Crc16_cms 0xaee7 0x0000 + , mkCrcProps Crc16_dds_110 0x9ecf 0x0000 + , mkCrcProps Crc16_dect_r 0x007e 0x0589 + , mkCrcProps Crc16_dect_x 0x007f 0x0000 + , mkCrcProps Crc16_dnp 0xea82 0x66c5 + , mkCrcProps Crc16_en_13757 0xc2b7 0xa366 + , mkCrcProps Crc16_genibus 0xd64e 0x1d0f + , mkCrcProps Crc16_gsm 0xce3c 0x1d0f + , mkCrcProps Crc16_ibm_3740 0x29b1 0x0000 + , mkCrcProps Crc16_ibm_sdlc 0x906e 0xf0b8 + , mkCrcProps Crc16_iso_iec_14443_3_a 0xbf05 0x0000 + , mkCrcProps Crc16_kermit 0x2189 0x0000 + , mkCrcProps Crc16_lj1200 0xbdf4 0x0000 + , mkCrcProps Crc16_m17 0x772b 0x0000 + , mkCrcProps Crc16_maxim_dow 0x44c2 0xb001 + , mkCrcProps Crc16_mcrf4xx 0x6f91 0x0000 + , mkCrcProps Crc16_modbus 0x4b37 0x0000 + , mkCrcProps Crc16_nrsc_5 0xa066 0x0000 + , mkCrcProps Crc16_opensafety_a 0x5d38 0x0000 + , mkCrcProps Crc16_opensafety_b 0x20fe 0x0000 + , mkCrcProps Crc16_profibus 0xa819 0xe394 + , mkCrcProps Crc16_riello 0x63d0 0x0000 + , mkCrcProps Crc16_spi_fujitsu 0xe5cc 0x0000 + , mkCrcProps Crc16_t10_dif 0xd0db 0x0000 + , mkCrcProps Crc16_teledisk 0x0fb3 0x0000 + , mkCrcProps Crc16_tms37157 0x26b1 0x0000 + , mkCrcProps Crc16_umts 0xfee8 0x0000 + , mkCrcProps Crc16_usb 0xb4c8 0xb001 + , mkCrcProps Crc16_xmodem 0x31c3 0x0000 + , mkCrcProps Crc17_can_fd 0x04f03 0x00000 + , mkCrcProps Crc21_can_fd 0x0ed841 0x000000 + , mkCrcProps Crc24_ble 0xc25a56 0x000000 + , mkCrcProps Crc24_flexray_a 0x7979bd 0x000000 + , mkCrcProps Crc24_flexray_b 0x1f23b8 0x000000 + , mkCrcProps Crc24_interlaken 0xb4f3e6 0x144e63 + , mkCrcProps Crc24_lte_a 0xcde703 0x000000 + , mkCrcProps Crc24_lte_b 0x23ef52 0x000000 + , mkCrcProps Crc24_openpgp 0x21cf02 0x000000 + , mkCrcProps Crc24_os_9 0x200fa5 0x800fe3 + , mkCrcProps Crc30_cdma 0x04c34abf 0x34efa55a + , mkCrcProps Crc31_philips 0x0ce9e46c 0x4eaf26f1 + , mkCrcProps Crc32_aixm 0x3010bf7f 0x00000000 + , mkCrcProps Crc32_autosar 0x1697d06a 0x904cddbf + , mkCrcProps Crc32_base91_d 0x87315576 0x45270551 + , mkCrcProps Crc32_bzip2 0xfc891918 0xc704dd7b + , mkCrcProps Crc32_cd_rom_edc 0x6ec2edc4 0x00000000 + , mkCrcProps Crc32_cksum 0x765e7680 0xc704dd7b + , mkCrcProps Crc32_iscsi 0xe3069283 0xb798b438 + , mkCrcProps Crc32_iso_hdlc 0xcbf43926 0xdebb20e3 + , mkCrcProps Crc32_jamcrc 0x340bc6d9 0x00000000 + , mkCrcProps Crc32_mef 0xd2c22f51 0x00000000 + , mkCrcProps Crc32_mpeg_2 0x0376e6e7 0x00000000 + , mkCrcProps Crc32_xfer 0xbd0be338 0x00000000 + , mkCrcProps Crc40_gsm 0xd4164fc646 0xc4ff8071ff + , mkCrcProps Crc64_ecma_182 0x6c40df5f0b497347 0x0000000000000000 + , mkCrcProps Crc64_go_iso 0xb90956c775a41001 0x5300000000000000 + , mkCrcProps Crc64_ms 0x75d4b74f024eceea 0x0000000000000000 + , mkCrcProps Crc64_redis 0xe9c6d914c4b8d9ca 0x0000000000000000 + , mkCrcProps Crc64_we 0x62ec59e3f1a4f00a 0xfcacbebd5931a992 + , mkCrcProps Crc64_xz 0x995dc9bbdf1939fa 0x49958c9abd7d353f + , mkCrcProps Crc82_darc 0x09ea83f625023801fd612 0x000000000000000000000 ]