Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

VHDL: How to include simulation only signals that can be prevented from synthesizing

Status
Not open for further replies.

matrixofdynamism

Advanced Member level 2
Joined
Apr 17, 2011
Messages
565
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,369
When debugging entities, we may create new signals that are only to be used for debug purpose and no intention to actually synthesize them in the final design exists. Is there a way to do this in VHDL such that these signals can be enabled or disabled in synthesis using a single enable variable or with a "touch of a button"? Otherwise one would have to go through all the design entities and remove them manually.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,940
Helped
14,339
Reputation
28,942
Reaction score
13,084
Trophy points
1,393
Location
Bochum, Germany
Activity points
282,369
Most tools support synthesis attributes for this purpose. Review your documentation.
Code:
-- synthesis translate_off
  debug only code
-- synthesis translate_on

The other point to consider is that signals without fanout aren't synthesized. In so far it's not necessarily required to comment all simulation related code.
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,848
Helped
1,815
Reputation
3,640
Reaction score
1,778
Trophy points
1,393
Location
USA
Activity points
59,287
The other point to consider is that signals without fanout aren't synthesized. In so far it's not necessarily required to comment all simulation related code.

Not required, but very helpful in reducing the number of warnings you have to sift through to make sure the synthesis is clean.
 

matrixofdynamism

Advanced Member level 2
Joined
Apr 17, 2011
Messages
565
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,369
WOW. Thankyou so much dude.

Can you give me an example of how to use this?
 
Last edited:

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,848
Helped
1,815
Reputation
3,640
Reaction score
1,778
Trophy points
1,393
Location
USA
Activity points
59,287
Can you give me an example of how to use this?
FvM already gave you an example in #2. You just put the code you don't want to synthesize between the commented lines:
Code:
[COLOR="#FF0000"][B]-- synthesis translate_off[/B][/COLOR]
  --place the code you don't want in your synthesized design between these two synthesis statements
[COLOR="#FF0000"][B]-- synthesis translate_on[/B][/COLOR]
 

matrixofdynamism

Advanced Member level 2
Joined
Apr 17, 2011
Messages
565
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,369
hahaha, I was searching for the debug only code in the VHDL manual. I think that this phrase was some sort of command. Little did I know that the command is the comment itself, rather unusual that is.
 

TrickyDicky

Advanced Member level 5
Joined
Jun 7, 2010
Messages
7,082
Helped
2,078
Reputation
4,173
Reaction score
2,034
Trophy points
1,393
Activity points
39,298
Its not actually part of VHDL. Its a synthesisor directive. synthesis translate_off seems to be well accepted now, but all of these will probabyl work:

--synthesis translate_off
--synopsys translate_off
--pragma translate_off
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,848
Helped
1,815
Reputation
3,640
Reaction score
1,778
Trophy points
1,393
Location
USA
Activity points
59,287
Just don't forget to add the translate_on later on after your debug code.

FYI the synthesis directive is exactly the same in Verilog:

//synthesis translate_off
//synopsys translate_off
//pragma translate_off

But I prefer using `ifdef around debug code as I can also remove it from the simulation if so desired by removing it from the simulators command line without having to modify my code. Trouble is with the synthesis directives the simulator doesn't recognize them and will always compile the debug code even if you don't want it compiled.

Another option (if you're willing to have extra generics in your code for debug purposes) is to add a debug generic to the entity ports and bring it all the way up to the top level entity, where you can have the simulation enable the debug code (by setting the generic at compile time). The debug code is written such that there is a genarate-if structure around it, so it only exists if the debug generic is "true".

Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top