Sometime, creating a Component to define some logic is overkill.
Sometime, creating a Component to define some logic is overkill. For this kind of cases you can use Area to define a group of signals/logic.
val tickConter = new Area{ val tick = Reg(UInt(8 bits) init(0) tick := tick + 1 }
Assignable trait
Abstract base class of all Spinal types
Base type Cast
Base type factory
Represent the number of bit of a data
BitVector is a family of types for storing multiple bits of information in a single value.
BitVector is a family of types for storing multiple bits of information in a single value. This type has three subtypes that can be used to model different behaviours:
Base class to create Bit Vector from literal
The Bits type corresponds to a vector of bits that does not convey any arithmetic meaning.
The Bits type corresponds to a vector of bits that does not convey any arithmetic meaning.
val myBits1 = Bits(32 bits) val myBits2 = B(25, 8 bits) val myBits3 = B"8'xFF" val myBits4 = B"1001_0011
Bits factory used for instance by the IODirection to create a in/out Bits
Bitwise Operation
Bitwise Operation
the type which is associated with the bitwise operation
A blackbox allows the user to integrate an existing VHDL/Verilog component into the design by just specifying the interfaces.
A blackbox allows the user to integrate an existing VHDL/Verilog component into the design by just specifying the interfaces.
class Ram_1w_1r(wordWidth: Int, wordCount: Int) extends BlackBox { val generic = new Generic { val wordCount = Ram_1w_1r.this.wordCount val wordWidth = Ram_1w_1r.this.wordWidth } val io = new Bundle { val clk = in Bool val wr = new Bundle { val en = in Bool val addr = in UInt (log2Up(wordCount) bit) val data = in Bits (wordWidth bit) } val rd = new Bundle { val en = in Bool val addr = in UInt (log2Up(wordCount) bit) val data = out Bits (wordWidth bit) } } mapClockDomain(clock=io.clk) }
Create a blackBox with std_ulogic instead of std_logic
The Bool type corresponds to a boolean value (True or False)
The Bool type corresponds to a boolean value (True or False)
val myBool = Bool() myBool := False myBool := Bool(false)
Bundle for the edge detection
Bool factory used for instance by the IODirection to create a in/out Bool
The Bundle is a composite type that defines a group of named signals (of any SpinalHDL basic type) under a single name.
The Bundle is a composite type that defines a group of named signals (of any SpinalHDL basic type) under a single name. The Bundle can be used to model data structures, buses and interfaces.
val cmd = new Bundle{ val init = in Bool val start = in Bool val result = out Bits(32 bits) }
clock and reset signals can be combined to create a clock domain.
clock and reset signals can be combined to create a clock domain. Clock domains could be applied to some area of the design and then all synchronous elements instantiated into this area will then implicitly use this clock domain. Clock domain application work like a stack, which mean, if you are in a given clock domain, you can still apply another clock domain locally
Clock Area with a specila clock enable
Clock domains could be applied to some area of the design and then all synchronous elements instantiated into this area will then implicitly use this clock domain.
Clock domains could be applied to some area of the design and then all synchronous elements instantiated into this area will then implicitly use this clock domain.
Abstract class used to create a new Component
Abstract class used to create a new Component
class MyAndGate extends Component { val io = new Bundle{ val a,b = in Bool val res = out Bool } io.res := io.a & io.b }
Cycles number representation
Should not extends AnyVal, Because it create kind of strange call stack move that make error reporting miss accurate
target device
Node representation which contains the value of an SpinalEnumElement
Exponent representation
Create a generic for a BlackBox
Create a generic for a BlackBox
class myMemory(sizeMem: Int) extends BlackBox{ val generic = new Generic{ val size = sizeMem } val io = new Bundle { ... } }
Global data
Get a link to the globalData
Frequency representation
Trait used to set the direction of a data
Create an Area which can be assign to a data
Create an Area which can be assign to a data
class Counter extends ImplicitArea[UInt]{ val cnt = Reg(UInt(8 bits) ... override def implicitValue: UInt = cnt } val myCounter = Counter() io.myUInt = myCounter
Masked Literal
Masked Literal
val itMatch = myBits === M"00--10--" // - don't care value
Min max base function
Base class for multi data like Vec, Bundle
Base operations for numbers
Base operations for numbers
the type which is associated with the base operation
Base class for the Physical representation (Hertz, Time, ...)
Position representation
Ram 1w 1ra
Ram 1w 1rs
Ram 1wors
Ram 1wrs
Ram 2c 1w 1rs
Ram 2wrs
Use to give value by reference to a function
ResetArea allow to reset an area with a special reset combining with the current reset (cumulative)
Signed fix point
Signed fix point
The SInt type corresponds to a vector of bits that can be used for signed integer arithmetic.
The SInt type corresponds to a vector of bits that can be used for signed integer arithmetic.
val mySInt = SInt(8 bits) mySInt := S(4, 8 bits) + S"0000_1111" mySInt := S(4) - S"h1A"
SInt factory used for instance by the IODirection to create a in/out SInt
Safe Stack
Slice size representation
Define a clock domain which is x time slower than the current clock
Spinal configuration for the generation of the RTL
Base class for creating enumeration
Base class for creating enumeration
class MyEnum extends SpinalEnum(binarySequancial){ val s1, s2, s3, s4 = newElement() }
SpinalEnum contains a list of SpinalEnumElement that is the definition of an element. SpinalEnumCraft is the hardware representation of the the element.
Hardware representation of an enumeration
Definition of an element of the enumeration
Trait to define an encoding
Spinal report give after the generation of the RTL
Time representation
Unsigned fix point
Unsigned fix point
Two-dimensional XFix
The UInt type corresponds to a vector of bits that can be used for unsigned integer arithmetic.
The UInt type corresponds to a vector of bits that can be used for unsigned integer arithmetic.
val myUInt = UInt(8 bits) myUInt := U(2,8 bits) myUInt := U(2) myUInt := U"0000_0101" myUInt := U"h1A"
Define an UInt 2D point
Define an UInt 2D point
width of the x point
width of the y point
val positionOnScreen = Reg(UInt2D(log2Up(p.screenResX) bits, log2Up(p.screenResY) bits))
UInt factory used for instance by the IODirection to create a in/out UInt
The Vec is a composite type that defines a group of indexed signals (of any SpinalHDL basic type) under a single name
The Vec is a composite type that defines a group of indexed signals (of any SpinalHDL basic type) under a single name
val myVecOfSInt = Vec(SInt(8 bits), 2)
Vec factory
else / else if statement
else / else if statement
Base class for SFix and UFix
Set a data to Analog
Used to create a new Bits or cast to Bits
Create a new Bits of a given width
Create a new Bits of a given width
Create a new Bits
Create a new Bits
Create a new Bool initialized with a boolean value
Create a new Bool initialized with a boolean value
Create a new Bool
Create a new Bool
Concatenate a list of data
Mux operation
Create a register
Declare a register with an initialize value
Register a signal of one clock
Register a signal when a condition is true
Used to create a new SInt or cast to SInt
Two-dimensionnal SFix
Create a new SInt of a given width
Create a new SInt of a given width
Create a new SInt
Create a new SInt
Used to create a custom encoding
Used to create a custom encoding
object BR extends SpinalEnum{ val NE, EQ, J, JR = newElement() defaultEncoding = SpinalEnumEncoding("opt")( EQ -> 0, NE -> 1, J -> 2, JR -> 3 ) }
Spinal map
Used to create a new UInt or cast to UInt
Two-dimensionnal UFix
Create a new UInt of a given width
Create a new UInt of a given width
Create a new UInt
Create a new UInt
Binary One hot encoding
Binary One hot encoding
000, 010, 100
Binary Sequential
Binary Sequential
000, 001, 010, 011, 100, 101, ....
Return a new data with the same data structure than the given parameter (including bit width)
default statement of a switch case
default statement of a switch case
Set a data to input
Set a data to in if the data is not null
Inferred encoding
Set a data to inout
is statement of a switch case
is statement of a switch case
Check if a number is a power of 2
Give number of bit to encode a given number of states
Native encoding
Transform all unsigned/signed into std_logic_vector
Set a data to output
Set a data to out if the data is not null
Round up a BigInt
case/switch statement
case/switch statement
switch(x){ is(value1){ //execute when x === value1 } is(value2){ //execute when x === value2 } default{ //execute if none of precedent condition meet } }
Create a Ulogic tag used by Blackbox in order to transform std_logic into std_ulogic
Return a new data with the same data structure than the given parameter (execept bit width)
If statement
If statement
when(cond1){ myCnt := 0 }elsewhen(cond2){ myCnt := myCnt + 1 }otherwise{ myCnt := myCnt - 1 }
Return the number of bit of the given data
Sel operation
Sel operation
Use Select instead
Use cloneable instead