Code Monkey home page Code Monkey logo

spinal-bootcamp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spinal-bootcamp's Issues

Bug in the last exercise of chapter 2.7

Description

I copy this code to my intellij:

class MySub extends Component {
    val io = new Bundle{
        val a = in UInt(8 bits)
        val b = out UInt(8 bits)
    }
    io.b := RegNext(io.a) init(0)
}
class Top extends Component {
    val io = new Bundle{
        val a0,a1 = in UInt(8 bits)
        val cg_en0,cg_en1 = in Bool
        val b  = out UInt(8 bits)
    }
    val gated_clk0: Bool = CG(clockDomain, io.cg_en0, False)
    val gated_clk1: Bool = CG(clockDomain, io.cg_en1, False)
    
    val cgd0 = ClockDomain(gated_clk0, clockDomain.readResetWire)
    val cgd1 = ClockDomain(gated_clk1, clockDomain.readResetWire)
    cgd0.setSyncWith(cgd1)   // set Two clock Family as synchronous , valid on SpinalHDL1.3.7
    val u_sub0 = cgd0(new MySub)
    val u_sub1 = cgd1(new MySub)
    
    u_sub0.io.a := io.a0
    u_sub1.io.a := io.a1
    io.b := RegNext(u_sub0.io.b + u_sub1.io.b) init 0
}

In this code,the synchronous information is indicated

    cgd0.setSyncWith(cgd1)   // set Two clock Family as synchronous , valid on SpinalHDL1.3.7

But there are still errors about cross domain.Why?

CLOCK CROSSING VIOLATION :

  • Source : (toplevel/u_sub0/io_a_regNext : UInt[8 bits]) java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  • Source clock : (toplevel/[CG]/ECK : out Bool)
  • Destination : (toplevel/??? : UInt[8 bits]) java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  • Destination clock : (clk : Bool)
  • Source declaration :

Environment:

OS:WIN10
Intellij IDEA:2019.3.3
JDK:1.8
Scala:2.11.12
SpinalHDL:1.4.1

Errors running showRTL()

scala version 2.12.18
almond 0,5
jdk 1.8
os: windows 11

No matter with VSCODE or Jupyter, showRTL() produces the errors:

java.lang.AbstractMethodError: com.sun.jna.Structure.getFieldOrder()Ljava/util/List;
  com.sun.jna.Structure.fieldOrder(Structure.java:936)
  com.sun.jna.Structure.getFields(Structure.java:962)
  com.sun.jna.Structure.deriveLayout(Structure.java:1129)
  com.sun.jna.Structure.calculateSize(Structure.java:1053)
  com.sun.jna.Structure.calculateSize(Structure.java:1006)
  com.sun.jna.Structure.allocateMemory(Structure.java:393)
  com.sun.jna.Structure.<init>(Structure.java:184)
  com.sun.jna.Structure.<init>(Structure.java:172)
  com.sun.jna.Structure.<init>(Structure.java:159)
  com.sun.jna.Structure.<init>(Structure.java:151)
  com.sun.jna.platform.win32.WinNT$OSVERSIONINFOEX.<init>(WinNT.java:1934)
  com.sun.jna.platform.win32.VersionHelpers.IsWindowsVersionOrGreater(VersionHelpers.java:59)
  com.sun.jna.platform.win32.VersionHelpers.IsWindows7OrGreater(VersionHelpers.java:154)
  oshi.hardware.platform.windows.WindowsCentralProcessor.initProcessorCounts(WindowsCentralProcessor.java:157)
  oshi.hardware.common.AbstractCentralProcessor.<init>(AbstractCentralProcessor.java:73)
  oshi.hardware.platform.windows.WindowsCentralProcessor.<init>(WindowsCentralProcessor.java:77)
  oshi.hardware.platform.windows.WindowsHardwareAbstractionLayer.createProcessor(WindowsHardwareAbstractionLayer.java:60)
  oshi.util.Memoizer$1.get(Memoizer.java:87)
  oshi.hardware.common.AbstractHardwareAbstractionLayer.getProcessor(AbstractHardwareAbstractionLayer.java:66)
  spinal.sim.SimManager$.cpuCount$lzycompute(SimManager.scala:72)
  spinal.sim.SimManager$.cpuCount(SimManager.scala:70)
  spinal.sim.SimManager$.newCpuAffinity(SimManager.scala:76)
  spinal.core.fiber.EngineContext.<init>(AsyncCtrl.scala:17)
  spinal.core.fiber.Engine$.create(AsyncCtrl.scala:143)
