Clearning + Verilog

This commit is contained in:
Dolu1990
2016-06-12 13:37:11 +02:00
parent 10b9b7da7d
commit 330e655c3e
2 changed files with 40 additions and 6 deletions

View File

@@ -23,24 +23,25 @@ import spinal.lib._
class MyTopLevel extends Component {
val io = new Bundle {
val cond0 = in Bool
val cond1 = in Bool
val flag = out Bool
val state = out UInt(8 bit)
val cond0 = in Bool
val cond1 = in Bool
val flag = out Bool
val state = out UInt(8 bits)
}
val counter = Reg(UInt(8 bit)) init(0)
val counter = Reg(UInt(8 bits)) init(0)
when(io.cond0){
counter := counter + 1
}
io.state := counter
io.flag := (counter === 0) | io.cond1
io.flag := (counter === 0) | io.cond1
}
object MyTopLevel {
def main(args: Array[String]) {
SpinalVhdl(new MyTopLevel)
//SpinalVerilog(new MyTopLevel)
}
}