Use of FPGAs to teach Digital Circuits I - Page 1
Forum section: electronics / beginners

author: scrlk_
author_rank: Newbie
timestamp: March 17, 2015, 01:56:11 am
content: Hi, I've been interested in electronics since I was 12 and after some bad vocational choices I enrolled myself in EE at a local university. I am in second semester now and one of my courses for this semester is called Digital Circuits I.Today was the first lesson and the professor introduced himself and the course to the class. One of the things he said were that he wont teach the course using 30 years old chips and that we need to keep updated. Then he present us and Altera FPGA experimenter's board (I didn't look carefully the model) EDIT:After some seaching I found out that the dev board is an Altera® DE2-115. He said that we are going to use it throughout the course. Instantly, I had mixed feelings about that; on one side, I was excited and curious, but on the other, I was pretty sad and disappointed. Before the class, I was eager to learn using all the common and popular ics (ttl, cmos logic.) But it seems we are only to program the board and replace lots of experimentation and prototyping that the old ics give. I dont know it yet but I think we are just going to use a board as a "tangible simulator" (if you can understand me). I really dont think were are going to study deep on FPGAs in these course.I felt the same way about oscilloscopes; the lab at my school has only digital ones and on Introduction to Electronics we were only instructed to use digital ones not analogues.(but of course I asked for and crt one to experiment several times on free hours.)I had read a lot about many subjects regarding electronics, I had make some 555 timer circuits, power supplies (lm317 /lm338), really basic glue logic, and some microcontroller projects. I had watched lots of videos and tutorials too, lots of theory, but I feel I need some practice and experience.So I want some words of experience and wisdom about this situation, what do you think about using and Altera FPGA board on a basic digital circuits course?Thanks for your attention and replies.

author: eaj0010
author_rank: Newbie
timestamp: March 17, 2015, 02:28:25 am
content: Howdy,I think using an Altera FPGA evalulation board (I'm betting it's the MAX 10 part) is an excellent idea to learn FPGAs, and digital logic in general. I have been in the field for about 10 years designing boards / FPGAs with Altera and Xilinx FPGAs and they are fun to work with.FPGAs such as the one you are going to use, can interface with several different IO technologies such as those you mentioned (Typically LVTTL/LVCMOS for single ended IO, and LVDS / CML / PECL for differential).While I can empathize with you wanting to learn the basics at the chip level, FPGAs do in fact build circuits within the part (you code, but the resultant code is a physical circuit...not software running on a platform) and you are free to create timers, multiplexors, basic glue logic, etc. to your hearts content. Within the chip are blocks called slices that have combinations of muxes, D-type flip flops, and LUTs that all get connected together based on how you design the chip. Once you program it, the fuse circuitry literally builds the design and it runs as if it was a standalone part. FPGAs are also volatile too, thus if you don't have a way to program a flash that programs the part on startup (I'm betting that board does), your program will be lost and you'll have to re-program it again if you cut the power.I code using VHDL (I think the industry primarily uses Verilog / System Verilog) as I work in defense, and the language is a very "hard" language to learn. I mean that in the sense it is not very forgiving with syntactical errors.As for using a FPGA eval board to learn that stuff, I think it is a great start. I didn't have the opportunity to do FPGA design work when I was in college, and I wish I did.

author: free_electron
author_rank: Super Contributor
timestamp: March 17, 2015, 04:56:20 am
content: great idea. noi need to muck about spending hours wirewrapping or breadboarding with loose TTL parts.the altera software still lets you draw schematics.so my 2 cents says you will see base functionality using schematics , gates, registers, counters, shifters, adders , and more complex stuff.you can construct it , simulate it and actually run it on the fpga.once more complex systems are in order you will switch to a synthesis language.i think it is excellent. the point is to learn digital logic , not troubleshoot bad contacts in a strip board or waste 3 hours out of 4 wirewrapping a circuit.

author: miguelvp
author_rank: Super Contributor
timestamp: March 17, 2015, 05:07:17 am
content: Quote from: free_electron on March 17, 2015, 04:56:20 amWhile that is true, you can create an schematic symbol out of that module and use it in the top schematic.So you are only limited to digital circuits and the number of LEs in the FPGA.

author: scrlk_
author_rank: Newbie
timestamp: March 17, 2015, 05:12:02 am
content: Thanks for the feedback guys, I understand each of your points. After some seaching I found out that the dev board is anAltera® DE2-115. I am getting more excited the more I read the manual!

