Conversation
|
Currently, it has the warning issue for the genBlackBoxProd function used in FloPoCoExample.hs . I will add ghc flag to disable the warning later. |
| @@ -0,0 +1,121 @@ | |||
| # Clash library for interacting with FloPoCo | |||
| This is the library contains API to interact with FloPoCo to generate | |||
There was a problem hiding this comment.
| This is the library contains API to interact with FloPoCo to generate | |
| This is library contains an API to interact with [FloPoCo](https://flopoco.org/) to generate | |
| @@ -0,0 +1,121 @@ | |||
| # Clash library for interacting with FloPoCo | |||
| This is the library contains API to interact with FloPoCo to generate | |||
| hardware synthesizable floating point arithmetics function. | |||
There was a problem hiding this comment.
| hardware synthesizable floating point arithmetics function. | |
| synthesizable floating point arithmetic functions. | |
| # Clash library for interacting with FloPoCo | ||
| This is the library contains API to interact with FloPoCo to generate | ||
| hardware synthesizable floating point arithmetics function. | ||
| It can also be used with Float type in haskell |
There was a problem hiding this comment.
| It can also be used with Float type in haskell | |
| It can also be used with Haskell's regular 'Float' type. | |
| It can also be used with Float type in haskell | ||
| # How to use it | ||
| 1. Install FloPoCo library | ||
| On Linux, user can run to go to FloPoCo source code follow the instruction. |
There was a problem hiding this comment.
| On Linux, user can run to go to FloPoCo source code follow the instruction. | |
| On Linux, you can follow the [installation instructions](https://flopoco.org/flopoco_installation.html) to build FloPoCo from source. |
| # How to use it | ||
| 1. Install FloPoCo library | ||
| On Linux, user can run to go to FloPoCo source code follow the instruction. | ||
| For Window, user must enable Window Subsystem Linux to install FloPoCo as |
There was a problem hiding this comment.
| For Window, user must enable Window Subsystem Linux to install FloPoCo as | |
| For Windows, you must enable Window Subsystem Linux first and then follow the instructions for Linux as |
| module Clash.Cores.ClashFloPoCo.GenTemDSL | ||
| ( getPipeDep, | ||
| flopocoPrim, | ||
| genFloPoCoInfoEntity, | ||
| liftInfoEntity, | ||
| genBlackBoxFunction, | ||
| genTemplateFunction, | ||
| genBlackBoxTemplateFunction, | ||
| genBlackBoxTemplateFunctionProd, | ||
| genBlackBox, | ||
| genBlackBoxProd, | ||
| ) |
There was a problem hiding this comment.
Use leading , for the export list, see for example:
clash-cores/src/Clash/Cores/Xilinx/Floating.hs
Lines 45 to 76 in 3cc8c71
| getPipeDep infoen = do | ||
| return (LitT (NumTyLit (fromIntegral (convertMaybeToInt (pipedep infoen))))) | ||
|
|
||
| -- | Function to generate the InfoEntity coresponding to the arithmetic entity generated by FloPoCo |
There was a problem hiding this comment.
Have haddock generate a link to InfoEntity
| -- | Function to generate the InfoEntity coresponding to the arithmetic entity generated by FloPoCo | |
| -- | Function to generate the 'InfoEntity' coresponding to the arithmetic entity generated by FloPoCo |
| -- | ||
| -- | ||
|
|
| liftInfoEntity :: InfoEntity -> Q Exp | ||
| liftInfoEntity (InfoEntity n f p ins outs) = | ||
| [|InfoEntity $(lift n) $(lift f) $(lift p) $(lift ins) $(lift outs)|] |
There was a problem hiding this comment.
Why not create an instance Lift InfoEntity where you define the InfoEntity type?
| -- | Function to convert Maybe Int to Int | ||
| convertMaybeToInt :: Maybe Int -> Int | ||
| convertMaybeToInt = fromMaybe 0 |
There was a problem hiding this comment.
I would just inline this definition, because:
- It only has one use site
- The name
convertMaybeToIntdoesn't really inform the user that happens when the argument isNothing; the choice for0is arbitrary.
| let funcDec = | ||
| FunD | ||
| bbfName | ||
| [ Clause | ||
| [WildP, WildP, WildP, WildP] | ||
| ( NormalB | ||
| ( AppE | ||
| (VarE 'pure) | ||
| ( AppE | ||
| (ConE 'Right) | ||
| ( TupE | ||
| [ Just (RecUpdE (VarE 'emptyBlackBoxMeta) [('bbKind, ConE 'TDecl)]), | ||
| Just | ||
| ( AppE | ||
| ( AppE | ||
| (AppE (ConE 'BBFunction) (LitE (StringL (entityName <> "TF")))) -- 1st arg | ||
| (LitE (IntegerL 0)) -- 2nd arg | ||
| ) | ||
| (AppE (VarE tfName) (LitE (StringL entityName))) -- 3rd arg | ||
| ) | ||
| ] | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
| [] | ||
| ] |
There was a problem hiding this comment.
This could be simplified to:
-- Create the function declaration
funExpr <- [|pure (Right (emptyBlackBoxMeta {bbKind = TDecl}, BBFunction (entityName <> "TF") 0 ($(varE tfName) entityName)))|]
let funcDec = FunD bbfName [Clause [WildP,WildP,WildP, WildP] (NormalB funExpr) []]
This will ClashFloPoCo, which is the library for interacting between Clash and FloPoCo. This library provides a custom example of the implementation and binding 3 single precision floating point operations supported by FloPoCo: addition, fuse multiply addition, and exponent. It also provides a markdown doc about how to use it.