SpinalHDL/SpinalCrypto

How to use this lib

TealerLinkGuo opened this issue · 19 comments

I want a document on how to use it,thank you!

There is none yet, right @Snoopy87 ?

There is a wiki page about SpinalCrypto . @TealerLinkGuo, if it miss something in the doc tell me and sorry for the delay, I didn't see the issue.

Hooo cool ! I wasn't ware :D

dnltz commented

@Dolu1990 Can we push this repo to maven as well? Cloning and pushing to the local packages is a little bit awkward when deploying a project.

@dnltz Ahhh in general, instead of pushing to local packages, i'm integrating libraries as SBT module :
https://github.com/SpinalHDL/SpinalTemplateSbtDependencies/blob/superproject/build.sbt#L19

It is more flexible, less heavy weight on release schedule.

Would that be good ?

dnltz commented

@Dolu1990 Well, yes ... that will actually work and indeed it's more flexible.

I added a reference in to the doc about this SpinalTemplate repository as an alternative.

@dnltz Ahhh in general, instead of pushing to local packages, i'm integrating libraries as SBT module : https://github.com/SpinalHDL/SpinalTemplateSbtDependencies/blob/superproject/build.sbt#L19

It is more flexible, less heavy weight on release schedule.

Would that be good ?

I cloned this project, and I excute sbt bloopInstall with scala(metals) extension of vscode. I found the following error

2022.04.20 17:37:55 INFO  [warn] 
2022.04.20 17:37:55 INFO  [warn] 	Note: Unresolved dependencies path:
2022.04.20 17:37:55 INFO  [error] Couldn't run bloopGenerate for root-test
2022.04.20 17:37:55 INFO  [error] Couldn't run bloopGenerate for root
2022.04.20 17:37:55 INFO  [success] Total time: 2 s, completed 2022-4-20 17:37:55
2022.04.20 17:37:55 INFO  time: ran 'sbt bloopInstall' in 8.51s
2022.04.20 17:37:55 WARN  Build server is not auto-connectable.
dnltz commented

@xueweiwujxw - This might be because of #15
Have you added the dependency for this project as recommended in https://github.com/SpinalHDL/SpinalCrypto/wiki/Getting-started#using-the-library-without-publishlocal?

@dnltz I tried https://github.com/SpinalHDL/SpinalTemplateSbtDependencies, and modified build.sbt as following:

val spinalVersion = "1.6.4"

lazy val root = (project in file("."))
  .settings(
    inThisBuild(List(
      organization := "com.github.spinalhdl",
      scalaVersion := "2.11.12",
      version      := "0.1.0-SNAPSHOT"
    )),
    name := "superproject",
    libraryDependencies ++= Seq(
      "com.github.spinalhdl" % "spinalhdl-core_2.11" % spinalVersion,
      "com.github.spinalhdl" % "spinalhdl-lib_2.11" % spinalVersion,
      compilerPlugin("com.github.spinalhdl" % "spinalhdl-idsl-plugin_2.11" % spinalVersion)
    )
  ).dependsOn(vexRiscv)

//For dependancies localy on your computer : 
//lazy val vexRiscv = RootProject(file("./ext/VexRiscv"))

//For dependancies on a git : 
lazy val vexRiscv = RootProject(uri("git://github.com/SpinalHDL/VexRiscv.git"))

//For dependancies on a git with a specific commit : 
//lazy val vexRiscv = RootProject(uri("git://github.com/SpinalHDL/VexRiscv.git#commitHash"))


fork := true

sbt run worked well, but scala(metals) extension of vscode did not work.
error: Fatal recursive dependency detected in 'root': List(root, root)
It might be because of Fatal recursive dependency

Maybe pusing this repo to maven can solve this problem.
Integrating libraries as SBT module is indeed more flexible.

If i understand well you are running SpinalHDL with scala metal, I never tried and have no idea how well it will go.

What "scala(metals) extension of vscode" do ?

If i understand well you are running SpinalHDL with scala metal, I never tried and have no idea how well it will go.

What "scala(metals) extension of vscode" do ?

Yes... It's an extension of vscode. I use it for code hint. Maybe it does hace some problems. Thanks a lot anyway.
And I cloned SpinalCrypto and pushed it to the local packages temporarily. This did work well.

Else, there is intellij with the scala plugin. Not perfect at all, but ho well XD

Would it be possible to publish this library on Maven?

For this repo, what's about adding instead an mill buildscript in parallel to the SBT one ? to easy its integration directly from source ?

I mean, overall, if each project need to be published to maven, things realy get heavyweight in terms of management XD

Yeah, I have it set up like that, but I guess since it's one of the projects published in SpinalHDL namespace it would be nice to have it published to central repo as well. This would make it much more accessible and maybe more development could happen.

When I see a library which is not published anywhere, I consider it somewhat experimental, and I have an “avoid if possible” flag in my head. Actually, if I wasn't using it for a non-critical function in the project, I would probably not use it at all.

If you think that things become heavyweight in terms of management, maybe it's time to incorporate more sophisticated CD into the project? One that would publish snapshots on development branch to snapshot repo (as discussed here) and publish versions basing on git tag.

maybe it's time to incorporate more sophisticated CD into the project? One that would publish snapshots on development branch to snapshot repo (as discussed SpinalHDL/SpinalHDL#793) and publish versions basing on git tag.

I guess it could. So in a first time, to automate the CD of SpinalHDL itself, once it work we could try on this repo ?
Do you feel up for trying getting the CD working on SpinalHDL repo itself ?

Yeah, I guess we can go with this approach. I could set up CD for SpinalHDL for sure. Next week I will be away on holidays, but I could work on that for sure in the beginning of September.

ok :)