author: JoeN
author_rank: Frequent Contributor
timestamp: March 17, 2015, 07:52:33 am
content: That is a pretty powerful board. Way more powerful than the MAX10 that Terasic has available now. Are you all buying one or are there a few to use in the lab?If you want to do logic experimentation using 74HCT or 74LS ICs, by all means, get yourself a few and experiment. Or even a few old GALs and a very cheap programmer off of eBay. But really that isn't the way things are done anymore. You just don't see boards with scads of discrete chips on them. Usually, if there are a multitude of small chips it is going to be drivers or opamps, not a bunch of logic. But you will see a few here and there when it is necessary

author: tggzzz
author_rank: Super Contributor
timestamp: March 17, 2015, 08:28:05 am
content: There is nothing stopping you experimenting with topics outside your course.In fact if you do that it will look extremely good on your CV - employers will realise that you havinitiative, love the subject and do more than is necessary. They will then correctly infer that you will do more for them than is necessary. You have just jumped 90% of the queue

author: scrlk_
author_rank: Newbie
timestamp: March 17, 2015, 04:17:14 pm
content: Quote from: JoeN on March 17, 2015, 07:52:33 amNo, the lab have them. A group of two or three students per board.Quote from: JoeN on March 17, 2015, 07:52:33 amI will buy myself some or ask in the lab at free hours. I want to be able to use them and know when they are the best choice or necessary. I dont want to choose the overkill option. I will make myself time for this.

author: miguelvp
author_rank: Super Contributor
timestamp: March 17, 2015, 05:58:07 pm
content: Quote from: scrlk_ on March 17, 2015, 04:17:14 pmIf you want something to play with at home you can get yourself a DE0-Nano for $61 academic price from terasic, they do have other nice DE boards with academic price for around $100 and $150.If you want one cheap for learning but without many examples you could get an Arrow BeMicro CV for $50 with 25000 LE and a cyclone V, or the even cheaper BeMicro MAX 10 for $30 but only 8000 LEs. Of course they don't have all the peripherals but you can add them in a breadboard.More info about the BeMicro CV in this thread that someone was looking for a nano or an alternative:https://www.eevblog.com/forum/buysellwanted/wtb-(uk)-de0-nano-development/msg628796/#msg628796Also a quick tutorial to do some logic gates in verilog and exported as a symbol to use in a schematic top level in a link on that thread, but I'll add the link in here too:https://www.eevblog.com/forum/microcontrollers/bemicro-cv-questions/msg524041/#msg524041Not as nice but cheap and suitable to do things when you don't have access to the board in the lab.

author: TimFox
author_rank: Super Contributor
timestamp: March 17, 2015, 06:01:29 pm
content: After learning how digital circuits work using the FPGA boards, you will find that sometimes you need to use actual devices to see how things can go wrong in more extreme applications (ground bounce, fanout issues, interface to other devices, etc.), but that should come after understanding the logic.

author: coppice
author_rank: Super Contributor
timestamp: March 17, 2015, 06:23:33 pm
content: Quote from: scrlk_ on March 17, 2015, 01:56:11 amAre you sure you wanted to sign up for EE, and not a history course?

author: Neilm
author_rank: Super Contributor
timestamp: March 17, 2015, 07:15:17 pm
content: Using an FPGA for teaching digital design? OK will make the practical parts easier, but will you learn about K-maps? How about logic optimisation? State machine reduction? or good old fashioned race conditions.FPGAs are very nice if your system has lots of power free, but try designing one when all you have is 0.5mA from your supply. Also, if you ever have to design a state machine from discrete logic where you are not allowed to use anything programmable you could have a lot of problems. You might easily have the latter conditions in safety critical circuits

author: LabSpokane
author_rank: Super Contributor
timestamp: March 17, 2015, 07:30:12 pm
content: Quote from: datumplane on March 17, 2015, 07:22:09 pmExactly. We used 7400 series logic. I really wished it had been on FPGAs instead. It's good to be familiar with old school stuff, but it's not a modern job skill unless you end supporting legacy hardware.And after some of Chris Gammel's tweets from the ECE convention, I have to applaud any prof who exposes their student to a modern job skill to learn classical logic. Well done.

author: FrankBuss
author_rank: Unknown
timestamp: March 17, 2015, 07:43:53 pm
content: Quote from: LabSpokane on March 17, 2015, 07:30:12 pmSometimes this is all you need, for example if you develop a microcontroller circuit and need just some simple fast external logic, then it is cheaper to use 1 or 2 of these old 74xx chips than a CPLD or even FPGA.I would suggest that scrlk buys at least some old DIP chips, like a 74LS14 to build an RC oscillator with it (and learn why R and C has to be within some limits), or a 4051 analog multiplexer to build an auto range voltage meter in combination with a microcontroller, or even some basic chips like a 7400 or a flip-flop like a 74LS74, or a classic 4017 decade counter (combine this to build a high frequency counter). They are all available in DIP and cheap at Digikey. Then buy a breadboard and have some fun.