...
  spinal.core.SpinalConfig.generate(Spinal.scala:163)
  ammonite.$file.dummy.source.load$minusspinal$Helper.showRtl(Main.sc:38)
  ammonite.$sess.cmd12$Helper.<init>(cmd12.sc:7)
  ammonite.$sess.cmd12$.<init>(cmd12.sc:7)
  ammonite.$sess.cmd12$.<clinit>(cmd12.sc:-1)

Is there a way to fix this?

申请升级一下环境

目前的环境无法使用 pipeline
引入 pipeline , 提示如下 :

cmd2.sc:8: object pipeline is not a member of package spinal.lib
import spinal.lib.pipeline._
^Compilation Failed
Compilation Failed

Broken link in readme

On the version owned by SpinalHDL, there is a link in the README which does not work, with these issues:

Found built image, launching...
Launching server...
Server requested
2022-10-13T09:19:48Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2da7fxqzu7 to svko-ilcm04
2022-10-13T09:19:25Z [Normal] Created container block-cloud-metadata
2022-10-13T09:19:48Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2da7fxqzu7 to svko-ilcm04
2022-10-13T09:19:48Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2da7fxqzu7 to svko-ilcm04
2022-10-13T09:19:48Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2da7fxqzu7 to svko-ilcm04
Spawn failed: Timeout
Launch attempt 1 failed, retrying...
Server requested
2022-10-13T09:25:07Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2deectjatw to spko-css-app03
Launch attempt 2 failed, retrying...
Server requested
2022-10-13T09:30:27Z [Normal] Successfully assigned bhub-ns/jupyter-jijingg-2dspinal-2dbootcamp-2diltn4m3h to spko-css-app03
2022-10-13T09:30:51Z [Normal] Container image "jupyterhub/k8s-network-tools:1.2.0" already present on machine
2022-10-13T09:30:52Z [Normal] Created container block-cloud-metadata
2022-10-13T09:31:01Z [Normal] Started container block-cloud-metadata
2022-10-13T09:31:06Z [Normal] Pulling image "gesiscss/binder-r2d-g5b5b759-jijingg-2dspinal-2dbootcamp-d3ef7f:883e3261e1539ce4f27f302f74df8bec4bfaa77b"
Failed to connect to event stream

fail to download Spinalhdl

Hi,
When I try to execute following code:
val path = System.getProperty("user.dir") + "/source/load-spinal.sc"
interp.load.module(ammonite.ops.Path(java.nio.file.FileSystems.getDefault().getPath(path)))

I will encounter following error:
ammonite.util.CompilationError: Failed to resolve ivy dependencies:Error downloading com.github.spinalhdl:spinalhdl-core_2.13:1.4.1
not found: /Users//.ivy2/local/com.github.spinalhdl/spinalhdl-core_2.13/1.4.1/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom

According to https://repo1.maven.org/maven2/com/github/spinalhdl/, there is no 2.13 version available.

I try to replace all 2.13 to 2.12 in 1.1-Spinal-quick-start.ipynb file and then rerun, however, it doesn't work - still same error messages.

I'd like to ask how to fix this issue. Thanks in advance for the help!

A simple example for checking spinal-sim environment

copy and paste the following code to your project, then make sure this pure simple case work on your env.

import spinal.core._
import spinal.core.sim._

object EnvCheckSim extends App{
  class Sawtooth extends Component{
    val io = new Bundle{
      val inc       = in  Bool()
      val sawtooth  = out UInt(5 bits)
    }
    val myReg = Reg(UInt(5 bits)) init 0
    when(io.inc){
      myReg := myReg + 1
    }
    io.sawtooth := myReg
  }

