christiaanb / clash Goto Github PK
View Code? Open in Web Editor NEWmy branch of clash
Home Page: http://clash.ewi.utwente.nl
License: Other
my branch of clash
Home Page: http://clash.ewi.utwente.nl
License: Other
when I'm using customized prelude operators (.
in this case), the generated
vhdl is invalid (starting with .
).
module Test where
import CLasH.HardwareTypes
import Prelude hiding (Maybe(..),($),(.))
data Maybe a = Just a | Nothing
deriving Show
infixr 0 $
($) a = a
infixr 9 .
(.) a b c = a (b c)
test0 :: Bit -> Bit
test0 Low = High
test0 High = Low
{-# ANN test1 TopEntity #-}
test1 :: Bit -> Bit
test1 = test0 . test0
piece of generated vhdl:
architecture structural of test1Component_0 is
begin
comp_ins_res2046865544 : entity .Component_1
port map (param2046865564 => param2046865542,
res2046865566 => res2046865544,
resetn => resetn);
end architecture structural;
.Component_1
is invalid(starting with .
). I guess it can be solved by applying a universal filter to each generated identifiers.
also, you know, it's not easy to drop some core functions from prelude, how about better prelude integration. as a future feature?
EDIT: and, once I generated a identifier with more than 512 bytes(from a complex ADT), I guess you could limit the length as well this time (some reasonable value like 128 or 256)
try following demo code
module Test where
import CLasH.HardwareTypes
{-# ANN test TopEntity #-}
test :: Vector D32 Bit -> Vector D16 Bit
test a = fst (vsplit a)
the generated vhdl is like
splitPrimNamez20UZLNSimplez20Uz22Ua2046865519z22UZR : block
begin
arg2046865524.A <= arg2046865524(0 to 15);
arg2046865524.B <= arg2046865524(16 to 31);
end block splitPrimNamez20UZLNSimplez20Uz22Ua2046865519z22UZR;
where arg2046865524
has type
type Z2TZLz2cUZRvectorzmstd_logiczm0_to_15vectorzmstd_logiczm0_to_15 is
record A : vectorzmstd_logiczm0_to_15;
B : vectorzmstd_logiczm0_to_15;
end record;
so I guess the right hand side is wrong.
ghdl gives following error message
testComponent_0.vhdl:27:43: type of prefix is not an array
testComponent_0.vhdl:28:43: type of prefix is not an array
test with latest code (clash + clash-bin) from github
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.