author: sacherjj
author_rank: Frequent Contributor
timestamp: March 17, 2015, 07:49:05 pm
content: I remember my 7400 logic project with 68HC11. It was a wonderful elevator controller. It worked awesome 8 hours before we turned it in. 7 hours before we turned it in, a cutoff resistor lead shorted 12V to 5V bus and blew all of the soldered in 7400 chips. Oh, I wish I could have uploaded that to a different FPGA.

author: JoeN
author_rank: Frequent Contributor
timestamp: March 17, 2015, 07:52:26 pm
content: Quote from: scrlk_ on March 17, 2015, 04:17:14 pmI am not a professional circuit designer but from what I see, small logic chips are used sparingly and when they are, you almost always see very simple ICs like flip-flops and simple logic gates on boards. A lot of these chips are still produced and are very, very inexpensive in small quantities. For example:http://www.newark.com/on-semiconductor/mc74hc595adtr2g/8-bit-sipo-siso-shift-register/dp/42K0910http://www.newark.com/texas-instruments/sn74lvc1g175dckr/d-type-flip-flop-signal-3-2ns/dp/10J9653http://www.newark.com/nxp/74hc374d-652/d-type-flip-flop-octal-14ns-soic20/dp/71R2395http://www.newark.com/fairchild-semiconductor/nc7sz58p6x/universal-configurable-logic-gate/dp/58K1987Obviously these are harder to prototype with than old 74HC or 74LS chips in a DIP package, but you might actually see these on a current design.

author: LabSpokane
author_rank: Super Contributor
timestamp: March 17, 2015, 08:05:50 pm
content: Quote from: FrankBuss on March 17, 2015, 07:43:53 pmOne or two, of course, agreed. But not an entire FSM like we had to do in the old days. I'm just happy that this student won't be wasting precious class and lab time on the digital equivalent of relay logic. Those days are over and done with.

author: JoeN
author_rank: Frequent Contributor
timestamp: March 17, 2015, 08:08:05 pm
content: Quote from: miguelvp on March 17, 2015, 05:58:07 pmOr this:http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=167&No=836&PartNo=285K LE, 174 multipliers, 6 PLLs, dual ARM 9 hard processor on the FPGA, lots of goodies on the board too. $175 academic. Probably a better value than the DE2-115 at $309.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: March 17, 2015, 08:28:06 pm
content: Quote from: JoeN on March 17, 2015, 07:52:26 pmOr very high-speed logic running at frequencies in the upper single-digit GHz.

author: miguelvp
author_rank: Super Contributor
timestamp: March 17, 2015, 10:09:16 pm
content: Quote from: JoeN on March 17, 2015, 08:08:05 pmI want one of those even if the price seems to have increased from last time I checked, I kind of recall two new SoC boards and one being around $100 academic price and $200 list.But to start, the System on a chip interaction might be too distracting, but as long as he can ignore the SoC part of it until needed that will be a great board.But I think a board with just the FPGA is more beneficial at least to begin with, but that's a great board for more advanced concepts

author: Dongulus
author_rank: Regular Contributor
timestamp: March 17, 2015, 10:17:09 pm
content: My first reaction was, but then I remembered frequently spending up to 6 hours in lab troubleshooting breadboarded circuits with 14 pin DIP packages and a mess of wires. Learning digital design using discrete 7400 series logic ICs can be a tedious exercise and is now mostly irrelevant. Using FPGAs should be a much more pleasant and rewarding experience for you.The issue I have is that I think you will miss out on some finer details about how real gates work. For example, it will be hard to teach the analog characteristics of transistor constructed gates and how they may impact a design. You won't get the benefit of probing the digital waveforms as they propagate through the circuit using an oscilloscope because your circuit is totally confined within the FPGA (also FPGAs don't actually build circuits using logic gates).

