SpinalHDL / SpinalCrypto

SpinalHDL - Cryptography libraries
MIT License
50 stars 19 forks source link

How to use this lib #10

Open TealerLinkGuo opened 3 years ago

TealerLinkGuo commented 3 years ago

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

Dolu1990 commented 3 years ago

There is none yet, right @Snoopy87 ?

Snoopy87 commented 3 years ago

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.

Dolu1990 commented 3 years ago

Hooo cool ! I wasn't ware :D

dnltz commented 2 years ago

@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.

Dolu1990 commented 2 years ago

@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 2 years ago

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

Dolu1990 commented 2 years ago

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

xueweiwujxw commented 2 years ago

@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 2 years ago

@xueweiwujxw - This might be because of https://github.com/SpinalHDL/SpinalCrypto/pull/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?

xueweiwujxw commented 2 years ago

@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.

Dolu1990 commented 2 years ago

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 ?

xueweiwujxw commented 2 years ago

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.

Dolu1990 commented 2 years ago

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

MarekPikula commented 2 years ago

Would it be possible to publish this library on Maven?

Dolu1990 commented 2 years ago

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

MarekPikula commented 2 years ago

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.

Dolu1990 commented 2 years ago

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 https://github.com/SpinalHDL/SpinalHDL/discussions/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 ?

MarekPikula commented 2 years ago

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.

Dolu1990 commented 2 years ago

ok :)