Giter VIP home page Giter VIP logo

clash's People

Contributors

christiaanb avatar matthijskooijman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

clash's Issues

invalid generated identifier using custom operators

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)

vsplit vhdl generation issue

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.