Size: a a a

FPGA technical questions

2019 May 06

M

Miguel Angel in FPGA technical questions
your problem I think is that your file doesn’t fill the rom completely
источник

M

Miguel Angel in FPGA technical questions
leaving it partially initialized
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
Miguel Angel
```
initial begin
  $readmemh (“path/file.wav”, rom);
end
```
Yes, exactly. I just don't remember the exact code. But I will show the full code. Later
источник

M

Miguel Angel in FPGA technical questions
and this is considered an error
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
Error: non-hex symbol "r" in .wav file
источник

M

Miguel Angel in FPGA technical questions
one moment
источник

M

Miguel Angel in FPGA technical questions
DIDN’T you convert your file to hex file?
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
No
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
But how?
источник

M

Miguel Angel in FPGA technical questions
an hex file is just a text file in which each line has an hex number that goes to a memory cell
источник

M

Miguel Angel in FPGA technical questions
I use a small C program
источник

M

Miguel Angel in FPGA technical questions
do you know how to compile a C program?
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
Miguel Angel
do you know how to compile a C program?
Yes, thank you very much! I will try it!
источник

M

Miguel Angel in FPGA technical questions
Ruslan Zuckerbrin
Yes, thank you very much! I will try it!
Here you have mine. Usage is:
bin2hex filename.wav (for example) and it will create filename.wav.hex
источник

M

Miguel Angel in FPGA technical questions
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
Thanks!
источник

M

Miguel Angel in FPGA technical questions
One more thing:

your ROM must be completely initialized. Your WAV file most probably won't fill it, so you have to preinitialize it with zeros, and then, load your hex file, like this:

logic [7:0] rom[0:4095];
integer i;
initial begin
 for (i=0;i<4096;i=i+1)
   rom[i] = 8'h00;
 $readmemh ("path/file.wav.hex", rom);
end

And, of course, unless you have a FPGA with lots of block memory, you want your wav files to be small enough so the FPGA can use its block memory to store them.
источник

RZ

Ruslan Zuckerbrin in FPGA technical questions
Miguel Angel
One more thing:

your ROM must be completely initialized. Your WAV file most probably won't fill it, so you have to preinitialize it with zeros, and then, load your hex file, like this:

logic [7:0] rom[0:4095];
integer i;
initial begin
 for (i=0;i<4096;i=i+1)
   rom[i] = 8'h00;
 $readmemh ("path/file.wav.hex", rom);
end

And, of course, unless you have a FPGA with lots of block memory, you want your wav files to be small enough so the FPGA can use its block memory to store them.
Thank you, I didn't know about initialization with 0.
источник
2019 May 07

IK

Ilia Kalistru in FPGA technical questions
It depends on what synchronous logic structure you use. You should elaborate your question more if you want more precise answer.
источник
2019 May 08

ΔΒ

Δαρθ Βέιδερ in FPGA technical questions
if( reset && sel=2 )
begin
end
else if( reset && sel==1 )
begin
end
источник