Author Topic: Looking for a Verilog HDL crash course  (Read 7136 times)

0 Members and 1 Guest are viewing this topic.

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Looking for a Verilog HDL crash course
« on: November 03, 2014, 09:54:33 pm »
Hi everyone,

I'm taking a digital design course this semester. My professor started us off with designing a full adder in Verilog as our first project. This was very easy and only took a few lines of code. Now, our second project is to design a FSM for a traffic light controller. This is a pretty standard project, however we do not have nearly enough knowledge and experience in Verilog to do this. Conceptually it is simple, but actually implementing it is proving difficult.

I'm looking for some documentation/websites/books/anything that might help me quickly understand the Verilog language.

Any ideas?

Right now I'm looking at: http://www.asic-world.com/verilog/veritut.html

And this list: http://www.fpga4fun.com/HDL%20tutorials.html

But I'm not sure what would be best for me.
« Last Edit: November 03, 2014, 10:02:28 pm by TimNJ »
 

Offline marshallh

  • Supporter
  • ****
  • Posts: 1462
  • Country: us
    • retroactive
Re: Looking for a Verilog HDL crash course
« Reply #1 on: November 03, 2014, 10:10:55 pm »
Check out the links in my sig's PDF (Verilog tips)
Verilog tips
BGA soldering intro

11:37 <@ktemkin> c4757p: marshall has transcended communications media
11:37 <@ktemkin> He speaks protocols directly.
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #2 on: November 03, 2014, 10:17:15 pm »
Thank you! Just reading it and you say that 80% of Verilog is not synthesizable...Does that mean that it cannot be physically implemented in an FPGA? If so...what's the point?
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: Looking for a Verilog HDL crash course
« Reply #3 on: November 03, 2014, 10:19:05 pm »
If so...what's the point?
Simulation.
 

Offline jancumps

  • Supporter
  • ****
  • Posts: 1272
  • Country: be
  • New Low
Re: Looking for a Verilog HDL crash course
« Reply #4 on: November 03, 2014, 10:19:51 pm »
Thank you! Just reading it and you say that 80% of Verilog is not synthesizable...Does that mean that it cannot be physically implemented in an FPGA? If so...what's the point?
Verilog and VHDL have a simulation origin. Parts of the language constructs are directed to that.
 

Offline jancumps

  • Supporter
  • ****
  • Posts: 1272
  • Country: be
  • New Low
Re: Looking for a Verilog HDL crash course
« Reply #5 on: November 03, 2014, 10:20:43 pm »
ok flibble, you were first :)
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #6 on: November 03, 2014, 10:25:40 pm »
Thanks. So can I write something in a Verliog design package, be able to simulate it, but NOT be able to implement it on an FPGA?
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8518
  • Country: us
    • SiliconValleyGarage
Re: Looking for a Verilog HDL crash course
« Reply #7 on: November 03, 2014, 10:38:20 pm »
Thank you! Just reading it and you say that 80% of Verilog is not synthesizable...Does that mean that it cannot be physically implemented in an FPGA? If so...what's the point?
Verilog and VHDL have a simulation origin. Parts of the language constructs are directed to that.
Wrong. Verilog was from the onset a design language.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8518
  • Country: us
    • SiliconValleyGarage
Re: Looking for a Verilog HDL crash course
« Reply #8 on: November 03, 2014, 10:38:54 pm »
Thanks. So can I write something in a Verliog design package, be able to simulate it, but NOT be able to implement it on an FPGA?

perfectly.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #9 on: November 03, 2014, 10:43:51 pm »
Thanks. So, my problem with this concept is "Why have constructs that can only be used in simulation if the end goal is to build a real working chip?"
 

Offline marshallh

  • Supporter
  • ****
  • Posts: 1462
  • Country: us
    • retroactive
Re: Looking for a Verilog HDL crash course
« Reply #10 on: November 03, 2014, 11:00:44 pm »
Simulation and testbenching is absolutely essential for big projects. The idea is you isolate your design into functional modules and write a spec for its I/O, then design a verilog testbench that makes sure it performs as designed by generating stimuli and checking the output.
Compile for simulation takes seconds to minutes. A fulll synthesis/P&R on real hardware takes minutes to hours. Iteration is more easily done via simulation.

That said, there are some things you can't simulate, and I've done a lot without it.

As an example: say you're writing a SDRAM controller, which is a pretty basic thing, but can also be difficult to ensure you don't violate any of the various timing specs. The SDRAM has no way of telling you you are violating its timing, except that it may fail 2 years down the road in a hot place on a certain phase of the moon. So you download Micron's behavioral model and wire it up to your controller as if it were real memory. Then it can print out debug messages about things the chip wouldn't like if you were actually controlling it.
Verilog tips
BGA soldering intro

11:37 <@ktemkin> c4757p: marshall has transcended communications media
11:37 <@ktemkin> He speaks protocols directly.
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #11 on: November 03, 2014, 11:31:49 pm »
Simulation and testbenching is absolutely essential for big projects. The idea is you isolate your design into functional modules and write a spec for its I/O, then design a verilog testbench that makes sure it performs as designed by generating stimuli and checking the output.
Compile for simulation takes seconds to minutes. A fulll synthesis/P&R on real hardware takes minutes to hours. Iteration is more easily done via simulation.

