Skip to content

Commit

Permalink
Towards blinking
Browse files Browse the repository at this point in the history
  • Loading branch information
schoeberl committed Jul 16, 2024
1 parent 1b725fe commit 88825e8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
47 changes: 47 additions & 0 deletions asm/test/blink.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@


start:
loadi 0
loadhi 2
store r0
ll1:
loadi 255
loadhi 255
ll2:
subi 1
nop
brnz ll2
nop
load r0
subi 1
store r0
brnz ll1
nop

loadi 0
stind 0

loadi 0
loadhi 2
store r0
ll3:
loadi 255
loadhi 255
ll4:
subi 1
nop
brnz ll4
nop
load r0
subi 1
store r0
brnz ll3
nop

loadi 1
stind 0

loadi 1
nop
brnz start

3 changes: 2 additions & 1 deletion src/main/scala/leros/Leros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class Leros(prog: String, size: Int = 32, memAddrWidth: Int = 8) extends LerosBa
// connection to the external world (test)
val exit = RegInit(false.B)
val outReg = RegInit(0.U(32.W))
outReg := accu
io.led := outReg

switch(stateReg) {
Expand Down Expand Up @@ -118,6 +117,8 @@ class Leros(prog: String, size: Int = 32, memAddrWidth: Int = 8) extends LerosBa
when(decReg.isStoreInd) {
dataMem.io.wr := true.B
alu.io.enaMask := 0.U
// TODO: this is a super quick hack to get the LED blinking
outReg := accu
}
when(decReg.isStoreIndB) {
dataMem.io.wr := true.B
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/leros/util/Assembler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object Assembler {
if (true)
getProgramFix()
else {
// FERTL does not like large vectors
// FIRRTL does not like large vectors
val code = new Array[Int](200)
for (i <- 0 until code.length) {
code(i) = ((i << 8) + i+1) & 0xffff
Expand Down

0 comments on commit 88825e8

Please sign in to comment.