http://www.64kib.com/redmine/http://www.64kib.com/redmine/redmine/favicon.ico?16973035742017-09-01T19:06:43Z64kibEclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=3952017-09-01T19:06:43Zfoft
<ul></ul><p>So I'm now thinking about ditching my address decoder rework and doing something more fundamental.</p>
<p>Using this CPU to build a complete system with a large linear address space. With SDRAM, block ram, custom chips, pbi and the 'zpu regs' (usb controller, sd card dma etc). Possible using wb_conmax or wb_conbuilder for the interconnect.</p>
<p>Then once that is working plugging the 6502 and antic on top as additional bus masters - with an 'original' -> linear address mapping, throttle and pbi access logic.</p>
<p>All just ideas right now. Despite not really writing any code for some time I've been researching/thinking about what to do.</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=3962017-09-01T20:59:07Zsadospsadosp@gmail.com
<ul></ul><p>foft wrote:</p>
<blockquote>
<p>So I'm now thinking about ditching my address decoder rework and doing something more fundamental.</p>
<p>Using this CPU to build a complete system with a large linear address space. With SDRAM, block ram, custom chips, pbi and the 'zpu regs' (usb controller, sd card dma etc). Possible using wb_conmax or wb_conbuilder for the interconnect.</p>
<p>Then once that is working plugging the 6502 and antic on top as additional bus masters - with an 'original' -> linear address mapping, throttle and pbi access logic.</p>
<p>All just ideas right now. Despite not really writing any code for some time I've been researching/thinking about what to do.</p>
</blockquote>
<p>:-)</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=3972017-09-02T06:58:49Z917k
<ul></ul><p>Sounds cool. I am wondering what this will do for the project, I mean what would this actually mean to the end user?</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=3982017-09-02T07:14:05Z917k
<ul></ul><p>Sounds cool!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=3992017-09-02T09:00:28Zsadospsadosp@gmail.com
<ul></ul><p>917k wrote:</p>
<blockquote>
<p>Sounds cool. I am wondering what this will do for the project, I mean what would this actually mean to the end user?</p>
</blockquote>
<p>Î’eyond the technical part that I really do not fully understand, I think is an effort of Mark to stimulate the interest of some developer who is familiar with the FPGA programming! I hope some day someone to help him..... In reality to help all us...</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4002017-09-03T11:37:39Zfoft
<ul></ul>There are several problems with the current setup:
<ul>
<li>The firmware is constrained by the current ZPU setup. Its hard to debug and tricky to add more memory to it.</li>
<li>I'm struggling to meet timing requirements, due to the over-complex interconnect glue. </li>
<li>I've been keen to go towards running the core at 116MHz instead of the current 58MHz, which will allow 32x mode cache-less and I can use fully registered cycles. Currently you may have spotted that 32x and 16x are very close on sysinfo?</li>
</ul>
<p>I don't see why we shouldn't expose the RISC V CPU to the end user, so it would be a large modern system. Still with 100% compatibility. Well I might stick a 2nd PIA in the 6502 memory map to allow access to the RISC V and registers.</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4012017-09-03T11:40:21Zfoft
<ul></ul><p>To Panos' comment. Yeah I'd love some help, if someone could help me define the memory map and write the firmware for the RISC V that would be an enormous help. There are also many HDL parts that need doing if anyone fancies working on the hardware.</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4022017-09-06T19:44:41Zfoft
<ul></ul><p>I've managed to get the spinal HDL project compiled, so now have a verilog or vhdl file for the CPU. It seems to have 3 ports. Instruction master, data master and debug slave. So I will need to map them into wishbone. They are also in their own format so I need to do some simple adaptors to map it to wishbone, which I think I almost understand how to do!</p>
<p>This article explains a little on how the debugging via GDB can work: <a class="external" href="https://riscv.org/wp-content/uploads/2016/01/Tues1030-RISC-V-External-Debug.pdf">https://riscv.org/wp-content/uploads/2016/01/Tues1030-RISC-V-External-Debug.pdf</a><br />It looks like I need to map some rom and ram in as well as the debug port. I'm not yet clear how I connect from JTAG to the system bus, to allow GDB to write to the debug port.</p>
<p>I grabbed the compiler from here and it seems to 'just run' which is good: <a class="external" href="https://www.sifive.com/products/tools/">https://www.sifive.com/products/tools/</a></p>
<p>Pretty pleased with progress, but its baby steps yet!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4032017-09-07T17:43:29Zfoft
<ul></ul><p>The author of the cpu kindly got back to me with some details.</p>
<p>The wishbone interface adaptor looks pretty easy.</p>
<p>Apparently the chip uses a non-standard debugging interface though. Which is good actually since its simpler. However he uses a different jtag interface so I need to do some work. He has a patched opened that can talk to the cpu at <a class="external" href="https://github.com/SpinalHDL/openocd_riscv">https://github.com/SpinalHDL/openocd_riscv</a>. This can be used with GDB. It needs adapting to talk via the USB blaster though.</p>
<p>So I have to build the usb blaster jtag side though. Some handy reading on that:<br /><a class="external" href="https://www.altera.com/en_US/pdfs/literature/ug/ug_virtualjtag.pdf">https://www.altera.com/en_US/pdfs/literature/ug/ug_virtualjtag.pdf</a><br /><a class="external" href="https://www.altera.com/support/training/course/ovjtag1110.html">https://www.altera.com/support/training/course/ovjtag1110.html</a></p>
<p>Possibly more useful though are some real examples:<br /><a class="external" href="http://idle-logic.com/2012/04/15/talking-to-the-de0-nano-using-the-virtual-jtag-interface/">http://idle-logic.com/2012/04/15/talking-to-the-de0-nano-using-the-virtual-jtag-interface/</a><br /><a class="external" href="https://github.com/binary-logic/vj-uart">https://github.com/binary-logic/vj-uart</a></p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4072017-09-08T20:06:15Zfoft
<ul></ul><p>Been trying out openocd locally with the cpu running in verilator. gdb connects, code loads and runs. Pretty cool! OK I just ran some commands as documented but I'm still pleased:-)</p>
<p>I'm very impressed with this riscv cpu project - seems like it'll be a real step up from the zpu. Not to mention that it'll be nice to be able to run code from any of the ram!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4082017-09-08T20:21:20Zsadospsadosp@gmail.com
<ul></ul><p>:-)</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4092017-09-10T19:24:42Zfoft
<ul></ul><p>I read up on the 'altera virtual jtag' and think I now understand how to get this connected, at least in theory.</p>
<p>I guess next steps that might make sense are:<br />i) Build a core with virtual jtag and signal tap and try to send it equivalent commands to those used by the vexriscv cpu.<br />ii) Modify the openocd code to talk to this and check commands make it to the core<br />iii) Build a core with just vexriscv and block ram and try running some code via gdb.<br />iv) Wire up the wishbone interconnect and check this still works<br />v) Add the sdram, zpu regs, usb, sd card and atari chips as wishbone slaves.<br />vi) Write some c code to display something using gtia (antic is not yet a master!) and play audio via pokey.<br />vii) Add 6502 and antic as bus masters - with address translation layer<br />viii) Check acid still works loading from aspeqt! We'll have no firmware/drive emulation/keyboard support yet. yet.<br />ix) Rewrite firmware...</p>
<p>This might take a while, but we will end up in a much better place I think!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4132017-09-17T12:00:26Zfoft
<ul></ul><p>Still on step(i) but progressing well!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4142017-09-17T14:10:59Zsadospsadosp@gmail.com
<ul></ul><p>foft wrote:</p>
<blockquote>
<p>Still on step(i) but progressing well!</p>
</blockquote>
<p>Great to hear good news for this, regardless of the time of progress. :-)</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4152017-09-18T01:45:46Z917k
<ul></ul><p>Keep up the good work, foft. We do appreciate all the time and effort you put in!</p>
<p>Thank you.</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4162017-09-21T19:46:06Zfoft
<ul></ul><p>Step(i) completed:<br />Select JTAG chain connected to USB-Blaster [1-1].</p>
<p>Select device: @1: 5CE(BA4|FA4) (0x02B050DD).<br />(8 bits instruction, 32 bits address, 32 bits data, write 1 bit, size 2 bits)<br />Write 4 times into my 4 deep fifo...<br />Writing - 000000000000000011111111000000001111111100000000000000000000000000000000100<br />Writing - 000000001111111100000000111111110000000000000000000000000000000011111111001<br />Writing - 000000000000000011111111000000001111111100000000000000001111111111111111110<br />Writing - 000000001111111100000000111111110000000010101010101010101010101010101010011</p>
<p>Which for now then just plumbs back the data to the response...<br />Read - 0000000000000000000000000000000000<br />Read - 0000000000000000000000001111111100<br />Read - 0000000000000000111111111111111100<br />Read - 1010101010101010101010101010101000</p>
<p>So far so good! Well I may have bits in the wrong order, but can check that in next steps. One annoying feature... signal tap does not work at the same time as virtual tag, or at least I can't tap virtual jtag stuff properly. Which kind of makes sense since they are both using the jtag.</p>
<p>Onto step (ii). I have openocd talking to the usb blaster. I need to adapt the commands to talk to the virtual jtag. Fortunately there is an example in or1k code base, if I can work out how to plumb it!</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4172017-09-24T19:55:33Zfoft
<ul></ul><p>Pinned some code from the or1k code base and openocd is running and communicating with the virtual tag I think.</p>
<p>Trying some test commands with it and they seem to make it though, but backwards. Trying to switch jtag shift register direction.</p>
<p>So step(ii) is <em>almost</em> complete...</p> EclaireXL - Feature #55: Replace main CPUhttp://www.64kib.com/redmine/issues/55?journal_id=4182017-09-26T19:35:18Zfoft
<ul></ul><p>OK, fixed step(ii) and some bugs...</p>
<p>Now it starts to get more fun, onto step (iii)</p>