Home    Bloggers    Messages    Webinars    Resources   
Tw  |  Fb  |  In  |  Rss
Duane Benson

Discovering FPGAs: Returning to VHDL, Part 3

Duane Benson
Page 1 / 20   >   >>
aj1s
aj1s
2/22/2013 9:25:51 PM
User Rank
Guru
Re: What we do is digital circuit design.
@jan "When I talk about HDL based design, I assume that the basics of digital design are mastered. Honestly, I find that an obvious assumption - but perhaps that's wrong."

Amen! HDL based design is still the design of digital HW, no matter how abstractly we describe the behavior of said HW!

"Moreover, I also find it obvious that a digital design engineer is interested in implementation efficiency (area, timing, power) first."

Since we designers also want to remain employed, we are also, and in some cases moreso, interested in the efficiency of the design process itself. As the devices on which our designs are implemented speed up, consume less power and $$ (on a per-gate-equivalent basis), while our designs become larger and more complex,  in many cases we can profitably trade a little implementation efficiency for more design process efficiency.

Is this so different from the early days of HLL-based SW development? Sure, the assembly language artisans could craft instruction sequences that would run circles around our best HLL efforts, but at what cost? They could not compete when faced with implementing the scale and complexity of the applications we were producing.

Andy

50%
50%
jandecaluwe
jandecaluwe
2/22/2013 8:35:58 AM
User Rank
Blogger
Re: What we do is digital circuit design.
@devel "It seems to me that a lot of newbies are trying to learn VHDL without any understanding of the fundamentals of digital design.

That, of course, is completely backwards."

I fully agree. Perhaps what we are facing is a mismatch between hidden assumptions. I'll try to make mine explicit.

When I talk about HDL based design, I assume that the basics of digital design are mastered. Honestly, I find that an obvious assumption - but perhaps that's wrong.

Moreover, I also find it obvious that a digital design engineer is interested in implementation efficiency (area, timing, power) first. Therefore, when I talk about "abstraction" and even "software techniques" I mean that in a bottom-up sense: as an incremental though significant improvement by making better use of existing techniques, based on a strong foundation.

 

100%
0%
aj1s
aj1s
2/22/2013 12:29:38 AM
User Rank
Guru
Re: Simple Request To The FPGA Experts
@rfindley: "I was pointing only to two points at the top of the linked page, which answers the question you asked (i.e. how register inference is different with variables).  I make no support of anything beyond that point."

Rfindley,

The text which you describe as explaining how registers are inferred from variables  uses the right words, but emphasizes the wrong sylables, so to speak, and misses the most critical (and most powerful) point.

It is not a variable that infers a register, it is EACH reference to said variable that infers a register (or not).

Furthermore, a single variable can have several references. Each of those references is either a register, or a potentially unique combinatorial result, depending on what value was most recently assigned and when. In fact, if a prior assignment (in the same clock cycle) to the variable is conditional, then subsequent accesses are conditionally registered or combinatorial values, for which a mux is employed to choose.

Compare that to a signal in a clocked process. Most of us were taught (or left to assume) that writing a signal on a clock edge is what creates a register. But variables are written on clocked edges, and they don't necessarily create registers. Why? 

Just like variables, it is the references to signals that are written on clock edges that create the registers. It just so happens that the postponed update semantics ensure that, no matter when a reference is executed relative to an assignment, it is always the value written in some previous clock cycle. 

When viewed this way, we have a unified model of register synthesis, whether signals or variables are used.

This unified model also helps us to understand why latches (a different form of storage) are inferred. And guess what? The same preferred solution to avoiding unwanted latches in combintorial processes (default assignments at the beginning of the process) , also avoids unwanted registers inferred from variable references in clocked processes.

On the other hand, when Ben Cohen writes that some synthesis tools may optimize out the register, created for the variable (sic), he apparently has forgotten that if two signals register (sic) the same value, some synthesis tools will optimize one of them away too. Why is it a problem when that happens with a variable, but not with a signal?

Now, before everyone's blood pressure elevates about trying to remember how variable and signal references create registers, I have a simpler idea: Instead of focusing on registers, focus on how many clock cycles (or trips through the process loop) it takes the process to generate an output from an input. Then there will be that many successive registers to create those clock cycle delays.

If you enable retiming and pipelining synthesis optimizations, the registers aren't likely to end up where you thought they might be anyway. But there will still be the same number of clock cycles from process input to output.

Andy

 

