The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application...
Transcript of The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application...
![Page 1: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/1.jpg)
Introduction Problem Version 1 Redone Application Conclusion
The J1 CPUJames Bowman
Willow Garage, Inchttp://www.willowgarage.com
November 19, 2010
![Page 2: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/2.jpg)
Introduction Problem Version 1 Redone Application Conclusion
The PR2
Six cameras, all connected via Ethernet:! Two wide-angle color cameras in head! Two narrow-angle monochrome cameras in head! One color camera in each hand
Nobody makes a small enough Ethernet camera, so we madeone
The J1 CPUJames Bowman
![Page 3: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/3.jpg)
Introduction Problem Version 1 Redone Application Conclusion
The WGE
Ingredients:! Aptina 640x480 sensor! 100BASE-TX Ethernet PHY! 8 Mbit flash! Xilinx Spartan R!FPGA - XC3S500E
Requirements:! uncompressed 640x480 at 30 fps, is 9 Mbytes/s over UDP! external sync (<30 µs) for stereo! field software upgrade
Constraints:! 36 Kbytes of RAM in FPGA, 16 KBytes for code! Imager does not wait! Must handle network commands while streaming video
The J1 CPUJames Bowman
![Page 4: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/4.jpg)
Introduction Problem Version 1 Redone Application Conclusion
First version
! MicroBlaze core! gcc based toolchain from Xilinx! 32-bit, 40 MIPS
The J1 CPUJames Bowman
![Page 5: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/5.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Running out
! code took all of the 16KByte! not fast enough to stream video data...! ...so needed DMA controllers! quite a lot of Verilog
The J1 CPUJames Bowman
![Page 6: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/6.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Not alone
... actually implementing that code with the limited instructionspace provided by the BRAM of the microblaze was a completenightmare. Code optimization went from an afterthought to thetop of our priority list, after each step we took and after everyfunction we coded, it was necessary to optimize the code inorder to fit in our extremely limited instruction space, otherwise,debugging was impossible because compilation wasimpossible.http://www.cs.columbia.edu/~sedwards/classes/2006/4840/reports/Web-Server.pdf
The J1 CPUJames Bowman
![Page 7: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/7.jpg)
Introduction Problem Version 1 Redone Application Conclusion
J1: minimal CPU core
! 16-bit instructions, data! 100MIPS fast enough to stream video data in software! unencoded hardwired instruction encoding
The J1 CPUJames Bowman
![Page 8: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/8.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Instruction formats
0123456789101112131415
1 value!
literal
0123456789101112131415
0 0 0 target!
jump
0123456789101112131415
0 0 1 target!
conditional jump
0123456789101112131415
0 1 0 target!
call
0123456789101112131415
0 1 1
R!
PC
T !
T!
N
T!
RN!
[T]
rsta
ck±
dsta
ck±
!ALU
The J1 CPUJames Bowman
![Page 9: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/9.jpg)
Introduction Problem Version 1 Redone Application Conclusion
ALU operations
code operation0 T1 N2 T + N3 TandN4 TorN5 TxorN6 " T7 N = T8 N < T9 NrshiftT
10 T # 111 R12 [T ]13 NlshiftT14 depth15 Nu<T
The J1 CPUJames Bowman
![Page 10: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/10.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Max Factoring
: 1+ 1 + ;: negate invert 1+ ;: - negate + ;
! call is always single-cycle! returns are free! deep stacks
The J1 CPUJames Bowman
![Page 11: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/11.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Cycle timing
The J1 CPUJames Bowman
![Page 12: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/12.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Code Size
component MicroBlaze J1code size (bytes)
I2C 948 132SPI 180 104flash 948 316ARP responder 500 122entire program 16380 6349
The J1 CPUJames Bowman
![Page 13: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/13.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Comparisons
MicroBlaze+C J1+Forth
CPU lines of Verilog 6000 200program (Kbytes) 16 6Clock (MHz) 42 80Toolchain build time ?? about zero
The J1 CPUJames Bowman
![Page 14: The J1 CPU - ForthJames Bowman The J1 CPU. Introduction Problem Version 1 Redone Application Conclusion J1: minimal CPU core! 16-bit instructions, data! 100MIPS fast enough to stream](https://reader033.fdocuments.us/reader033/viewer/2022042606/5f6e5b18eacf7332d002398c/html5/thumbnails/14.jpg)
Introduction Problem Version 1 Redone Application Conclusion
Conclusion
! Much easier to make a Forth CPU! Much less code so more maintainable! We can fit more features in
The J1 CPUJames Bowman