Any response to my question Pik? Have you modeled your Verilog on the Prop2 or have you completely developed your own version?
I am trying to understand if this could ever be produced in hardware without the DE2 and without having to get a chip fabbed.
The P2 Verilog code has not been released. The instructions for the P2 are not back-compatible with the P1 (or P1V).
pik33's P1V has a lot of customised sections so we are probably unlikely to see it in silicon
Right. Thanks Cluso. I thought with the talk of how many prop2 cores each different fpga board supported it had. Must have been talking theoretical only.
Does anyone know what the exact Cyclone 4 chip is that is on the DE2-115? Also, would it be possible to program this or the prop code into the newer DE2i-150 which has more LE's but costs about the same?
DE2i-150 will be suitable for this thing with one exception: there is no sound chip available on FPGA side.
The system now uses ~26k LEs.; the Propeller is ~14k, the rest contains about 10 k LEs.
My P1V is not that much customized; the core of the retromachine is a SRAM/VGA/sound controller module which communicates with P1V via Port B which was extended to 96 bits - 3x32 bit buses for address, data in and data out. My Propeller has then mul instruction added and video circuit removed to save some LEs and compilation time, and then boot loader changed to make it start from its own HUB RAM, which can be predefined in FPGA environment.
New version 0.97a
Update: audio buffer is now 1024 longs, from $84000 to $843FF
Synth sample length register bit 31 set "one shot" synth mode: it stops when it reaches sample end.
$8D000-$8D007 - synth woorking registers, read only, 0..3 current counter value, 4..7 currens sample address
To play audio:
fat.openfile(string("006.wav"),"R")
repeat
c:=fat.readdata(@buffer3,2048)
repeat until ina[4]==1
vga.blit2(@buffer3,$84000,512)
c:=fat.readdata(@buffer3,2048)
repeat until ina[4]==0
vga.blit2(@buffer3,$84200,512)
until c<>2048
repeat i from $84000 to $843FF
vga.poke(i,0)
The buffer3 has of course to be declared and vga is attached spin object. Replace 006 with your wav file name. fat is Kye's SD driver object. The mysz.def file is attached to the post #1.
Attached .pof and .sof. and then then (still chaotic) driver .spin to make use of it.
I have the DE-115 without the Prop2 emulator board connected, with the VGA, keyboard and sound connected to the main board. I have programmed in retro-097a to the board then reset (button 1).
I get the four green led's light (cogs) and then it displays 050 in the 7 segment display, pauses for about 30 seconds then does two beeps repeatedly. After about 2 minutes, it then did start playing music.
I have nothing on the VGA display though. I am using the 013.zip from above. Monitor reports signal out of range. It is a 1920 x1080 VGA monitor, as follows:
It plays sidcog demo file. The famous Ahle's sidcog demo which starts with two beeps.
The signal is out of range because it is 1920x1200.
No additional hardware needed. PropPlug may be useful to program this thing.
Edit: demo@1920x1080 attached to the post #40
When playing sid music from 013 file, there are some fragments which should play @150 or 200 Hz - use switches 0..2 to set playing speed.
The retromachine's Propeller can be programmed in standard way (propplug in gpio). The memory and port map is in the post #29. The vnfg0092 gives you low-level access to memory and registers (peek, poke methods)
For 1920x1080, try this. This is full source of sidcog demo. Also, there is eeprom file, which can be renamed to boot.sys and placed on SD (and the machine will boot it)
1920x1080 settings are still non standard, but I can see a picture on attached 1920x1080 monitor - the verilog code has to be rweritten to replace all hardcoded constants which makes setting resolution other than 1920x1200 hard. The $8F002 register (right border pixel start) has to be something very close to 1953 or the effect may be (not at all) interesting. Then all of the rest has to be adjusted to match this.Then there is hardcoded @ 152 MHz pixel clock - it should be 148 MHz for 1920x1080x60
My monitor is 1920x1200 and cannot detect 1920x1080 and that is why this works in 1920x1200.
Later I added the VGA timing registers to make software control of the resolution possible. Then I got 1680x1050 working.
Today I tried the 1920x1080 monitor at the university; after some problems I got a stable picture on it. So there are a demo files for this resolution. Try it
So I think there will be a switch, for example SW17, which will select the resolution to boot the machine with. This is easy (Propeller boot program will check the SW and then change the resolution)
What will be harder is to find and replace all hardcoded constants in verilog code so it will not fail when the resolution change.
And then I need to add some more graphic mode definitions based on 1920x1080; then, to make possible to run the same program in 1920x1200 and 1920x1080 there should be the same graphic modes - only adding some wider upper and lower borders when 1920x1200 resolution is set
To do.
Now I think it can work @ 1920x1080, too, with 0.97a version and changes I made in the Propeller software.
There is still a lot to do - there is no system software, no Basic, etc.
I am trying to understand how your code hangs together, and most of my confusion I believes come from an unfamiliarity with Quartus II.
Could you point me at any resources geared around learning this system? The help files and tutorials that come with the DE2 are very basic and don't cover any of the design. I have a book on verilog, but I can see there are also AHDL and BDF schematics here.
I want to make my own prop like board using multiple props on the DE2 and I'm struggling to see how this works.
The original p1v is verilog and AHDL mix.
I created a block symbol from it. Then I added some changes found here which I think are useful: MUL and unscrambled ROM.
The unscrambled ROM allowed me to change it, so the p1v can start directly from its RAM.
Then I added Port B and splitted it into 3 parts: inb, outb and dirb. Then I used dirb as an address bus and inb and outb as one direction data bus. I removed then video geerator to save some LEs
I also splitted 8 lower bits of port A to have some additional inputs. Bidirs are good when connected to gpio, but not good when using them inside an FPGA.
P8..P17 are left on GPIO. Then P18..P27 I used for i/o in DE2-115 - i2c, sd and ps2. P28..29 are reserved for eeprom, p30..31 are connected to gpio pins for the propplug.
Then I wrote a verilog module for vga/sram and audio chip. The sdram controler I found on the de2-115 cd. I didn't change it.
Then I connected all of these in the block diagram editor.
I didn't need more than 1 prop, but adding the second one is simple: add the second prop block on the diagram. 5 or 6 props will fit.
Thanks both of you for the detailed. I am trying to recreate the DracBlade on the DE-115. I have the schematic all entered and configured and compiling ok now, just trying to make sure it is fully booting the ROM image correctly. Not east to debug at times
Oh damn. Made a schoolboy error. Read the EEPROM on the DE0115 as a 32KB EEPROM when it is actually only a 32Kb EEPROM.
What is the best way to add an SPI EEPROM to do the design which the prop can boot from? I can see a megafunction for an SPI memory chip.
I should add the reason I want to design it this way, is I would like to prototype something I will eventually make as a real prop board. The DracBlade is just a convenient starting point for me.
Way 1. Emulate the eeprom using onboard flash chip
Way 2. Replace the eeprom on the DE2-115. It is soldered on the down side of it and it is easy to replace
Way 3. Use the modified bootloader from my retromachine's p1v. It boots from the hub ram. You can predefine the hub ram in Quartus. Then you can make a SD booter
The eeprom for the Propeller seems to be i2c rather than spi.
SW17 select resolution at boot. Off - 1920x1200, on - 1920x1080
Playfield/sprite priority and collision registers added - old software will not display sprites with this version.
The zip file contains .pof, .sof and spin demos
This seems to be last version before 1.0. To make 1.0 the code need to be cleaned and the comments added and/or moved to the right place.
So I dodn't add the sources here until I make 1.0 or someone will be interested in these bad commented sources.
I tried to remove some hardcoded constants to make resolution changes easier, but this causes complicating the thing and it stopped to work properly, so they are still there
The Propeller tool recognises the unimplemented instructions but as far as I know the others tools don't.
You will have to substitute MUL with a LONG definition instead.
I use the propeller tool
Then there is Propeler IDE with modified OpenSpin available on this forum. This version supports all P1V extensions done so far.
Changes: ports $8302D, 8302E,8302F added to make blitting easier
Setting non zero value (0..31) in $8302D will shl (if bit31==1) or shr data before it is written to SRAM. (SRAM ionly, not SDRAM or registers)
Shifted out bits of data will then be used in next write operation. You can preset these bits writing to $8302E
Value in $8302F will be added to R/W address (SRAM operation only) so if you can prepare the second frame buffer without any recalculation in software.
Attached .sof and .pof
I need to rewrite the demo to show new functions.. but now I have an idea to add Amiga-like HAM mode...
Modes 12..15 are the same resolution as modes 8..11 with 448 horizontal pixel @ 8bpp The difference is interpretation.
Bits 7..6 = 00 - use pallette color 0..63
01 - set red to bits 5..0<<2
10 - set green to bits 5..0<<2
11 - set blue to bits 5..0<<2
Changes: Propeller pins P14..P17 connected to UART instead of GPIO
P14: RXD
P15: TXD
P16: RTS
P17: CTS
so you can use RS232 port on DE2-115. This was done to prepare to connect this machine to MIDI keyboard which will use MIDI to RS232 cable without any additional board. I want to hide the optoisolator and rest or needed parts in the RS232 plug, then use TXD and CTS to power the optoisolator. Then use RXD to get midi data from the keyboard
If you want the code in its still badly commented version 0.98b I can put it here Still no time to sit and make some cleaning - there are new ideas or bugfixes I am still adding here and there.
Then there is the driver. Version 0.98 I added to the last zip is somewhere cleaned and commented, but when I did this, I added at least one bug I cannot find. The booter when compiled with 0.92 version of the driver works OK; compiled with 0.98 shows only black screen, don't know why. The demo works OK; it needs 0.98 driver to test and use these new features I added. The demo needs rewriting; it doesn't show HAM graphic modes and some other possibilities; I use it to test if the compilation works - all of this hardware is near the physical limits of the board and I have to change fitter seed until I get a stable machine. If not, there are errors when reading/writing to SRAM/SDRAM and instead of clear picture I got more or less garbage on the screen or badly displayed sprites.
Yes, if you have the time I'd love a chance to see the code with more comments. Just to further my understanding of implementing more complex systems in verilog or vhdl.
Source of 0.98b; still badly commented and chaotic;
Instruction: uncompress, run Quartus, open the project, do not do anything else, first compile it as is.
After the first compilation you can see "proptest-vga" in "project navigator", then you can click it and see the schematic. It is not available before the compilation because I didn't put the db directory in the zip file. The Quartus will recreate it when compiling.
Comments
I am trying to understand if this could ever be produced in hardware without the DE2 and without having to get a chip fabbed.
pik33's P1V has a lot of customised sections so we are probably unlikely to see it in silicon
Does anyone know what the exact Cyclone 4 chip is that is on the DE2-115? Also, would it be possible to program this or the prop code into the newer DE2i-150 which has more LE's but costs about the same?
The system now uses ~26k LEs.; the Propeller is ~14k, the rest contains about 10 k LEs.
My P1V is not that much customized; the core of the retromachine is a SRAM/VGA/sound controller module which communicates with P1V via Port B which was extended to 96 bits - 3x32 bit buses for address, data in and data out. My Propeller has then mul instruction added and video circuit removed to save some LEs and compilation time, and then boot loader changed to make it start from its own HUB RAM, which can be predefined in FPGA environment.
Update: audio buffer is now 1024 longs, from $84000 to $843FF
Synth sample length register bit 31 set "one shot" synth mode: it stops when it reaches sample end.
$8D000-$8D007 - synth woorking registers, read only, 0..3 current counter value, 4..7 currens sample address
To play audio:
The buffer3 has of course to be declared and vga is attached spin object. Replace 006 with your wav file name. fat is Kye's SD driver object. The mysz.def file is attached to the post #1.
Attached .pof and .sof. and then then (still chaotic) driver .spin to make use of it.
I have the DE-115 without the Prop2 emulator board connected, with the VGA, keyboard and sound connected to the main board. I have programmed in retro-097a to the board then reset (button 1).
I get the four green led's light (cogs) and then it displays 050 in the 7 segment display, pauses for about 30 seconds then does two beeps repeatedly. After about 2 minutes, it then did start playing music.
I have nothing on the VGA display though. I am using the 013.zip from above. Monitor reports signal out of range. It is a 1920 x1080 VGA monitor, as follows:
http://www.asus.com/uk/Monitors_Projectors/VH242H/
The signal is out of range because it is 1920x1200.
No additional hardware needed. PropPlug may be useful to program this thing.
Edit: demo@1920x1080 attached to the post #40
When playing sid music from 013 file, there are some fragments which should play @150 or 200 Hz - use switches 0..2 to set playing speed.
The retromachine's Propeller can be programmed in standard way (propplug in gpio). The memory and port map is in the post #29. The vnfg0092 gives you low-level access to memory and registers (peek, poke methods)
1920x1080 settings are still non standard, but I can see a picture on attached 1920x1080 monitor - the verilog code has to be rweritten to replace all hardcoded constants which makes setting resolution other than 1920x1200 hard. The $8F002 register (right border pixel start) has to be something very close to 1953 or the effect may be (not at all) interesting. Then all of the rest has to be adjusted to match this.Then there is hardcoded @ 152 MHz pixel clock - it should be 148 MHz for 1920x1080x60
What threw me is your first post. It states all graphics modes are based on 1920x1080.
You may want to consider changing since the majority of monitors wont do 1920x1200.
Thanks
Later I added the VGA timing registers to make software control of the resolution possible. Then I got 1680x1050 working.
Today I tried the 1920x1080 monitor at the university; after some problems I got a stable picture on it. So there are a demo files for this resolution. Try it
So I think there will be a switch, for example SW17, which will select the resolution to boot the machine with. This is easy (Propeller boot program will check the SW and then change the resolution)
What will be harder is to find and replace all hardcoded constants in verilog code so it will not fail when the resolution change.
And then I need to add some more graphic mode definitions based on 1920x1080; then, to make possible to run the same program in 1920x1200 and 1920x1080 there should be the same graphic modes - only adding some wider upper and lower borders when 1920x1200 resolution is set
To do.
Now I think it can work @ 1920x1080, too, with 0.97a version and changes I made in the Propeller software.
There is still a lot to do - there is no system software, no Basic, etc.
Thanks for sorting.
I am trying to understand how your code hangs together, and most of my confusion I believes come from an unfamiliarity with Quartus II.
Could you point me at any resources geared around learning this system? The help files and tutorials that come with the DE2 are very basic and don't cover any of the design. I have a book on verilog, but I can see there are also AHDL and BDF schematics here.
I want to make my own prop like board using multiple props on the DE2 and I'm struggling to see how this works.
See my thread on multiple prop's in a DE2, it might help.
Building 5 x P1V's in a DE2-115
I created a block symbol from it. Then I added some changes found here which I think are useful: MUL and unscrambled ROM.
The unscrambled ROM allowed me to change it, so the p1v can start directly from its RAM.
Then I added Port B and splitted it into 3 parts: inb, outb and dirb. Then I used dirb as an address bus and inb and outb as one direction data bus. I removed then video geerator to save some LEs
I also splitted 8 lower bits of port A to have some additional inputs. Bidirs are good when connected to gpio, but not good when using them inside an FPGA.
P8..P17 are left on GPIO. Then P18..P27 I used for i/o in DE2-115 - i2c, sd and ps2. P28..29 are reserved for eeprom, p30..31 are connected to gpio pins for the propplug.
Then I wrote a verilog module for vga/sram and audio chip. The sdram controler I found on the de2-115 cd. I didn't change it.
Then I connected all of these in the block diagram editor.
I didn't need more than 1 prop, but adding the second one is simple: add the second prop block on the diagram. 5 or 6 props will fit.
Thanks both of you for the detailed. I am trying to recreate the DracBlade on the DE-115. I have the schematic all entered and configured and compiling ok now, just trying to make sure it is fully booting the ROM image correctly. Not east to debug at times
What is the best way to add an SPI EEPROM to do the design which the prop can boot from? I can see a megafunction for an SPI memory chip.
I should add the reason I want to design it this way, is I would like to prototype something I will eventually make as a real prop board. The DracBlade is just a convenient starting point for me.
Way 2. Replace the eeprom on the DE2-115. It is soldered on the down side of it and it is easy to replace
Way 3. Use the modified bootloader from my retromachine's p1v. It boots from the hub ram. You can predefine the hub ram in Quartus. Then you can make a SD booter
The eeprom for the Propeller seems to be i2c rather than spi.
Changes:
SW17 select resolution at boot. Off - 1920x1200, on - 1920x1080
Playfield/sprite priority and collision registers added - old software will not display sprites with this version.
The zip file contains .pof, .sof and spin demos
This seems to be last version before 1.0. To make 1.0 the code need to be cleaned and the comments added and/or moved to the right place.
So I dodn't add the sources here until I make 1.0 or someone will be interested in these bad commented sources.
I tried to remove some hardcoded constants to make resolution changes easier, but this causes complicating the thing and it stopped to work properly, so they are still there
I tried BST but it fails on instructions like MUL.
You will have to substitute MUL with a LONG definition instead.
Then there is Propeler IDE with modified OpenSpin available on this forum. This version supports all P1V extensions done so far.
Changes: ports $8302D, 8302E,8302F added to make blitting easier
Setting non zero value (0..31) in $8302D will shl (if bit31==1) or shr data before it is written to SRAM. (SRAM ionly, not SDRAM or registers)
Shifted out bits of data will then be used in next write operation. You can preset these bits writing to $8302E
Value in $8302F will be added to R/W address (SRAM operation only) so if you can prepare the second frame buffer without any recalculation in software.
Attached .sof and .pof
I need to rewrite the demo to show new functions.. but now I have an idea to add Amiga-like HAM mode...
Changes: Amiga -like Hold-and-modify (HAM) graphics modes added
Modes 12..15 are the same resolution as modes 8..11 with 448 horizontal pixel @ 8bpp The difference is interpretation.
Bits 7..6 = 00 - use pallette color 0..63
01 - set red to bits 5..0<<2
10 - set green to bits 5..0<<2
11 - set blue to bits 5..0<<2
Attached sof and pof.
To do: write a new demo and the other software
Changes: Propeller pins P14..P17 connected to UART instead of GPIO
P14: RXD
P15: TXD
P16: RTS
P17: CTS
so you can use RS232 port on DE2-115. This was done to prepare to connect this machine to MIDI keyboard which will use MIDI to RS232 cable without any additional board. I want to hide the optoisolator and rest or needed parts in the RS232 plug, then use TXD and CTS to power the optoisolator. Then use RXD to get midi data from the keyboard
Then there is the driver. Version 0.98 I added to the last zip is somewhere cleaned and commented, but when I did this, I added at least one bug I cannot find. The booter when compiled with 0.92 version of the driver works OK; compiled with 0.98 shows only black screen, don't know why. The demo works OK; it needs 0.98 driver to test and use these new features I added. The demo needs rewriting; it doesn't show HAM graphic modes and some other possibilities; I use it to test if the compilation works - all of this hardware is near the physical limits of the board and I have to change fitter seed until I get a stable machine. If not, there are errors when reading/writing to SRAM/SDRAM and instead of clear picture I got more or less garbage on the screen or badly displayed sprites.
Many thanks
Instruction: uncompress, run Quartus, open the project, do not do anything else, first compile it as is.
After the first compilation you can see "proptest-vga" in "project navigator", then you can click it and see the schematic. It is not available before the compilation because I didn't put the db directory in the zip file. The Quartus will recreate it when compiling.