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

Distinguish between simulation tools with defines #381

Closed
wants to merge 5 commits into from

Conversation

JuanSapriza
Copy link
Contributor

Structure changes

I modified the folders under sw/device/target. Now they are as follow

├── pynq-z2
│   └── x-heep.h
├── questasim
│   └── x-heep.h
├── vcs
│   └── x-heep.h
└── verilator
    └── x-heep.h

Inside each file, the new defines and messages are:

#pragma message ( "the x-heep.h for QUESTASIM is used" )
. . . 
#define UART_BAUDRATE       256000
#define TARGET_SIM          1
#define TARGET_QUESTASIM    1

This way conditional compilation can be achieved by differentiating between method (SIM/FPGA) or tool (VERILATOR, PYNQ_Z2,...)


Application changes

Applications used to have a warning if the target was TARGET_SIM when the limitation only applied to verilator. Now I have added a forced

return EXIT_SUCCESS 

only if the target is TARGET_VERILATOR.

Additionally, the define TARGET_PYNQ_Z2 was changed for TARGET_FPGA except for those situations where the conditional was placed to decide on pynq-z2 specific details (like pins).

🙏 Please check if I have done this properly, as in some cases I was unsure.


⚠️ IMPORTANT: Usage changes

Now, the make app command needs to take the simulation tool, not only TARGET=sim.
The default tool is verilator. Other options are questasim, vcs and pynq-z2.

@JuanSapriza JuanSapriza marked this pull request as ready for review September 14, 2023 08:12
@JuanSapriza JuanSapriza deleted the pr_target_macro branch May 16, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant