Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Duplicate" names #823

Closed
leonschoorl opened this issue Sep 30, 2019 · 11 comments
Closed

"Duplicate" names #823

leonschoorl opened this issue Sep 30, 2019 · 11 comments
Assignees
Labels
enhancement external bug Hacktoberfest intermediate Requires (some) knowledge of the clash compiler to implement

Comments

@leonschoorl
Copy link
Member

leonschoorl commented Sep 30, 2019

When compiled to VHDL this example has a port named unsignedField1 and generates an internal signal named \unsignedField1\.
I'm not sure what the VHDL spec says about escaped names, but Quartus 18.1 thinks those are the same and throws an error.
Vivado seems fine with it though.

module NamingClashes where
import Clash.Prelude

data SomeType = SomeType { boolField :: Bool, unsignedField :: (Unsigned 3) } deriving (Generic,NFDataX)
i = SomeType False 3


topEntity clk rst = withClockResetEnable clk rst enableGen $ mealy @System f i

{-# ANN topEntity
  (Synthesize { t_name = "NamingClashes"
              , t_inputs = [ PortName "clk", PortName "rst"
                           , PortProduct "" [ PortName "", PortName "unsignedField1"]
                           ]
              , t_output = PortName "result"
              }
  )#-}

f s x = (new,out)
  where
    SomeType _ unsignedField  = x
    new = s{unsignedField = succ unsignedField}
    out = unsignedField > 3

Workaround: compile with -fclash-no-escaped-identifiers

@leonschoorl leonschoorl changed the title "Duplicate name "Duplicate" names Sep 30, 2019
@christiaanb
Copy link
Member

Line 165 on page 179 of the VHDL LRM says: "Moreover, every extended identifier is distinct from any basic identifier."

So quartus is broken

@martijnbastiaan
Copy link
Member

If it's easy for us to do, I think we should not generate "duplicate" names. Even though it's not our fault, users might perceive Clash as broken due to this..

@christiaanb
Copy link
Member

I propose -fclash-hdlsyn Quartus to enable such work-arounds.

@christiaanb christiaanb added the intermediate Requires (some) knowledge of the clash compiler to implement label Sep 30, 2019
@workshub
Copy link

workshub bot commented Oct 3, 2019

This issue is now published on WorksHub. If you would like to work on this issue you can
start work on the WorksHub Issue Details page.

@workshub
Copy link

workshub bot commented Oct 3, 2019

If you successfully complete this Issue via WorskHub there's a $25 reward available.
Start work via WorksHub Issue Details page.

@workshub
Copy link

workshub bot commented Oct 15, 2019

@akilegaspi started working on this issue via WorksHub.

@christiaanb
Copy link
Member

@akilegaspi I'll be removing this issue from workshub, as we're going to fix this ourselves. That is, unless you have something that fixes this issue.

@martijnbastiaan martijnbastiaan self-assigned this Mar 19, 2020
@akilegaspi
Copy link

akilegaspi commented Mar 19, 2020 via email

@workshub workshub bot closed this as completed Mar 19, 2020
@christiaanb christiaanb reopened this Mar 19, 2020
@workshub
Copy link

workshub bot commented Aug 5, 2020

@tensor1995 started working on this issue via WorksHub.

@martijnbastiaan
Copy link
Member

@christiaanb Have you removed this issue from WorksHub?

@workshub workshub bot closed this as completed Aug 6, 2020
@christiaanb
Copy link
Member

don't reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement external bug Hacktoberfest intermediate Requires (some) knowledge of the clash compiler to implement
Projects
None yet
Development

No branches or pull requests

4 participants