  SimConfig
    .allOptimisation
    .workspacePath("./simWorkspace")
    .withFstWave
    .compile(new Sawtooth)
    .doSimUntilVoid("Sawtooth") { dut =>
      dut.clockDomain.forkStimulus(2)
      sleep(10)
      dut.io.inc #= false
      dut.clockDomain.waitSampling(10)
      dut.io.inc #= true
      sleep(1000)
      simSuccess()
    }
}

'ReConfig your Soc' of Chapter 1.1-Spinal-quick-start.ipynb

when execute In[6] of this .ipynb, fail to run. The error message is below

cmd6.sc:4: not found: value IS42x320D
sdramLayout = IS42x320D.layout,
^cmd6.sc:5: not found: value IS42x320D
sdramTimings = IS42x320D.timingGrade7,
^Compilation Failed
Compilation Failed

compilerPlugin fixed

Summary

latest commit 980282a failed with the following information:

[Progress] at 0.486 : Elaborate components
spinal.core.SpinalExit: 

 dslScope stack is not empty :(
********************************************************************************
********************************************************************************

Design's errors are listed above.
SpinalHDL compiler exit stack :

Reason

because the latest SpinalHDL1.4.0 using idsl-plugin. so
compilerPlugin("com.github.spinalhdl" % "spinalhdl-idsl-plugin_2.11" % "1.4.0") should be added

Status

   compilerPlugin("com.github.spinalhdl" % "spinalhdl-idsl-plugin_2.11" % "1.4.1")

instead

import $plugin.$ivy.`com.github.spinalhdl::spinalhdl-idsl-plugin:1.4.0`

Where can I find the introduction of library methods?

I often encounter some methods like Stream.s2mPipe() that I don't know what to do.There are very few comments in the source code, and most methods have no comment.I can only find part of the explanation on the SpinalHDL Document.However, There are so few explanations that I can't understand them and the version of spinal HDL document is only 1.3.8.
So when you encounter a method that you don't understand, in addition to looking at the source code, what better way to understand it?

SpinalHDL libraries will not load

I am unable to load the SpinalHDL libraries, both on macOS and on Linux. All the tools are installed and the Scala kernel is running.

Downloading https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom
Downloaded https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom
Downloading https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom.sha1
Downloaded https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom.sha1
ammonite.util.CompilationError: Failed to resolve ivy dependencies:Error downloading com.github.spinalhdl:spinalhdl-core_2.13:1.4.1
  not found: /Users/domenic/.ivy2/local/com.github.spinalhdl/spinalhdl-core_2.13/1.4.1/ivys/ivy.xml
  not found: https://repo1.maven.org/maven2/com/github/spinalhdl/spinalhdl-core_2.13/1.4.1/spinalhdl-core_2.13-1.4.1.pom
  ammonite.interp.Interpreter$$anon$1$load$.module(Interpreter.scala:693)
  ammonite.$sess.cmd0$Helper.<init>(cmd0.sc:2)
  ammonite.$sess.cmd0$.<clinit>(cmd0.sc:7)

The issue is probably with the version number. spinalhdl-core_2.13 does not exit at https://repo1.maven.org. Only version 2.11 and 2.12 do exist. How can I change the version number. I did not find anything in the load-spinal.sc file to change that.

Broken with Java 11 on Ubuntu

When opening the Jupyter notebook, it gets stuck with "kernel starting... please wait".

On the Jupyter notebook log, I find the message:

scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.

And that leads me to think it is the Java version. I changed the Java version on Ubuntu by running sudo update-alternatives --config java and selection java-8. Then, I was able to run the notebook (see below)

I think it would be good to include this in the documentation. Also, please include the coursier installation command. It wasn't clear to me the first time around even though you do make note of it at the end of the README.

./coursier launch almond:0.5.0 --scala 2.12.8 -- --install

(base) ➜  ~ java -version 
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
(base) ➜  ~ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode

A example I can't understand in chapter 3.1

This example is from chapter 3.1-RBG.

case class Rgb(channelWidth: Int) extends Bundle{
  val r = UInt(channelWidth bits)
  val g = UInt(channelWidth bits)
  val b = UInt(channelWidth bits)
  def init(x: Int): Rgb = {
    val ret = cloneOf(this)
    ret.r := U(x)
    ret.g := U(x)
    ret.b := U(x)
    ret
  }
  def clear = {
    this.r := 0
    this.g := 0
    this.b := 0
  }
  // override def clone :Rgb = Rgb.asInstanceOf[this.type]
}

class Top extends Component{
  val a = slave Flow(Rgb(8))
  val flush = in Bool()
  val b = master Flow(Rgb(8))

  val retReg = RegNext(a.payload) init 0   //how to

  when(flush){
    retReg.clear
  }
  b.payload := retReg
  b.valid := True

}

I think the RTL this code describes is like this picture below.
微信截图_20200814131155

module Top (
  input               a_valid,
  input      [7:0]    a_payload_r,
  input      [7:0]    a_payload_g,
  input      [7:0]    a_payload_b,
  input               flush,
  output              b_valid,
  output     [7:0]    b_payload_r,
  output     [7:0]    b_payload_g,
  output     [7:0]    b_payload_b,
  input               clk,
  input               reset
);
  reg        [7:0]    a_payload_regNext_r;
  reg        [7:0]    a_payload_regNext_g;
  reg        [7:0]    a_payload_regNext_b;
  reg        [7:0]    retReg_r;
  reg        [7:0]    retReg_g;
  reg        [7:0]    retReg_b;

  always @ (*) begin
    retReg_r = a_payload_r;
    if(flush)begin
      retReg_r = 8'h0;
    end
  end

  always @ (*) begin
    retReg_g = a_payload_g;
    if(flush)begin
      retReg_g = 8'h0;
    end
  end

  always @ (*) begin
    retReg_b = a_payload_b;
    if(flush)begin
      retReg_b = 8'h0;
    end
  end

  assign b_payload_r = a_payload_regNext_r;
  assign b_payload_g = a_payload_regNext_g;
  assign b_payload_b = a_payload_regNext_b;
  assign b_valid = 1'b1;
  always @ (posedge clk or posedge reset) 
  if(reset)
    begin
      a_payload_regNext_r <= 8'h0;
      a_payload_regNext_g <= 8'h0;
      a_payload_regNext_b <= 8'h0;
    end
  else
    begin
      a_payload_regNext_r <= retReg_r;
      a_payload_regNext_g <= retReg_g;
      a_payload_regNext_b <= retReg_b;
    end


endmodule

But the code generated is like what is error.
微信截图_20200814130302

module Top (
  input               a_valid,
  input      [7:0]    a_payload_r,
  input      [7:0]    a_payload_g,
  input      [7:0]    a_payload_b,
  input               flush,
  output              b_valid,
  output     [7:0]    b_payload_r,
  output     [7:0]    b_payload_g,
  output     [7:0]    b_payload_b,
  input               clk,
  input               reset
);
  reg        [7:0]    a_payload_regNext_r;
  reg        [7:0]    a_payload_regNext_g;
  reg        [7:0]    a_payload_regNext_b;
  reg        [7:0]    retReg_r;
  reg        [7:0]    retReg_g;
  reg        [7:0]    retReg_b;

  always @ (*) begin
    retReg_r = 8'h0;
    if(flush)begin
      retReg_r = 8'h0;
    end
  end

  always @ (*) begin
    retReg_g = 8'h0;
    if(flush)begin
      retReg_g = 8'h0;
    end
  end

  always @ (*) begin
    retReg_b = 8'h0;
    if(flush)begin
      retReg_b = 8'h0;
    end
  end

  assign b_payload_r = retReg_r;
  assign b_payload_g = retReg_g;
  assign b_payload_b = retReg_b;
  assign b_valid = 1'b1;
  always @ (posedge clk) begin
    a_payload_regNext_r <= a_payload_r;
    a_payload_regNext_g <= a_payload_g;
    a_payload_regNext_b <= a_payload_b;
  end


endmodule

Can you tell me if I understand it wrong, or is there a bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.