100%
0%
rfindley
rfindley
2/21/2013 4:34:05 PM
User Rank
Blogger
Re: Simple Request To The FPGA Experts
@Devel, I was pointing only to two points at the top of the linked page, which answers the question you asked (i.e. how register inference is different with variables).  I make no support of anything beyond that point.

50%
50%
Karl
Karl
2/21/2013 4:24:17 PM
User Rank
Guru
Re: What we do is digital circuit design.
@devel: "Once the student understands the digital design part -- and seriously, that's not all that hard, which is why it's often a one-semester course -- then the discussion about implementation details (schematics, HDL) can take place."

I am confused because it looks like the above is your conclusion and I tried to say the same thing but you said it was backwards.

50%
50%
jandecaluwe
jandecaluwe
2/21/2013 3:47:31 PM
User Rank
Blogger
Re: Simple Request To The FPGA Experts
@rfindley "No, I don't teach that comment, nor do I use that book.  It was the result of a quick google search to save time."

Fortunately.

A quick google search. Right. In your recent post you mentioned it to make your point as follows:

"A quick google search will reveal that there are indeed common misconceptions about VHDL variables during the learning process, especially among certain classes of people."

and:

"There is some behavior or perception that is interfering with proper understanding."

and:

"I think it is valuable to acknowledge this, and find the root cause."

I acknowledge this and your search result is a perfect illustration of my hypothesis about the root cause.

It's not struggling newbies that are the problem. It's not "during the learning process" - the problem is with influential but mediocre engineers who think they have nothing to learn anymore.

The "certain classes of people" that you refer to are the confused "guru's" like this one that just don't get it. They are the ones that spoil the party for newbies.

 

50%
50%
rfindley
rfindley
2/21/2013 3:32:52 PM
User Rank
Blogger
Re: Simple Request To The FPGA Experts
@Jan,

No, I don't teach that comment, nor do I use that book.  It was the result of a quick google search to save time.  I was only pointing Devel to the section at the top of the page, which answers the question he asked, and provides some academic examples.

50%
50%
jandecaluwe
jandecaluwe
2/21/2013 3:28:11 PM
User Rank
Blogger
Re: Simple Request To The FPGA Experts
@rfindley "@Devel, Here's a quick read for you:  link"

I was happy to hear that you teach register inference from variables. Honestly, I was pleasantly surprized.

But please, tell me that this complete bullshit ("Avoid using variables in clocked processes") is not what you teach.

Otherwise, prepare for the storm - over to @a1js.

100%
0%
devel@latke.net
devel@latke.net
2/21/2013 3:24:37 PM
User Rank
Guru
Re: Simple Request To The FPGA Experts
rfindlay: "Here's a quick read for you:  link."

I've seen that reference. And forgot about it.

I think Ben doth protest too much, certainly in the box that says, "Avoid using variables in clocked processes." That sort of recommendation might be fine for children, but I'm an adult and I know what I'm doing.

It is common to use a variable as a way to simplify some code. The example of the JK flip-flop is a good one. (Even as I disagree with his coding style, although that book is ancient.) He uses a variable to condense the concatenation J & K into a vector, and then he uses that variable as the condition in the case statement.

In his first example, it should be clear that a register for JK_v won't be inferred; it's just a convenience. (Actually, it's a workaround for the problem of the restrictions on what could be used as a case conditional in older versions of VHDL.) My work-around would've avoided the variable and instead used a typecast:

    case std_logic_vector'(J & K) is 

but now we have to teach the newbies about typecasts.

Then he provides a second example that looks similar but puts the variable assignment after the case statement. That does infer a register, and as his comment notes, it's probably not desired. That's true enough, but blaming variables for the user's lack of attention isn't warranted.

50%
50%
rfindley
rfindley
2/21/2013 3:12:06 PM
User Rank
Blogger
Re: Simple Request To The FPGA Experts
@Devel, Here's a quick read for you:  link

50%
50%
Page 1 / 20   >   >>
More Blogs from Duane Benson
Duane has decided that the time is ripe to get his ZedBoard bolted onto his robot with a Linux distribution up and running. That was the ultimate plan anyway, so why wait?
Now it's time to delve deeper into the state machine I'm using to control my I2C interface.
The three states associated with bi-directional "inout" pins can cause confusion for the unwary.
It's time to jump into unexplored territory -- the state machine that will control Duane Benson's I2C interface.
We're now ready for the I2C master to transmit a command set to a remote device.
flash poll
follow us on twitter
follow Xilinx on twitter
like us on facebook
like Xilinx on facebook
All Programmable Planet     About Us     Contact Us     Help     Register     Twitter     Facebook     RSS