Replacing AHDL with Verilog
Seairth
Posts: 2,474
I'd like to replace the two AHDL files with VHDL Verilog. The reasons include:
Any thoughts before I start?
Also, where should I start from? I don't really want to start another fork, but I also don't really want to post the update to the forum in a zip file.
- Consolidates all files to a single language
- Ability to use ModelSim on all of the files (I wanted to simulate tim.tdf, which is what prompted this effort.)
- dff
- dffe
- tri
Any thoughts before I start?
Also, where should I start from? I don't really want to start another fork, but I also don't really want to post the update to the forum in a zip file.
Comments
Dang it! I meant Verilog! My fingers were on automatic and my brain was obviously content enough to not notice. No more posts before my morning coffee!
As for the conversion, that's great! No need for me to do it. I'll go look at his fork...
In your opinion, what behavior has changed?
My apologies. Re-reading the code (in top.v), it effectively looks the same. I was looking for explicit DFF, DFFE, and TRI implementations, instead of relying on inference (though I see you are using IOBUF for TRI).
I still would have liked to keep it in a separate tim.v, so as to mirror the original code a bit more closely. And, as I mentioned in the original post, I had wanted to run that code through ModelSim, which would be much easier to do as a module. But no biggy. I'll just break it out in my local copy.
Thanks for doing the changes!
At this time, I have a master branch that has the same file tree as the original Parallax release (with the addition of the BeMicroCV files and some documentation), and an Altera branch that has my combined tree of Altera targets. I don't think I want to make many more changes to the master branch, at least not until Parallax is on board or any other branch is better tested.
If I understand correctly, Overclocked and Magnus Karlsson are working on combining some Xilinx code. In the long term, I'm thinking these should be combined with my Altera branch to create a single code base, and we should either declare that to be "the branch to go to" for newbies, or merge it back into the master branch. In order to make a future "merge of all things" easier, I have no problem with starting a new branch right away where the AHDL is converted to Verilog for the Altera targets.
===Jac
Do you think that simulation will be run with the free version (modelsim starter)?
I were able to run dig.v on three other free simulators (Icarus Verilog, Verilator, and Tachyon DA's CVC) using Magnus code. (Comments in ROM files will need to be removed if you want to use $readmemh).
But simulation failed on all of them when I tried to fake the Xilinx specific components (PLL_BASE, BUFG, dig, IOBUF) using Xilinx´s own verilog modules.
It has been 1 month since initial release and there are a lot of good work done. I wish we will be able to do a full P8X32A simulation before the end of this month !
As the code currently stands, you can't use ModelSim-Altera Starter. It may be worth trying with the other simulators, though. You will probably have to provide an alternative to the altpll, though. This makes me think that it would be a good idea to separate all Altera-specific and Xilinx-specific code into separate modules with identical parameters. This way, we could also provide "simulation" version of those modules as well.
By the way, I think in tim.v, reg[7:0] cfgx should be reg[6:0] cfgx (it gets copied from cfg which is declared with [6:0])
Also, in top.v I think wire [3:0] _dummy_clk should be wire [4:0] _dummy_clk (Quartus generates a warning otherwise)
===Jac
When I tried using tim.v instead of tim.tdf in the original distro as well as my version, it compiled and loaded OK but it wouldn't run a simple Hello World program that outputs to the serial terminal. I didn't have time to research it since I was focused on the COGS mods at the time so I continued using tim.tdf since it doesn't need any changes for the COGS stuff. Here is the KISS script I used to test:
2014-09-13 17:54 - The test program works if I append "+ PLL<x>X" where <x> can be from 1 to 16. Changing cfgx[7:0] to [6:0] didn't change behavior.
This change makes code without + pll<x>x at the end work right.
jac,
I am on github, but did not do these changes there. I've been waiting for that stuff to get straightened out before I figure out which repository to work from. As for the dummy wire, I don't recall seeing the warning. And I thought the altpll megafunction output was 5-bit. On the other hand, that might have been for only one of the platforms.
Thoth,
Thanks for catching that. tim.v may be wrong indeed. Still haven't had time to test the builds (beyond basic "identify hardware" in prop tool). Maybe this evening...
Ah, sorry. I tried to find you on Github and didn't see you, so I went ahead and checked the Verilog conversion into my Altera branch, crediting you and Magnus. That was before I saw the PLL fix, though. I still have to take a closer look at that. (EDIT: I checked the bugfix in now).
Feel free to set up your own fork (I recommend forking the Altera branch) and submit further changes via pull request.
I was wondering about that too but I didn't try building the other platforms until after I changed it. I don't think they generated any new warnings after my fix.
Thoth, you can also define macros from the "Assignments>Settings>Analysis & Synthesis Settings>Verilog HDL Input" menu in Quartus, in case you didn't know.
If you set your macro from the menu, it will make it easier to find (especially if you're going to redistribute your code and want others to find it). Also, you could create different Revisions in Quartus, for example a quick-compile revision would set the number of cogs to 4 or even lower from the menu, whereas the full version sets the number of cogs to 8. You can build both versions (unfortunately not automatically) without changing the code.
I would name it something other than COGS, though. NUMBER_OF_COGS or NUM_COGS would be better names if you want to prevent future name clashes. And if you do a search through your code, it will make your life much easier if the name is a little longer and isn't a word that's likely to show up in other identifiers and comments and stuff.
===Jac
Thanks for the info. Right now I'm doing some testing and starting multiple cogs doesn't work right.
Feel free to change the constant identifiers around in any way you deem appropriate. The code is a mess of tabs and spaces right now and that needs to be cleaned up eventually.