author: LaserSteve
author_rank: Super Contributor
timestamp: March 18, 2015, 12:00:52 am
content: I'm a university technician with many years of professional work before returning to work here.One, solderless breadboards should be banned from all labs.Two, nothing teaches about logic pitfalls like a discrete chip and a fast scope.Three, how are you going to get a FPGA to simulate a race condition or ringing?Four: There is something to be said about doing discrete transistor projects to make your own gate, which is a first lesson around here. You then get to overclock it and watch it fall apart.To the OP, To do it the ANCIENT way I did it, Get a copy of Bugbooks I and II here:http://www.bbookhistory.com/Buy some discrete chips and enjoy. You wont get traditional TTL easily, so substitute HC or AC or HCT parts, or similar.Tack Solder the connections and the grimace that occurs with traditional labs goes away.But also relish the FPGA time. You need BOTH sets of skills in this modern world.I'll also disagree with the practice of using exclusively low end digital scopes. The the ones used in undergraduate labs are usually Tek or Keysight 1200-2000$ models sold on educational discounts. Most of them memory depth limitations. Believe it or not the DS1102E on my bench has much better memory depth then the equivalent DPO most universities buy for this task.I know of what I speak. Before I returned to university service I was a FSE that traveled from university lab to university lab world wide. In the course of my duties I had to borrow a scope at each location. I got to use nearly everything out there.Steve

author: scrlk_
author_rank: Newbie
timestamp: March 18, 2015, 04:29:16 am
content: Thanks for the suggestions. It's very interesting (and important) to know the advantages and disadvantages(things/skills/experiences I be missing) of using such board for this course.Thanks for all the ideas for a board for home, I've checked every link. I like reading so thanks for the books links too.

author: LabSpokane
author_rank: Super Contributor
timestamp: March 18, 2015, 04:40:57 am
content: It is a great sign that you questioned skipping over discrete logic. That alone puts you up a notch in my book. Have fun and do us proud!

author: LaurentR
author_rank: Frequent Contributor
timestamp: March 18, 2015, 05:12:21 am
content: Digital circuits span a whole gamut from discrete logic on a board to 100M gate ASICs. The general principles are the same but everything else changes as you go up in integration and complexity (description, optimization, verification, best practices...).This forum is pretty heavily skewed toward board-level / discrete logic discussions, but digital logic is also used in much more complex circuits, FPGAs or ASICs.I think FPGAs are a pretty happy medium for learning. They give you the best turnaround time and fairly good debuggability while allowing to build things as simple or as complex as you wish. They are also used extensively in the industry, from the lowly CPLDs (not exactly FPGAs but close) to do a simple function to $5000 FPGAs in CISCO routers. So they are very relevant by themselves while also giving a good idea of what lies below (discrete logic) and above (ASICs).I have taught basic digital logic classes where the hands-on portion was using FPGAs and students could choose what they wanted to build. I regularly had students building basic microprocessors, a frame buffer to drive a VGA display, writing their own assembler and programming their hardware to run some basic game. You can only get to that level of complexity in the course of a trimester using FPGAs. At the same time, you cannot make something that complex work without very clearly understanding the principles of digital logic.So I think FPGAs are a good choice. That doesn't mean that you shouldn't also play with discrete logic some...

author: FrankBuss
author_rank: Unknown
timestamp: March 18, 2015, 07:10:49 am
content: Quote from: Dongulus on March 17, 2015, 10:17:09 pmWith Altera chips, you can use SignalTap, which can sample internal signals like a logic analyzer. Of course it is not the same as an oscilloscope, but very helpful for debugging more complex circuits and maybe for learning, too.

author: MrB
author_rank: Newbie
timestamp: March 18, 2015, 02:48:06 pm
content: Our first Digital Circuits class was all theory and not the best IMHO. We learned, for example, what a multiplexer did, but not why you would like to use one, which is the most important part for a lot of students (first why, then how).Now we're getting VHDL with a Xilinx board and boy do I like it. After 3 lessons we were building VGA drivers with ease. I think the reason most college's prefer FPGA's over breadboard logic is the speed of which new concepts can be introduced, without spending a lot of time wrapping wires. Being able to program FPGAs is also a valuable skill.

author: zapta
author_rank: Super Contributor
timestamp: March 18, 2015, 03:08:37 pm
content: Quote from: JoeN on March 17, 2015, 07:52:33 amYou can also do that with an FPGA. Write models for a few 74XX ICs and then connect them together to get whatever behavior you need. This will drive the point that 74XX's are just small arbitrary chunks of predefined logic.

author: langwadt
author_rank: Super Contributor
timestamp: March 18, 2015, 03:58:10 pm
content: Quote from: zapta on March 18, 2015, 03:08:37 pmFPGAs are a terrible match for 74xx. FPGAs are for clean synchronous logic with flipflops on preferably a single common clock, 74xx is a mess that is pretty much the opposite of that