That said, there are some things you can't simulate, and I've done a lot without it.

As an example: say you're writing a SDRAM controller, which is a pretty basic thing, but can also be difficult to ensure you don't violate any of the various timing specs. The SDRAM has no way of telling you you are violating its timing, except that it may fail 2 years down the road in a hot place on a certain phase of the moon. So you download Micron's behavioral model and wire it up to your controller as if it were real memory. Then it can print out debug messages about things the chip wouldn't like if you were actually controlling it.

Thanks Marshall. I think I might just be on a different page here. We have been simulating our designs in software by writing a testbench for Xilinx ISIM , and then we confirm the I/O behavior through a timing diagram. Everything we have done has been in simulation so far.

So I can write something in Xilinx ISE and it will not be able to create a netlist for it? However, I might want to just simulate something for another reason?

 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19794
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Looking for a Verilog HDL crash course
« Reply #12 on: November 04, 2014, 01:52:16 am »
Thanks Marshall. I think I might just be on a different page here. We have been simulating our designs in software by writing a testbench for Xilinx ISIM , and then we confirm the I/O behavior through a timing diagram. Everything we have done has been in simulation so far.

So I can write something in Xilinx ISE and it will not be able to create a netlist for it? However, I might want to just simulate something for another reason?

Consider a complex system, e.g. a FFT engine or Fast Packet Switch or communications system.

Initially you want to be able to model the design concepts at a high level without having to worry about all the low-level implementation details. At this point you need simple and fast simulations. For example, the FFT engine or communications system might use floating point but the real implementation might be fixed point. Once you have the high level concepts validated, you then implement them in gates. These placing and routing and timing simulations are much slower than the high level simulations. It takes engineering judgement to ensure that the high level models can be implemented without too much difficulty.

As a separate use case, consider trying to verify that the gate-level implementation actually performs the expected operation. In this case it is common to have a non-synthesisable testbench firing test sequences at the circuit-under-test and observing the results. In such cases it is irrelevant that the testbench can't be turned into gates - in fact it is a positive advantage!
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #13 on: November 04, 2014, 02:28:49 am »
Thanks Marshall. I think I might just be on a different page here. We have been simulating our designs in software by writing a testbench for Xilinx ISIM , and then we confirm the I/O behavior through a timing diagram. Everything we have done has been in simulation so far.

So I can write something in Xilinx ISE and it will not be able to create a netlist for it? However, I might want to just simulate something for another reason?

Consider a complex system, e.g. a FFT engine or Fast Packet Switch or communications system.

Initially you want to be able to model the design concepts at a high level without having to worry about all the low-level implementation details. At this point you need simple and fast simulations. For example, the FFT engine or communications system might use floating point but the real implementation might be fixed point. Once you have the high level concepts validated, you then implement them in gates. These placing and routing and timing simulations are much slower than the high level simulations. It takes engineering judgement to ensure that the high level models can be implemented without too much difficulty.

As a separate use case, consider trying to verify that the gate-level implementation actually performs the expected operation. In this case it is common to have a non-synthesisable testbench firing test sequences at the circuit-under-test and observing the results. In such cases it is irrelevant that the testbench can't be turned into gates - in fact it is a positive advantage!

tggzzz,

Thank you so much! Now it makes sense why there are non-synthesizeable constructs in Verilog. It's to help simplify the work so you don't get caught up with little things. Once you're ready to take it down to gate level, you can make the appropriate adjustments.

I don't know what I would do without you guys because my professors sure as hell don't teach these ideas.
 

Offline slburris

  • Frequent Contributor
  • **
  • Posts: 542
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #14 on: November 04, 2014, 04:40:39 am »
I use this book.  http://www.amazon.com/Verilog-HDL-Synthesis-Practical-Primer/dp/0965039153

It's specifically about synthesis.  It's fairly old, so you can pick up used copies <$10.

 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #15 on: November 04, 2014, 04:24:44 pm »
I use this book.  http://www.amazon.com/Verilog-HDL-Synthesis-Practical-Primer/dp/0965039153

It's specifically about synthesis.  It's fairly old, so you can pick up used copies <$10.

Thanks! That looks like a solid book. For $10 shipped, I think I might buy it!
 

Offline TimNJTopic starter

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: us
Re: Looking for a Verilog HDL crash course
« Reply #16 on: November 06, 2014, 11:36:50 pm »
Hi guys,

I'm working on a project and I'm getting a problem using ISIM. Im using a line like: #10 clk = ~clk in my test bench to create a test clock.

If i keep my timescale on the default 1ns / 1ps, it works fine and my timing diagram comes up nicely. However I'm trying to make a 3Hz clock so i need the timescale to be much bigger.

But when i increase it to a longer time, the timing diagram makes one of my regs red and xxxxxx instead of cycling through them.

Any ideas why it is red and an 'x' instead of green and 1s and 0s??

Thanks! Really need help.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf