Virtual platform with OpenRisc 2010/06/08 by Sean Chen
Agenda <ul><li>Physical platform </li></ul><ul><li>Virtual platform </li></ul><ul><li>How to Co-Work? </li></ul><ul><li>Ca...
Physical platform
Physical platform <ul><li>Requirements </li></ul><ul><ul><li>Physical hardware </li></ul></ul><ul><ul><ul><li>Your IP </li...
Physical platform <ul><li>Background </li></ul><ul><ul><li>Firmware </li></ul></ul><ul><ul><ul><li>Software control </li><...
Virtual platform Using the software platform to model the hardware components Benefits: Fast, build easily, debug quickly ...
Virtual platform V.S Physical platform <ul><li>Virtual platform </li></ul><ul><ul><li>High level control </li></ul></ul><u...
Virtual && Physical Co-Work Virtual platform Physical platform
Case for OpenRisc <ul><li>How to build the virtual platform </li></ul><ul><ul><li>Test model </li></ul></ul><ul><ul><ul><l...
OpenRisc <ul><li>Architecture </li></ul>JTAG UART
OpenRisc <ul><li>Memory Map </li></ul>Boot loader location
Requirements/SystemC/TLM <ul><li>What’s SystemC? </li></ul><ul><ul><li>SystemC processes can communicate in a  simulated  ...
Requirements/Toolchain <ul><li>what’s Toolchain? </li></ul><ul><ul><li>a  toolchain  is the set of  programming tools  tha...
Requirements/other tools <ul><li>Verilog-Perl </li></ul><ul><ul><li>Verilog Parser </li></ul></ul><ul><ul><li>Include </li...
Requirements/other tools <ul><li>Verilator </li></ul><ul><ul><li>Verilator is the fastest free Verilog HDL simulator, and ...
Getting start  1/2 <ul><li>Download requirements && Path set  </li></ul><ul><ul><li>Toolchain and other tools </li></ul></...
Getting start  2/2 <ul><li>Download orpsocv2 </li></ul><ul><ul><li>Ref:  http://opencores.org/openrisc,orpsocv2 </li></ul>...
Top Platform Host Test prog
How to write your test program? <ul><ul><li>Instruction support </li></ul></ul><ul><ul><ul><li>Assembly support </li></ul>...
UART sample case void except vectors… void syscall_except(){} void dpf_except(){} … Void uart_print_str(char *); Void uart...
UART sample case 0x000021b0 <main+0>:  l.addi  r1,r1,-8 0x000021b4 <main+4>:  l.sw  4(r1),r2 0x000021b8 <main+8>:  l.addi ...
How to run and simulation ? <ul><li>Software image creation  </li></ul><ul><ul><li>ELF files </li></ul></ul><ul><ul><li>Ve...
Event-driven simulation <ul><li>Default Icarus Verilog </li></ul><ul><ul><li>The event-driven simulation tests are configu...
Cycle-accurate simulation <ul><li>Load a program  </li></ul><ul><ul><li>#../vlt/Vorpsoc_top -f myapp.or32 </li></ul></ul><...
Cycle-accurate simulation <ul><li>Bus transactions log  </li></ul><ul><ul><li>#../vlt/Vorpsoc_top --bus-log  </li></ul></u...
Cycle-accurate simulation <ul><li>Memory dump </li></ul><ul><ul><li>dump memory area  </li></ul></ul><ul><ul><ul><li>#../v...
References <ul><li>OpenRisc </li></ul><ul><ul><li>http://opencores.org/openrisc,orpsocv2#own_software </li></ul></ul><ul><...
Upcoming SlideShare
Loading in...5
×

Virtual platform

751

