You're reading an old version of this documentation.
For the latest stable release version, please have a look at master.

Assignement overlap

Introduction

SpinalHDL will check that no signal assignement completely erases a previous one.

Example

The following code

class TopLevel extends Component {
  val a = UInt(8 bits)
  a := 42
  a := 66 //Erease the a := 42 :(
}

will throw the following error:

ASSIGNMENT OVERLAP completely the previous one of (toplevel/a :  UInt[8 bits])
  ***
  Source file location of the a := 66 assignement via the stack trace
  ***

A fix could be:

class TopLevel extends Component {
  val a = UInt(8 bits)
  a := 42
  when(something){
    a := 66
  }
}

But in the case you really want to override the previous assignement (Yes, it could make sense in some cases), you can do the following:

class TopLevel extends Component {
  val a = UInt(8 bits)
  a := 42
  a.allowOverride
  a := 66
}