author: FrankBuss
author_rank: Unknown
timestamp: March 18, 2015, 04:49:43 pm
content: Quote from: langwadt on March 18, 2015, 03:58:10 pmRight, that's how they are usually used. But you can still implement any 74xx chip (except the ones with analog functions, and with schmitt trigger inputs depends if you can enable this on the FPGA). Could be fun to implement a few of them in one FPGA devkit, with all inputs and outputs connected to pins, then wire it externally. This has the advantage that you can measure the intermediate signals with a real scope, too, and probably silly enough to be featured as a Hackaday article

author: Dongulus
author_rank: Regular Contributor
timestamp: March 18, 2015, 06:23:59 pm
content: Quote from: FrankBuss on March 18, 2015, 07:10:49 amThe OP will probably learn to verify logic using simulation as opposed to SignalTap. In either case those tools only give a functional view but they don't really communicate propagation delays nor rise and fall times.

author: tomizett
author_rank: Newbie
timestamp: March 18, 2015, 09:58:18 pm
content: I tend to agree with the contributors who've suggested that you might miss some of the tangability and real-life pitfalls that come from working with traditional logic ICs. Surely FPGA and discreet logic design are different but complementary skills.My main question, though, is what will you learn using an FPGA that you couldn't learn purely in simulation? If the answer is "not much", then would the university not be better off letting each student work individually - rather than have to share 3 to a board - and be able to take their work home with them at the end of the day?To add a little perspective to my comments, I generally prefer to design only with ICs that are older than me...

author: FrankBuss
author_rank: Unknown
timestamp: March 18, 2015, 10:10:28 pm
content: Quote from: tomizett on March 18, 2015, 09:58:18 pmThere are a lot of things you can only learn from the real hardware. For example if you have a clocked design and don't buffer some input push buttons, then anything can happen, like a statemachine entering illegal states. Very difficult to write a full simulation which simulates all this problems, and usually people use logic level simulations anyway for complex designs, because gate level simulations are sooo slow. You would never see such a problem in a logic level simulation. But for learning basic digital circuits, a simulator might be all you need, if you don't care about the details and real world problems (could be teached in a later course).

author: LabSpokane
author_rank: Super Contributor
timestamp: March 18, 2015, 10:13:50 pm
content: Quote from: tomizett on March 18, 2015, 09:58:18 pmIs your advice coming from a hobby development or a commercial development perspective? The OP is paying a boatload of money for a EE degree. Even if he/she goes onto grad school, the FPGA work is a marketable skill. Where is the market for new designs using solely decades old components? I'm genuinely curious what sector of electronics this would be.

author: mathias
author_rank: Regular Contributor
timestamp: March 19, 2015, 09:16:02 am
content: FPGA's will help you develop your "theoretical" digital skills much faster,butyour practical skills will suffer. If the course is well designed, the time gained by not using breadboards should be dedicated to practical problems.People here have already mentioned quite a lot of them (groundbounce, race conditions, etc.). Though you might never encounter these anymore (e.g. your synthesizer takes care of race conditions, setup-and-hold, ...), you need to know that things differ from theory to practice. Else, you end up with engineers who design circuits, the circuit gets up prototyped, and eventually never works. This is because some issue has popped up, which went undiscovered in the design phase because one didn't study the design critically enough.You could put 1000 monkeys writing HDL/spice, and at least one will write the circuits you want. But that doesn't make him an engineer.

author: drakke
author_rank: Regular Contributor
timestamp: March 20, 2015, 04:05:59 am
content: Quote from: LaserSteve on March 18, 2015, 12:00:52 amCan you explain how and what you use? I'm a beginner.I just bought a breadboard to build circuits and I can understand if you think the connections may not be completely solid all the time.

author: tggzzz
author_rank: Super Contributor
timestamp: March 20, 2015, 08:02:25 am
content: Quote from: drakke on March 20, 2015, 04:05:59 amThat's the primary reason. A component with a thick lead can open the spring so that when you put a component with a thinner lead in it makes intermittent or a hicher resistance connection.There are other reasons that are not a problem with audio circuits but can be a problem with digital circuits, since they have high-speed (= high frequency) edges. The capacitance between springs adds extra loading, and long wires add inductance, and the two together can resonate. Inductance and resonance are a particular problem with decoupling capacitors, but can also foul up oscilloscope measurements. (For your reference in the future, seehttps://entertaininghacks.wordpress.com/2015/04/23/scope-probe-accessory-improves-signal-fidelity/)