Skip to content

Commit bbd640f

Browse files
committed
Use UartDebug in BitBang
1 parent 8764e40 commit bbd640f

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

7series.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ puts [irscan xc7.tap 0x09]
1818
puts [drscan xc7.tap 32 0]
1919

2020
puts "Programming FPGA..."
21-
pld load 0 build/UartDebug.bit
21+
pld load 0 build/BitBang.bit
2222
exit

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ vcd:
2727
synpath:
2828
source /home/shared/Xilinx/Vivado/2017.4/settings64.sh
2929

30-
HW = UartDebug
30+
HW = BitBang
3131

3232
synth:
3333
./vivado_synth.sh -t $(HW) -p xc7a100tcsg324-1 -x nexysA7.xdc -o build generated/$(HW).v

src/main/scala/debug/UartDebug.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,3 @@ class UartDebug(frequ: Int, baudRate: Int = 115200) extends Module {
157157
}
158158
io.dout := doutReg
159159
}
160-
161-
object UartDebug extends App {
162-
emitVerilog(new UartDebug(100000000), Array("--target-dir", "generated"))
163-
}

src/main/scala/spi/BitBang.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import chisel.lib.uart._
44
import chisel3._
55
import chisel3.util._
66

7+
import debug._
8+
79
/**
810
* This is the top level to for the UART output and a test blinking LED.
911
*/
@@ -20,17 +22,17 @@ class BitBang(frequ: Int) extends Module {
2022
})
2123
io.led := io.sw
2224

23-
val tx = Module(new BufferedTx(100000000, 115200))
24-
val rx = Module(new Rx(100000000, 115200))
25+
val dbg = Module(new UartDebug(100000000, 115200))
26+
27+
dbg.io.rx := io.rx
28+
io.tx := dbg.io.tx
29+
30+
dbg.io.din := ~dbg.io.dout
2531

26-
io.tx := tx.io.txd
27-
rx.io.rxd := io.rx
32+
val regVal = RegInit(0.U(3.W))
2833

29-
tx.io.channel.bits := '0'.U + io.miso
30-
tx.io.channel.valid := rx.io.channel.valid
31-
rx.io.channel.ready := true.B
32-
val regVal = RegEnable('0'.U + rx.io.channel.bits(3, 0), rx.io.channel.valid)
33-
io.led := io.miso ## regVal(2, 0)
34+
regVal := dbg.io.dout(2, 0)
35+
io.led := io.miso ## dbg.io.dout(2, 0)
3436

3537
io.sck := regVal(0)
3638
io.mosi := regVal(1)

0 commit comments

Comments
 (0)