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

Better formatting #26

Open
numero-744 opened this issue Nov 25, 2022 · 5 comments
Open

Better formatting #26

numero-744 opened this issue Nov 25, 2022 · 5 comments
Assignees

Comments

@numero-744
Copy link
Collaborator

numero-744 commented Nov 25, 2022

@Dolu1990 convinced me that even if SpinalHDL enables the user to abstract the wires, sometimes the user wants to manipulate wire-by-wire so aligning stuff would be great.

In https://github.com/numero-744/Aes there is a repository fully auto-formatted using scalafmt, with alignments (=, :=, #= and port), using port syntax for better rendering.

Also, I have added a few idioms as VSCode snippets, I wrote the full snippets as comments in the files where I would use them, but don't forget it is even shorter with auto-formatting 😉

See the readme of the repository for more information.

I'll open a PR to merge some stuff from that repository once Spinal 1.8 has been released with the port notation. Before that, comments appreciated 😃

PS: We could also merge some stuff in SpinalHDL itself?

@numero-744 numero-744 self-assigned this Nov 25, 2022
@Dolu1990
Copy link
Member

PS: We could also merge some stuff in SpinalHDL itself?

Related to the AES ?

There is also https://github.com/SpinalHDL/SpinalCrypto

So i don't know what is better. As crypto is a realy realy realy large field, maybe it is better to keep things in standalone libraries ?

@numero-744
Copy link
Collaborator Author

Related to the AES ?

No, it was mainly about the scalafmt configuration.

The AES itself is just for demo, it is inspired from school work (initially done in VHDL at school with a different structure).

I only use it as a demo for SpinalHDL stuff to demonstrate features:

  • With SpinalHDL I can express things the way I think them, with short-but-expressive code.
  • It has useful libraries such as FSM
  • Here I added snippets / idioms I suggest
  • It has really nice auto-formatting

I don't want to merge this AES into anything ^^'

@numero-744
Copy link
Collaborator Author

numero-744 commented Nov 28, 2022

FYI while working on SpinalHDL/SpinalHDL#161 I've added -> alignment on the AES repository, see the test file: numero-744/Aes/hw/spinal/aes/Rcons.scala.

@Dolu1990
Copy link
Member

No, it was mainly about the scalafmt configuration.

Ahhh sure ^^

FYI while working on SpinalHDL/SpinalHDL#161 I've added -> alignment on the AES repository, see the test file: numero-744/Aes/hw/spinal/aes/Rcons.scala.

Hmm one question is :
Is that alignement forced by the formating tool ? or allowed by it ?

@numero-744
Copy link
Collaborator Author

Alignments are performed by scalafmt, but formatting can be locally disabled, for instance: https://github.com/numero-744/Aes/blob/main/hw/spinal/aes/SBox.scala#L28

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

No branches or pull requests

2 participants