Published on

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
751
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Virtual platform"

  1. 1. Virtual platform with OpenRisc 2010/06/08 by Sean Chen
  2. 2. Agenda <ul><li>Physical platform </li></ul><ul><li>Virtual platform </li></ul><ul><li>How to Co-Work? </li></ul><ul><li>Case for OpenRisc </li></ul><ul><li>Requirements </li></ul><ul><ul><li>SystemC /TLM </li></ul></ul><ul><ul><li>Toolchain </li></ul></ul><ul><ul><li>Other tools </li></ul></ul><ul><li>Getting Start </li></ul><ul><ul><li>How to write your test program? </li></ul></ul><ul><ul><li>UART sample case </li></ul></ul><ul><ul><li>How to run and simulation ? </li></ul></ul><ul><li>References </li></ul>
  3. 3. Physical platform
  4. 4. Physical platform <ul><li>Requirements </li></ul><ul><ul><li>Physical hardware </li></ul></ul><ul><ul><ul><li>Your IP </li></ul></ul></ul><ul><ul><ul><ul><li>Include JTAG interface </li></ul></ul></ul></ul><ul><ul><ul><li>External bridge </li></ul></ul></ul><ul><ul><ul><ul><li>Communication between host and target </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>FT232, MAX232… </li></ul></ul></ul></ul></ul><ul><ul><li>Software </li></ul></ul><ul><ul><ul><li>Driver </li></ul></ul></ul><ul><ul><ul><ul><li>FT232, MAX232 </li></ul></ul></ul></ul><ul><ul><ul><li>Tool-chain </li></ul></ul></ul><ul><ul><ul><ul><li>GDB debug </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Cross compiler (gcc 4 ARM) </li></ul></ul></ul></ul>
  5. 5. Physical platform <ul><li>Background </li></ul><ul><ul><li>Firmware </li></ul></ul><ul><ul><ul><li>Software control </li></ul></ul></ul><ul><ul><ul><ul><li>Compiler </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Tool chain </li></ul></ul></ul></ul><ul><ul><ul><ul><li>How to debug? </li></ul></ul></ul></ul><ul><ul><ul><li>hardware control </li></ul></ul></ul><ul><ul><ul><ul><li>Memory map </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Configure register </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Timing sequence </li></ul></ul></ul></ul>
  6. 6. Virtual platform Using the software platform to model the hardware components Benefits: Fast, build easily, debug quickly …. Effort: Model building (the Model accurately issue) Black Box (c) TDI TDO TMS TCLK TRST JTAG (SystemC) GDB (Client) Wrapper (SystemC) Console (Host)
  7. 7. Virtual platform V.S Physical platform <ul><li>Virtual platform </li></ul><ul><ul><li>High level control </li></ul></ul><ul><ul><ul><li>Software </li></ul></ul></ul><ul><ul><ul><ul><li>C / SystemC / GDB…. </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Dynamic </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Portable </li></ul></ul></ul></ul></ul><ul><li>Physical platform </li></ul><ul><ul><li>Low level control </li></ul></ul><ul><ul><ul><li>Hardware devices </li></ul></ul></ul><ul><ul><ul><ul><li>C </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Driver </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Memory map </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>Configure register </li></ul></ul></ul></ul></ul>Physical virtual
  8. 8. Virtual && Physical Co-Work Virtual platform Physical platform
  9. 9. Case for OpenRisc <ul><li>How to build the virtual platform </li></ul><ul><ul><li>Test model </li></ul></ul><ul><ul><ul><li>OpenRisc </li></ul></ul></ul><ul><ul><ul><ul><li>C / Verilog </li></ul></ul></ul></ul><ul><ul><li>Wrapper </li></ul></ul><ul><ul><ul><li>C 2 SystemC </li></ul></ul></ul><ul><ul><li>Cross Compiler </li></ul></ul><ul><ul><ul><li>executable </li></ul></ul></ul><ul><ul><ul><li>Debug </li></ul></ul></ul><ul><ul><li>Instruction set </li></ul></ul><ul><ul><ul><li>Instruction definition </li></ul></ul></ul><ul><ul><ul><ul><li>putc -> asm() </li></ul></ul></ul></ul><ul><ul><ul><ul><li>printf </li></ul></ul></ul></ul>
  10. 10. OpenRisc <ul><li>Architecture </li></ul>JTAG UART
  11. 11. OpenRisc <ul><li>Memory Map </li></ul>Boot loader location
  12. 12. Requirements/SystemC/TLM <ul><li>What’s SystemC? </li></ul><ul><ul><li>SystemC processes can communicate in a simulated real-time environment, using signals of all the datatypes offered by C++, some additional ones offered by the SystemC library, as well as user defined. In certain respects, SystemC deliberately mimics the hardware description languages VHDL and Verilog , but is more aptly described as a system-level modeling language </li></ul></ul><ul><li>What’s TLM? </li></ul><ul><ul><li>Transaction-level modeling (TLM) is a high-level approach to modeling digital systems where details of communication among modules are separated from the details of the implementation of functional units or of the communication architecture. Communication mechanisms such as busses or FIFOs are modeled as channels , </li></ul></ul>
  13. 13. Requirements/Toolchain <ul><li>what’s Toolchain? </li></ul><ul><ul><li>a toolchain is the set of programming tools that are used to create a product (typically another computer program or system of programs). The tools may be used in a chain, so that the output of each tool becomes the input for the next, but the term is used widely to refer to any set of linked development tools. </li></ul></ul><ul><li>Requirements </li></ul><ul><ul><li>GNU compiler (cross compiler) </li></ul></ul><ul><ul><ul><li>GCC </li></ul></ul></ul><ul><ul><ul><li>GDB </li></ul></ul></ul><ul><ul><ul><li>Lib … </li></ul></ul></ul><ul><ul><ul><li>Patch </li></ul></ul></ul>
  14. 14. Requirements/other tools <ul><li>Verilog-Perl </li></ul><ul><ul><li>Verilog Parser </li></ul></ul><ul><ul><li>Include </li></ul></ul><ul><ul><ul><li>Syntax Tree </li></ul></ul></ul><ul><ul><ul><li>SigParser </li></ul></ul></ul><ul><ul><ul><li>Netlist </li></ul></ul></ul><ul><ul><ul><li>… </li></ul></ul></ul><ul><li>System-Perl </li></ul><ul><ul><li>SystemPerl is a version of the SystemC language. It is designed to expand text so that needless repetition in the language is minimized. By using sp_preproc , SystemPerl files can be expanded into C++ files at compile time, or expanded in place to make them valid stand-alone SystemC files. </li></ul></ul>
  15. 15. Requirements/other tools <ul><li>Verilator </li></ul><ul><ul><li>Verilator is the fastest free Verilog HDL simulator, and beats many commercial simulators. It compiles synthesizable Verilog (not test-bench code!), plus some PSL, SystemVerilog and Synthesis assertions into C++ or SystemC code </li></ul></ul>
  16. 16. Getting start 1/2 <ul><li>Download requirements && Path set </li></ul><ul><ul><li>Toolchain and other tools </li></ul></ul><ul><ul><ul><li>Ref: http://funningboy.blogspot.com/2010/05/openrisc-4-install.html </li></ul></ul></ul><ul><ul><li>Waveform or simulation tool </li></ul></ul><ul><ul><ul><li>gtkwave / Modelsim( default Icarus Verilog simulation) </li></ul></ul></ul><ul><li>File lists </li></ul><ul><ul><li>or32-elf </li></ul></ul><ul><ul><ul><li>bin </li></ul></ul></ul><ul><ul><ul><li>Include </li></ul></ul></ul><ul><ul><ul><li>lib </li></ul></ul></ul><ul><ul><ul><li>… </li></ul></ul></ul><ul><ul><li>Or1ksim-0.0.3 (software link) </li></ul></ul>
  17. 17. Getting start 2/2 <ul><li>Download orpsocv2 </li></ul><ul><ul><li>Ref: http://opencores.org/openrisc,orpsocv2 </li></ul></ul><ul><li>File lists </li></ul><ul><ul><li>sw </li></ul></ul><ul><ul><ul><li>Our test program location </li></ul></ul></ul><ul><ul><li>Sim </li></ul></ul><ul><ul><ul><li>Our simulation result and Makefile location </li></ul></ul></ul><ul><ul><li>rtl </li></ul></ul><ul><ul><ul><li>orpsocv2 rtl verilog code </li></ul></ul></ul><ul><ul><li>Bench </li></ul></ul><ul><ul><ul><li>Systemc interface 2 orpsocv2 </li></ul></ul></ul><ul><ul><li>Boards </li></ul></ul><ul><ul><ul><li>Real board support (xilinx) </li></ul></ul></ul><ul><ul><li>Backend </li></ul></ul><ul><ul><ul><li>Lib and pll define </li></ul></ul></ul>
  18. 18. Top Platform Host Test prog
  19. 19. How to write your test program? <ul><ul><li>Instruction support </li></ul></ul><ul><ul><ul><li>Assembly support </li></ul></ul></ul><ul><ul><ul><ul><li>Register type </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Instruction set </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Memory address /space </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Control sequence </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Exception </li></ul></ul></ul></ul>*.S Compiler *.c *.bin void or32_exit (int i) { asm(&quot;l.add r3,r0,%0&quot;: : &quot;r&quot; (i)); asm(&quot;l.nop %0&quot;: :&quot;K&quot; (NOP_EXIT)); while (1); }
  20. 20. UART sample case void except vectors… void syscall_except(){} void dpf_except(){} … Void uart_print_str(char *); Void uart_print_long(unsigned long); Int main(){ uart_init(); uart_print_str(“Hello World. ”); report(0xdeaddead); or32_exit(0); } Name: uart_init() //set control register / status register REG8(UART_BASE+UART_IER) = 0x00; … //set baud rate devisor = IN_CLK/(16 * UART_BAUD_RATE); REG8(UART_BASE+UART_LCR) |= UART_LCR_DLAB … . Name : reset() //reset register , status , interrupt , and DMA… Name : main() //pc pointer to main Name : or32_exit()
  21. 21. UART sample case 0x000021b0 <main+0>: l.addi r1,r1,-8 0x000021b4 <main+4>: l.sw 4(r1),r2 0x000021b8 <main+8>: l.addi r2,r1,8 0x000021bc <main+12>: l.sw 0(r1),r9 0x000021c0 <main+16>: l.jal <uart_init> 0x000021c4 <main+20>: l.nop 0 0x000021c8 <main+24>: l.movhi r3,0x0 0x000021cc <main+28>: l.ori r3,r3,0x3da4 0x000021d0 <main+32>: l.jal <uart_print_str> 0x000021d4 <main+36>: l.nop 0 0x000021d8 <main+40>: l.movhi r3,0xdead 0x000021dc <main+44>: l.jal <report> 0x000021e0 <main+48>: l.ori r3,r3,0xdead 0x000021e4 <main+52>: l.jal <or32_exit> 0x000021e8 <main+56>: l.addi r3,r0,0 0x000021ec <main+60>: l.lwz r9,0(r1) 0x000021f0 <main+64>: l.lwz r2,4(r1) 0x000021f4 <main+68>: l.jr r9 0x000021f8 <main+72>: l.addi r1,r1,8 store current PI (program pointer) 2 main function Call uart_init
  22. 22. How to run and simulation ? <ul><li>Software image creation </li></ul><ul><ul><li>ELF files </li></ul></ul><ul><ul><li>Verilog Memory (VMEM) files </li></ul></ul><ul><ul><ul><li>This is a hex format suitable for loading into Verilog simulations </li></ul></ul></ul><ul><ul><li>command </li></ul></ul><ul><ul><ul><li># or32-elf-objcopy -O binary myapp.or32elf myapp.bin </li></ul></ul></ul><ul><ul><ul><li>#bin2vmem myapp.bin > myapp.vmem </li></ul></ul></ul>
  23. 23. Event-driven simulation <ul><li>Default Icarus Verilog </li></ul><ul><ul><li>The event-driven simulation tests are configured mainly by a single command file for Icarus. This command file is generated for each test. Another generated file is a header file defining some things such as the name of the test </li></ul></ul><ul><ul><li>Command </li></ul></ul><ul><ul><ul><li>#vvp a.out </li></ul></ul></ul><ul><ul><ul><li>#vvp -M../../bench/verilog/vpi/c -mjp_vpi a.out </li></ul></ul></ul>
  24. 24. Cycle-accurate simulation <ul><li>Load a program </li></ul><ul><ul><li>#../vlt/Vorpsoc_top -f myapp.or32 </li></ul></ul><ul><li>Enable debugging via GDB </li></ul><ul><ul><li>#../vlt/Vorpsoc_top -r portNum </li></ul></ul><ul><li>Standard log file (human readable) </li></ul><ul><ul><li>#../vlt/Vorpsoc_top --log executed.log </li></ul></ul><ul><li>Binary log file </li></ul><ul><ul><li>#../vlt/Vorpsoc_top --binlog executed.binlog </li></ul></ul><ul><li>Reading a binary log file </li></ul><ul><ul><li>#../../sw/utils/binlog2readable executed.binlog -o executed.log </li></ul></ul>
  25. 25. Cycle-accurate simulation <ul><li>Bus transactions log </li></ul><ul><ul><li>#../vlt/Vorpsoc_top --bus-log </li></ul></ul><ul><li>VCD generation </li></ul><ul><ul><li>VCD dump </li></ul></ul><ul><ul><ul><li>#../vlt/Vorpsoc_top --vcdfile mydump.vcd </li></ul></ul></ul><ul><ul><li>VCD dump with time set </li></ul></ul><ul><ul><ul><li>#../vlt/Vorpsoc_top --vcdfile mydump.vcd --vcdstart 15000 --vcdstop 25000 </li></ul></ul></ul>
  26. 26. Cycle-accurate simulation <ul><li>Memory dump </li></ul><ul><ul><li>dump memory area </li></ul></ul><ul><ul><ul><li>#../vlt/Vorpsoc_top --memdump memdump.bin 0x2000 0x10000 </li></ul></ul></ul><ul><li>Crash monitor </li></ul><ul><ul><li>#../vlt/Vorpsoc_top -c </li></ul></ul>
  27. 27. References <ul><li>OpenRisc </li></ul><ul><ul><li>http://opencores.org/openrisc,orpsocv2#own_software </li></ul></ul><ul><li>embecosm </li></ul><ul><ul><li>http://www.embecosm.com/ </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×