Any brainiacs willing to better comment P1V code for us mere mortals?
mark
Posts: 252
So I tried prepping myself a bit before checking out the P1V code by reading some verilog tutorials. I'd be lying if I said I understood it all and was ready to go, but I figured I could at least start peeking at the code and do a bit of research when something wasn't clear. It didn't take more than a couple of lines into cog.v to be completely lost by nothing more than many of the names used for "constants" (inputs/outputs/parameters). Of course, I also don't know what things like 'ena' (enable?) and 'ena_bus', etc. etc. are supposed to be for. Maybe it's just my noobishness, but to me it doesn't appear to be for the faint of heart. If this code makes sense to anyone, I sincerely hope they would be willing to comment the code better (no rush! Just would appreciate if someone would undertake it!). Any takers?
-Mark
Comments
Great! I hope you'll share your progress every now and then
Perhaps someone with an understanding of Quartus/FPGA can update the drawing?
This is what I gathered as well. I'm guessing any top file would be FPGA specific. I don't currently have one, I was just browsing the code with Scriptum.
Re: Hub "API"
Here are the ones that needed some more explanation.
ena_bus -- high on every other clock, makes the hub run half the speed of the cogs
r -- high when cog is loading program, turns on ROM descrambling
s -- selects byte/word/long
c -- carry
bus_ack -- acknowledge back to cog that hub request completed
cog_ena -- 8 lines, each cog gets one, enables the cog if high
ptr_w -- write PAR during COGINIT
ptr_d -- data for writing PAR during COGINIT
cfg -- control bits set by CLKSET
http://forums.parallax.com/showthread.php/157051-Hub-quot-API-quot
Note: The forum has not expanded tab stops correctly. I view the source file with Notepad++.
Note: The forum has not expanded tab stops correctly. I view the source file with Notepad++.
@Cluso
This is great stuff! Very helpful. Thanks for sharing!
I think it would be fabulous if Chip would take half an hour and create a glossary for those two letter identifiers he loves so much - shades of Basic! I like the terseness from a visual POV but it's an effort to figure out his naming conventions.
Warning: There is an error in the states for the timing diagram. Please see the next post.
Just realised that my timing diagram above was incorrect.
I am hoping that I have the m[4] state correct..... where the cog waits for an access slot to the hub.
Postedit: I suspect that the wait state(s), if present, come between m[2] and m[3]. Still checking.