Home    Bloggers    Messages    Webinars    Resources   
Tw  |  Fb  |  In  |  Rss
Brian Bailey

Software != Hardware

Brian Bailey
Page 1 / 4   >   >>
jandecaluwe
jandecaluwe
3/6/2013 3:27:20 PM
User Rank
Blogger
Re:software implementation is not hardware specification
@Karl "And I cannot wait to see jan's reply to this one."

Sorry to have kept you waiting, but I needed to do my homework first.

You can find my extensive analysis of @brian's example elsewhere in this thread. Although I haven't received feedback yet, my conclusion is that the example is misleading and actually leads to the opposite conclusion if analyzed properly.

In summary: what @brian calls a "hardware implementation" is just one possible hardware description. On its own it may synthesize slightly more efficiently than alternative descriptions (although I doubt that for state-of-the-art ASIC synthesis), but I demonstrated why it is likely to result in a less optimal solution overall than the "software" description. (The reason is that the complete design problem probably needs a look-up table anyway.)

The bottom line is that if I am correct, the "software description" is the most efficient input for both a "software" and a "hardware" implementation. This analysis invalidates @brian's conclusion that software != hardware, and his suggestion to "move on".

Personally, I find it most useful to think about HDL design as event-driven microthread programming. Some of those programs can be implemented very efficiently thanks to a special compiler called a synthesis tool.

 

50%
50%
hash.era
hash.era
2/16/2013 10:45:49 PM
User Rank
Clever Clogs
Re: Hardware & Software
Very true Max .. Btw I too learned HDL and VHDL and trust me , I really love it.

50%
50%
jandecaluwe
jandecaluwe
2/16/2013 2:03:40 PM
User Rank
Blogger
In reality, your example tells the opposite story
@brian I have analyzed your example based on [1] and [2]. I believe I have discovered several flaws that basically lead to the opposite conclusion.

You start with a "reference software implementation" like this:
for i in range(4):
    for j in range(4):
        state[i][j] = lookup(state[i][j])

You claim the following about this:

"The synthesis of that would have to access memory for each element in the array and -- using a lookup table -- find the new value to write back into the array. The hardware implementation would basically run at the same speed of the software."

I don't see why. There are no loop dependencies and the lookup tables are fixed. Therefore, I could feed this to an RTL synthesis tool and it would give me a fully parallel update of the whole 4x4 array in one cycle.

In my view, RTL synthesis is HLS synthesis with a clock cycle constraint of 1. I would expect that a HLS synthesis tool is able to generate a range of solutions by relaxing the clock cycle constraint. Without constraint, it would fall back to the minimal area, "software" implementation. This is a classical area/timing trade-off.

Further on you say: "The hardware implementation is as follows":
out[i] = in[i] ^ in[(i+4)%8] ^ in[(i+5)%8] ^ ...

This is misleading in several ways. First, this equation doesn't correspond to the code above. The 'i' here refers to a single bit in a value, not to a row in a 4x4 array. To get the equivalent of just the lookup() function, you have to put a for loop around the bit equation.

Secondly, this is not "the" hardware implementation. It is just one possible hardware description, possibly a very good one. However, the lookup() function above is also a hardware description that can potentially be implemented very efficiently.

Then you say:

"There is no way to translate, synthesize, or whatever you want to call it from one description to the other, but they both perform the same function at the end of the day."

Here I really don't follow. Surely in one direction (from the equations to the lookup) the translation is trivial: just evaluate the equations and that gives you the lookup table.

More importantly, what matters is not whether one can be translated to the other, but how efficiently they synthesize. I have tried it by comparing the equations with the equivalent lookup. In Xilinx, the difference is barely noticable (as I would also expect in ASIC synthesis), in Altera it is larger, with the equations indeed having the edge.

However, there is one more important issue: the equations only correspond to the second step in the SubBytes transformation, known as the affine transformation. In the SubBytes lookup() function, the first step (the multiplicative inverse) is included also. I'm not aware of elegant equations for that step. Moreover, I don't see why the lookup() for the SubBytes step as a whole would require more area than a lookup for just the affine transformation. Lumping the two steps together in a single lookup seems the way to follow.

 "The bottom line is that software implementation is not hardware specification."

If I'm correct, the lookup() version for the problem as whole will be the superior solution, and the "hardware implementation" equations are superfluous.

The conclusion is that we have a single "reference" implementation that we can feed to a "software" compiler, a HLS synthesis tool, or an RTL synthesis tool, and expect excellent results. Following the logic of your article, that would suggest that software and hardware are conceptually indistinguishable, and that the only difference is the way in which different compilers look at the input description.

And that is exactly how I happen to think about it.

 

50%
50%
Myplanet
Myplanet
1/31/2013 1:21:06 AM
User Rank
Guru
Re: Hardware & Software
Hamster, am agreeing with you. Both hardware and software has their own stand alone identity and when they are integrating at the right mix, it's more powerful. Now a day's we can implement hardware functionalities also in digital form with software tools and programming languages.



100%
0%
hamster
hamster
1/30/2013 10:06:12 PM
User Rank
Blogger
Re: Hardware & Software
Yes. Hardware can run on it its own (if you define hardware as a digital system - inputs, outputs, logic and so on).

I am not 'into' implementing soft CPUs in my FPGA projects so nearly all of them are competely devoid of software, even though they might have a mouse, keyboard or monitor attached.

50%
50%
geekyasa
geekyasa
1/30/2013 8:19:14 PM
User Rank
Beginner
Re: Hardware & Software
Exactly MyPlanet . That is what I'm saying. You just can't get or have one thing and categorize it as an independent party

50%
50%
geekyasa
geekyasa
1/30/2013 8:16:51 PM
User Rank
Beginner
Re: Hardware & Software
Jack : I'm also referring to the same mate

50%
50%
geekyasa
geekyasa
1/30/2013 8:15:21 PM
User Rank
Beginner
Re: Hardware & Software
Dave do you think just a hardware can run on its own without a software ?

50%
50%
Max Maxfield
Max Maxfield
1/30/2013 10:23:39 AM
User Rank
Blogger
Re: Hardware & Software
@hash: I was the same way -- I started off as a young lad building hobby projects with transistors and 7400-series TTL chips -- so my brain was totally "tuned" to the way hardware works. I learned software programming -- FORTRAN and Assembly while at University, and Pascal and C after I left University -- Iand I was happy with that, but when I first ran across an HDL (before Verilog and VHDL existed) I immediately understood the concept and how it mapped onto the hardware.

50%
50%
hash.era
hash.era
1/30/2013 10:16:10 AM
User Rank
Clever Clogs
Re: Hardware & Software
I understood it really well. I dont know why others cant. Normally I have to go through 3 or 4 times to get something into my stupid brain but this went in like missile.

50%
50%
Page 1 / 4   >   >>
More Blogs from Brian Bailey
I believe 3D ICs are basically the replacement for the PCB. In the near future, the PCB will become nothing other than a holder with the ability to add connectors and perhaps a few components that cannot be economically integrated within the chip package.
Is the recent news that Altera will be using the Intel 14nm node with TriGate technology for their future FPGAs significant, or is it just industry noise?
Recent developments in high-level synthesis (HLS) and IP Integration technology mean that software developers can more easily create hardware to accelerate their applications.
The latest release of the Vivado SoC-strength design suite introduces IP integration and high-level synthesis (HLS) enhancements.
Do we know what we are verifying? Is it repeatable? Does it provide consistent results? And can we properly control the environment?
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