Hi, all,
OK, got basic audio working on the DE1 now.
The chip only has enough room to fit the PSG and ONE channel of the YM though. It's literally 97% full right now.
I'm having strange issues with compilation still.
The audio output only works if I'm using channel 2 of the YM?
If I use say channel 1 or 3, the audio output doesn't work at all?
Even the PSG won't work in that case, and I can't figure out why?
I'm not using the proper DAC on the DE1, but instead I'm using a simple SigmaDelta DAC. This lets it output the audio on a single GPIO pin.
This does save a lot of logic as well.
At the moment, I have the PSG and YM hooked up to separate output pins, so I can get a groovy "stereo" sound.
The DAC in the YM code is working fine, so I can finally hear the good old "SEGAAA!!!" sound and the drums.
The PSG sounds fine too, so I get all the sound effects like jumping in Sonic 2 etc.
But, the channel 2 I'm using from the YM code sounds quite weird, like it's an octave too low?
This is probably because it's supposed to be mixed with another FM operator or something? Not sure?
My DE1 is working a lot better after I replaced it's SRAM chip.
For some reason, it was giving corrupted data in a few places before?
@Shaho - thanks again for the code.
I'm starting to learn a bit more about VHDL now, so I suppose it's good that I stuck with it.
I did end up changing the gen_fm and psg outputs to std_logic_vector for the time being.
I also just flipped the MSB bit when assigning the audio output to the SigmaDelta blocks, to make it unsigned. I don't know if this is a "proper" way to do it, but it sounds quite good to me (apart from the obvious YM issues).
The audio is simply routed to two GPIO pins, so it will need an R/C filter on each pin. I'm just using 3K3 series resistors for now, as I haven't calculated a suitable capacitor value yet.
The SigDelta blocks are using MCLK as the master clock.
Not sure if this is is maybe too high, or what the optimum might be for the audio?
@Shaho - Do you think the YM channels could be trimmed down in some way to reduce the amount of logic needed?
Maybe the audio precision could be reduced a fair bit without loosing too much quality?
Quartus is saying that each YM channel needs over 500 Logic Elements to fit, which is quite a lot. It's also using all the on-chip multiplier blocks. lol
I will try adding a real YM chip to the DE1 as well.
After reading a lot of the work done by Nemesis and others, I'm interested in comparing the VHDL code to the real thing.
Also, I've updated Gregory's VDP code with most of the changes from your code. I don't know what the extra signals are for though?...
I can see you used internal RAM blocks rather than SRAM, so I've kept it as SRAM on the DE1.
But, I did add all the other differences, like the extra "RD3" Read signals etc...
type vmc_t is (
VMC_IDLE,
VMC_BGB_RD1,
VMC_BGB_RD2,
VMC_BGB_RD3,
VMC_BGA_RD1,
VMC_BGA_RD2,
VMC_BGA_RD3,
VMC_SP1_RD1,
VMC_SP1_RD2,
VMC_SP1_RD3,
VMC_SP2_RD1,
VMC_SP2_RD2,
VMC_SP2_RD3,
VMC_DT_ACC1,
VMC_DT_ACC2,
VMC_DT_ACC3
);
signal VMC : vmc_t;
And I added the other changes in the VDP logic, but kept the VRAM_DTACK_N stuff enabled...
when VMC_BGB_RD1 => -- BACKGROUND B
FF_VRAM_OE_N <= '0';
FF_VRAM_WE_N <= '1';
FF_VRAM_UB_N <= '0';
FF_VRAM_LB_N <= '0';
FF_VRAM_SEL <= '1';
--VMC <= VMC_BGB_RD2;
VMC <= VMC_BGB_RD3;
when VMC_BGB_RD2 =>
VMC <= VMC_BGB_RD3;
when VMC_BGB_RD3 =>
if VRAM_DTACK_N = '0' then
BGB_VRAM_DO <= VRAM_DO;
FF_VRAM_CE_N <= '1';
FF_VRAM_OE_N <= '1';
FF_VRAM_WE_N <= '1';
FF_VRAM_UB_N <= '1';
FF_VRAM_LB_N <= '1';
BGB_DTACK_N <= '0';
FF_VRAM_SEL <= '0';
VMC <= VMC_IDLE;
end if;
I was wondering if you remember what the extra RD3 signals are for, or why the logic is slightly different with the extra parts like this?...
when VMC_BGB_RD2 =>
VMC <= VMC_BGB_RD3;
I'm just confirming with Grégory if it's OK to post the updated DE1 code.
Should be fine, since they're both public anyway, but I want to stress that this is not an "official" release in any way, and just something for DE1 owners to have a play with.
It could also be used on other FPGA boards of course. They'd just need to port your code to it.
Oh, I also added your gen_io module, so player two inputs are on GPIO pins. It needs some pull-ups though, as you can currently control Miles "Tails" Prower by merely touching the pins! lol
OzOnE.