Total beginner at FPGA - Page 1
Forum section: electronics / general

author: mehulkasi85
author_rank: Newbie
timestamp: December 26, 2020, 04:16:28 pm
content: Hello everybodyI'm an electrical engineering student who found a huge interest in embedded systems. First, I learned arduino, no big deal, then I learned STM32 MCU, which was challenging, but then I found out about FPGA and read about them, and that caught my interest, so I borrowed a DE0-Nano SoC from a friend of mine to learn VHDL and Verilog and how to use FPGA, the problem is I have no experience with programmable hardware at all, I know nothing about VHDL/Verilog or how to use an FPGA, and I used google to look for some resources but I didn't find much or maybe didn't understand much.So, my problem is, I wanna learn FPGA but I am a complete beginner at that and I just want some books or resources to learn them.Thanks in advance for the help

author: rstofer
author_rank: Super Contributor
timestamp: December 26, 2020, 04:33:37 pm
content: Here's a place to start:https://www.nandland.com/Here's a place to go with VHDLhttps://vhdlwhiz.com/I'm sure there is a Verilog site of equal quality but I haven't gone looking for it.

author: radiolistener
author_rank: Super Contributor
timestamp: December 29, 2020, 04:10:46 pm
content: Quote from: mehulkasi85 on December 26, 2020, 04:16:28 pmjust buy some cheap Chinese FPGA dev board, they are come with examples and step-by-step instructions. You can open LED flash example, compile it and upload into FPGA. After that you can start to learn verilog and make experiments.

author: RoGeorge
author_rank: Super Contributor
timestamp: December 29, 2020, 04:33:11 pm
content: Since you mentioned microcontrollers and embedded programming first, then the FPGA and hardware description languages, keep in mind that they areunrelated.Verilog and VHDL is just a text to describe a schematic diagram. DO NOT THINK ABOUT THEM AS "PROGRAMING". They do not describe a program, they describe a schematic. Again, FPGAs are unrelated with software, it's hardware.If you keep that in mind, you'll love digital design.This is an easy and clean intro to the FPGA world, see if you like it (you'll need to know digital circuits first):https://www.fpga4fun.com/FPGAinfo1.html

author: asmi
author_rank: Super Contributor
timestamp: December 29, 2020, 04:37:40 pm
content: Quote from: radiolistener on December 29, 2020, 04:10:46 pmI disagree. These kind of boards typically very poorly supported, and it's the beginners who need that support the most - as people with some experience under their belts only really need a schematic and datasheets for all peripherals which are on a board. So I would recommend some of the better supported boards like the ones from Digilent, which has support forums for their boards, with their staff usually being quite responsive and helpful.

author: radiolistener
author_rank: Super Contributor
timestamp: December 29, 2020, 07:31:18 pm
content: Quote from: asmi on December 29, 2020, 04:37:40 pmI started with cheapest Chinese Cyclone IV board which consists of just FPGA, some LED's and one button. Such board is really not convenient in use, because you're needs to attach all peripherals manually. But then I bought QMTech board which consists of 3 digit 7 segment LED, usb2serial, Ethernet GMII and SDRAM on the board. And I think it is good enough for the novice...Here it is:https://www.aliexpress.com/item/33007471265.htmlIt has some issues:- there is just one clock pin, and it used for onboard TCXO, which unfortunately too small to replace.- GMII clock pins routed to the regular pin instead of CLK, so you cannot use GMII clock as a PLL source, but it still usable- usb2serial max speed is too small (it uses CP2102 and only RX and TX pins are available)But it still good enough for the start. And has interesting price.

author: rstofer
author_rank: Super Contributor
timestamp: December 29, 2020, 11:05:25 pm
content: I want a board with 'everything' and lots of it. I realize it is pricey but I don't care.https://store.digilentinc.com/nexys-a7-fpga-trainer-board-recommended-for-ece-curriculum/It is quite convenient to single pulse the clock and display debug information on the LEDs or 7-segment displays. I can even use the decimal points in the 7-segment display for additional status information.I have and use lesser boards like the Arty 7 and the Lattice IceStick but if I am starting a new project then I will pick the Nexys A7 unless there is a compelling reason to use one of the lesser boards.

author: radiolistener
author_rank: Super Contributor
timestamp: December 29, 2020, 11:24:53 pm
content: Quote from: rstofer on December 29, 2020, 11:05:25 pmIt is worse than QMTech Cyclone 4 starter kit for 24 USD that I posted above.Because it has 100 MBit Ethernet. It's too slow for FPGA experiments.And the price is 10 times higher.QMTech Cyclone 4 has less digits for 7-LED display, but it has 1000 MBit Ethernet and it allows you to make much more interesting experiments than a simple LED blinking.Almost all things are present on QMTech Cyclone 4 starter kit:- usb2serial- VGA- SDRAM- gigabit Ethernet PHY- one user button- 3 digit 7-LED display- two PMOD connectors- one 40-pin connector with user IO pinsAnd you can buy almost 10 starter kit boards for the same price as nexys-a7

author: asmi
author_rank: Super Contributor
timestamp: December 29, 2020, 11:36:53 pm
content: Quote from: radiolistener on December 29, 2020, 11:24:53 pmYou forgot that QMTech board has far more inferior FPGA onboard, which kind of makes everything else irrelevantOh, and exactly how many of your designs saturated 100 Mbit Ethernet network, so that 1G PHY actually made the difference? And how much resources did implementing 1G MAC took? 50% of the FPGA?

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 12:31:40 am
content: Quote from: asmi on December 29, 2020, 11:36:53 pmCyclone EP4CE15 has 15 kLE, 504 kB memory and 112x9 bit multipliers and 4 PLL, this is good enough for starter kit.Quote from: asmi on December 29, 2020, 11:36:53 pmI'm using FPGA for DSP and 100 MBit is not enough to feed my PC with high speed realtime data stream from FPGA. Onboard GMII ethernet module is the reason why I bought that QMTech board. I would like to see 10G PHY, but it cost a lot of money. Currently my design utilize up to 900 MBit network bandwidth. I want more, but 900 MBit is good result, especially when you look at the price

author: rstofer
author_rank: Super Contributor
timestamp: December 30, 2020, 12:32:06 am
content: Quote from: radiolistener on December 29, 2020, 11:24:53 pmAnd I would have to buy 10 starter kits to come anywhere close to an Artix 7 100T variant in terms of LUTs and BlockRAM (my two important characteristics).Altera LUTs = 15,408Xilinx LUTS = 102,400Altera BlockRAM = 504 KbitsXilinx BlockRAM = 3,240 KbitsI don't plan to use the Ethernet capability but HamsterNZ did a nice job creating a project to test throughput. I have forgotten which board we were looking at.It has been suggested that the 100T variant is overkill. That's probably true but, again, I don't care. I never have to worry about my little projects fitting in the device. And I tend to use a LOT of BlockRAM...How come the QMTech board has a 50 MHz clock input? I hope that's not some kind of flag. At least the Digilent board has a 100 MHz clock so I don't have to play with the PLLs to get a decent clock speed.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 12:39:45 am
content: Quote from: asmi on December 29, 2020, 11:36:53 pmFull 1G MAC implementation + UDP stack + ARP/DHCP + ICMP ping consume about 36% LE and 44% memory

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 12:49:47 am
content: Quote from: rstofer on December 30, 2020, 12:32:06 am100M MII PHY is not enough for almost any design which is really needs FPGA for implementation.GMII or USB3 is must have to have high speed transfer.Quote from: rstofer on December 30, 2020, 12:32:06 amIt doesn't matter what is the frequency, TCXO anyway will be used to feed the PLL, so technicaly there is no difference between 50M and 100M TCXO. They have the same jitter/stability performance. And you're get exactly the same frequency set for both 50M and 100M source. Just no difference.I tested onboard 50M TCXO performance. It's not the best, but good enough for the starter kit.Tested it to produce up to 1 GHz clock on PLL, works ok.Quote from: rstofer on December 30, 2020, 12:32:06 amyes, EP4CE15 has just 504 kBit memory. This is not too much.But there is onboard 32 MB SDRAM on QMTech starter kit

author: rstofer
author_rank: Super Contributor
timestamp: December 30, 2020, 01:03:10 am
content: I pointed out earlier NandLand.com and their $65 "Go Board". I don't care about the board except that it is used for all of the tutorials. It's worth the cost just to keep track with the tutorials. Think of it as tuition.For the tutorials at VHDLwhiz.com, the Lattice IceStick is the preferred devicehttps://www.digikey.com/en/products/detail/lattice-semiconductor-corporation/ICE40HX1K-STICK-EVN/4289604I don't prefer the Lattice board and I'm not going to write home about their tools but it all works out and the tutorials (especially the two 'for pay' tutorials) are very good.I probably have 8 or 10 development boards going back to the Spartan 2. They have all been educational in one way or another and education, as we well know, is never free.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 01:09:03 am
content: Quote from: rstofer on December 30, 2020, 01:03:10 amIt has too small user IO.For example, I'm using full JP1 slot for 15 data lines and 1 clock line from ADC module. If I decide to attach ADC and DAC module simultaneously, I can use 40-pin user IO connector.I see just one PMOD connector on IceStick. This is not enough even to connect ADC module...Also, I see that IceStick using MEMS oscillator as a clock source. This is bullshit.I have similar stick CYC1000:https://shop.trenz-electronic.de/en/Products/Trenz-Electronic/CYC1000-Intel-Cyclone-10/its very small and good quality, but it also using MEMS oscillator.I recommend to replace it with normal TCXO.Because MEMS oscillators are very unstable and it's frequency floating like piece of ice in the water.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 01:34:36 am
content: Quote from: radiolistener on December 30, 2020, 01:09:03 amI recommend to ignore this recommendation, because it's pointless outside of very few very specific use cases. Heck, even PCI Express 5.0 works just fine using MEMS oscillator.

author: james_s
author_rank: Super Contributor
timestamp: December 30, 2020, 01:37:17 am
content: Forget everything you know about programming because it's not going to help you with FPGAs, it will make things harder if you approach HDL like you are writing a program. It isn't a program, it doesn't execute, the instructions are not sequential commands. It is a language that describes the behavior of a digital circuit, it's more like describing a schematic in words than a list of instructions with flow control like the programming you're used to. Superficially it resembles a program but that is about where the similarity ends.As far as learning, there are many resources out there. I found the free book "Free Range VHDL" to be very helpful. I also learned a great deal from Grant Searle's "Multicomp" project which is open source and freely available. There are several decent courses on Udemy if you learn well from video lectures.Don't worry too much about the hardware, you don't even need hardware to get started, although it does make it more fun. I've acquired a lot of different FPGA boards over the years but still the ones I use most are also the cheapest I've ever found, the EP2C5T144C8 mini boards that you can get for about 13 bucks from China. They're small and cheap enough to just integrate into finished projects if you want. My next favorite is my DE2, it's also a rather old Cyclone II but it's quite a large one and the board has loads of LEDs and switches. The big complex boards can be a pain for simple projects though because you have hundreds of pins you have to assign and make sure all of the unused pins are in safe states that are not driving something high that is being held low by something else for example.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 01:40:30 am
content: Quote from: radiolistener on December 30, 2020, 12:49:47 amThat is a very bold claim that could use some substantiation. So far most of my designs didn't need any Ethernet at all...Quote from: radiolistener on December 30, 2020, 12:49:47 amAs I said above, TCXO is overkill for just about any designs aside from those where frequency stability is critical (like frequency counters). For all other designs it's pointless.Quote from: radiolistener on December 30, 2020, 12:49:47 amWith bandwidth of a snail - sure, otherwise it's as good as non-existent. That Digilent board has 128 Mbytes of much faster DDR2, and even that is kind of low, as their other boards have higher capacity DDR3 devices.

author: james_s
author_rank: Super Contributor
timestamp: December 30, 2020, 01:43:31 am
content: Quote from: rstofer on December 30, 2020, 12:32:06 amWhy on earth would you avoid PLLs? It's trivial, Xilinx and Altera both have wizards that do all of the setup for you, you enter the input frequency and the frequencie(s) you want and it spits out a PLL that you instantiate into your design. I use a PLL in every one of my projects aside from the most trivial quick experiments, it's one of the first things I set up after defining the inputs and outputs. The input clock speed is irrelevant with the modern parts, the PLLs are very versatile. In the old Cyclone II's I use often they are not nearly as flexible but even so 50MHz is a good starting point. It's common because it works fine even on a relatively simple PCB layout.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 02:09:12 am
content: Quote from: asmi on December 30, 2020, 01:34:36 amThis is MEMS 12 MHz and result of feeding it to PLL to produce 100 MHz. At the center I put my hand near the board. All other is self instability. If you accept so high instability and high phase noise, you can use it.But this is unacceptable if you want to clock high speed serial. Also it's unacceptable if you want to produce high frequency on PLL and capture data on high speed ADC from such clock.MEMS oscillator is a crap...

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 02:19:49 am
content: Quote from: radiolistener on December 30, 2020, 02:09:12 amIt makes zero difference for most high speed serial interfaces because most of them are designed to tolerate quite a bit of clock variation. For things like PCI Express it's irrelevant at all, because both sides use the same reference clock, so even if in wanders, it does so on both sides at the same time. You can try it yourself - get rid of TCXO, and I guarantee you that your serial links will work just fine. For ADC it might be different, but not for serial links. Speaking of which - what kind of "high-speed serial interface" you are talking about with ancient Cyclone 4?It can't even get to 1 Gbps bandwidth per pin.Besides, do you still remember that you are in the thread named "Total beginner at FPGA". So do you really expect a total beginner to mess with multi-gigabit links?

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: December 30, 2020, 02:20:37 am
content: Quote from: mehulkasi85 on December 26, 2020, 04:16:28 pmI'm just starting out as well. My goal is to use a FPGA with a Raspberry Pi, so I bought one of these:https://www.bugblat.com/products/pif/index.htmlA snippet of the blurb:Quote

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 02:23:18 am
content: Quote from: JohnnyMalaria on December 30, 2020, 02:20:37 amQuote

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 02:29:34 am
content: Quote from: asmi on December 30, 2020, 02:19:49 amYes, and this is why I recommend to not use boards with MEMS oscillator. You can catch instability and other issues with it and it's not obvious what is the root of cause, it's hard realize that the floating bug happens due to a poor clock from MEMS oscillator.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 02:34:32 am
content: Quote from: asmi on December 30, 2020, 02:23:18 amdo you think that the powerful and very expensive FPGA with a lot of resources is really what beginner needs for experiments? It's easy to burn some pin on FPGA. If you use cheap Chinese starter kit board, you can just buy a new one. Because it's not expensive.But what happens if you bought 1000 USD FPGA board and burned it due to a wrong connection?

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 02:37:32 am
content: Quote from: radiolistener on December 30, 2020, 02:29:34 amUsing FPGA which has ZERO pins that can reach even 1Gpbs?Quote from: radiolistener on December 30, 2020, 02:29:34 amBS. I have implemented designs going as high as 8 Gbps per differential pair using MEMS oscillator and had zero issues with dropped links. So if you can't do that - you are doing it wrong, and MEMS is 100% not a problem.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 02:39:05 am
content: Quote from: radiolistener on December 30, 2020, 02:34:32 amI've NEVER burned a single pin in all of my FPGA experiments and projects. So refer to my previous post - if you did, you are doing it wrong.But then again - I don't actually have any 1000 USD boards. The most expensive one I got is Genesys 2, which is just 999 USDThis is the board I used to reach 8 Gbps per diff pair, as Artix can only go as high as 6 Gbps. Though I have plans to make SFP+ FMC board which should allow me to reach full 10G per channel. If only I would have enough spare time for that

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: December 30, 2020, 02:43:32 am
content: Quote from: asmi on December 30, 2020, 02:23:18 amWhy laugh? For abeginner, it's good enough. $49.God, I hate smug buggers.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 02:44:41 am
content: Quote from: JohnnyMalaria on December 30, 2020, 02:43:32 amIt's fine for beginners, but calling it "powerful" is just wrong. Call it for what it really is - low end device good enough for very simple projects.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 02:49:25 am
content: Quote from: asmi on December 30, 2020, 02:37:32 amif your circuit has a single clock with no asynchronous lines, you can do that and it will works at some conditions with proper PCB layout. But I tried this MEMS oscillator to wire FPGA with external serial port (RX/TX line with start/stop bits) and it has transfer errors at megabit speed. This is not what beginner needs to fight with.Such board needs good and stable oscillator for different experiments, for example serial communication or frequency meter is a nice project for a beginner.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 03:02:30 am
content: Quote from: radiolistener on December 30, 2020, 02:49:25 amSo your problem was crappy layout, not oscillator. At 1 Mbps even really bad oscillator is going to be just fine, as even super bad ones have jitter in the order of 100's of ps. So for 1000 ns period even 1 ns jitter (which I've never seen in person even on a cheap-ass Chinese boards) will make zero difference because you are going to be sampling at 500 ns into the change.Quote from: radiolistener on December 30, 2020, 02:49:25 amNo you don't. For frequency meter that may be, but everybody's interests are different. For example, most of my FPGA projects were about realtime image and video processing, CV and stuff like that, for that kind of designs the type of oscillator makes no difference because all processing is done in digital domain. Same for serial links - proper layout is going to be much more critical than the oscillator stability. Take a look at the project in my signature - it's got a few 1.45 Gbps serial links (for HDMI 1080p), and they work with no problems using ordinary MEMS oscillator to synthesize required frequencies for the kind of bitrate that Cyclone 4 can only dream of. To be sure, MCMM block that I use inside that FPGA has a jitter filter, which helps, and it makes this debate even more pointless.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 03:03:57 am
content: Quote from: asmi on December 30, 2020, 03:02:30 am1 Mbps is too slow, I wanted to use at least 10-12 MBps.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 03:22:06 am
content: Quote from: radiolistener on December 30, 2020, 03:03:57 amStill. I recently designed small addon board for the board from my signature with 100 MBit ethernet PHY, so it has 25 MHz MII interface going over regular 0.1" pin header with no length matching nor controlled impedance, and that interface works at full speed with no errors.So if you had bit errors at 3 Mbps, your sampling point was probably too close to data transition points. For 10 Mbps we're talking 100 ns periods, so you can have your sampling point at 25 ns and that will guarantee no bit errors regardless of jitter (unless you had like 25 ns of jitter which is just ridiculous, and no oscillator is going to have anything near it). Heck, I had 50 MHz SPI working over the breadboard with flying leads as connections, so the was definitely something wrong with your design. If you want to get to the bottom of this, begin a new thread and hopefully we can figure it out. But one thing is for certain - whatever the reason is, it's not related to the clock itself.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 03:29:57 am
content: Also the bad thing with MEMS is that when you produce 400 MHz and above with PLL, it works very unstable. If you want to use your FPGA board as a signal generator, it works very poor from MEMS oscillator. Just see the screenshot.Such instability is unacceptable even for amateur purposes.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 03:37:27 am
content: Quote from: radiolistener on December 30, 2020, 03:29:57 amAgain, the board in my signature generates bit clock of 742.5 MHz for HDMI output from input MEMS oscillator running at 100 MHz, and guess what - interface works just fine. So you are looking for a problem in the wrong place.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 03:52:44 am
content: Quote from: asmi on December 30, 2020, 03:37:27 amyes, it generates, you can see it on the screenshot above. But do you see how is dirty and unstable signal is when you clock FPGA from MEMS oscillator?For comparison, here is TCXO 50MHz feeded to PLL to produce the same 400 MHz on QMTech starter kit board.Do you see the difference between MEMS and TCXO?

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 04:29:30 am
content: Quote from: radiolistener on December 30, 2020, 03:52:44 amI don't see any difference on my monitor, which shows stable HDMI video stream with no problems, and that is the only thing that matters. Which was my point all along. If design works with MEMS, there is exactly zero reasons to bother with changing oscillators. Besides, how many FPGA devboards do you know which have TCXOs onboard? I can't think of a single one. You might want to think about the reasons for that. And before you say "cost", I urge you to take a look at something like Xilinx KC705, which cost over 1500 USD, and have interfaces going as far as 10 Gbps, yet all they have is regular MEMS oscillators.Again, you are looking for a problem in the wrong place. Clock jitter doesn't matter in 99% of cases, as long as it's not ridiculously large. Anything lower than 1% is going to be just fine.

author: radiolistener
author_rank: Super Contributor
timestamp: December 30, 2020, 05:06:11 am
content: Quote from: asmi on December 30, 2020, 04:29:30 amBut starter kit is not intended for a limited design. It should works good for different tasks, include frequency meter project and analog data acquisition and processing from high speed ADC/DACQuote from: asmi on December 30, 2020, 04:29:30 amFor me the clock jitter and phase noise matters very much, because I'm using it to produce DAC output. Any clock jitter leads to worse dynamic range and spectral purity of the output signal. From my point of view this is the main purpose of FPGA - fast DSP working at tens and hundred MHz speed to process ADC/DAC data and transfer it from and to PC at high speed.

author: BrianHG
author_rank: Super Contributor
timestamp: December 30, 2020, 05:32:49 am
content: Quote from: asmi on December 30, 2020, 04:29:30 amWarning, many HDMI screens support 'spread spectrum HDMI' meaning any crappy clock will work. Can you say that your monitor supports spread spectrum HDMI or not?If you were to plug your low quality source clock into an HDMI monitor which doesn't support spread spectrum HDMI, will you get jittery pixel errors?I ran into this problem 10 years ago. Many large screen Sharp TVs would work perfectly, but, some Sony TV had crap jitter around the pixels. It took a month to discover all I had to do was disable spread-spectrum and the picture became perfect on the Sony TVs at the time.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 06:05:07 am
content: Quote from: BrianHG on December 30, 2020, 05:32:49 amWe're talking about <0.01 UI jitter as "bad clock". It's not really bad enough to matter.

author: Canis Dirus Leidy
author_rank: Regular Contributor
timestamp: December 30, 2020, 04:35:59 pm
content: Quote from: rstofer on December 30, 2020, 12:32:06 amNot really, Their (QMTech's) starter kit version with XC7A100Tcosts just $100.

author: Bud
author_rank: Super Contributor
timestamp: December 30, 2020, 05:04:52 pm
content: Quote from: radiolistener on December 30, 2020, 03:29:57 amSeems an unlocked PLL to me. Poor PLL design.Edit: Poor PLL loop filter design.

author: emece67
author_rank: Frequent Contributor
timestamp: December 30, 2020, 05:27:09 pm
content: .

author: rstofer
author_rank: Super Contributor
timestamp: December 30, 2020, 06:57:58 pm
content: Quote from: radiolistener on December 30, 2020, 02:34:32 amWhich is one reason for putting 330 Ohm resistors in series with all IO pins. It takes the worry out of short circuits and it also helps damp down reflections.For the Nexys A7 board, Digilent is using 200 Ohm resistors and clamp diodes on the pins (Page 1, upper right corner). I certainly wouldn't quibble about the lower value.https://reference.digilentinc.com/_media/reference/programmable-logic/nexys-a7/nexys-a7-sch.pdfThese "student" boards are designed to help reduce mortality.

author: rstofer
author_rank: Super Contributor
timestamp: December 30, 2020, 07:52:29 pm
content: http://people.cs.georgetown.edu/~squier/Teaching/HardwareFundamentals/LC3-trunk/docs/LC3-uArch-PPappendC.pdfLook at Figure C3 for a block diagram of the LC3 CPU. The CPU isn't the point of this reply, the diagram is.Notice the number of MUXes: MARMUX, PCMUX, ADDR1MUX, ADDR2MUX, SR2MUX, INMUX and that MUX with the MIOEN control signal. You would think that being able to code MUXen is an important task - and it is! There's a straight out adder and an ALU - coding those would be the next topic. The adder is trivial and the ALU is pretty simple. We also have a register file with is actually two files (arrays) in parallel. When we load a register, we write both copies but we can read them out separately so we can do R3 = R1 + R2 in one cycle. We just read R1 from one copy and R2 from the other copy and present them to the ALU (and the SR2MUX).These are the kinds of things you need to learn how to code. All digital systems are built from these basic blocks and the complexity of a system is just a count of the number of blocks.On page 2 there is a transition diagram. You use that to create the Finite State Machine that makes the CPU work. Every numbered state is duplicated exactly in some HDL and, in my case, I used an integer for the state type so I could match the state numbers on the diagram. It takes a little time and thought to realize that every control signal is generated in that state machine. Once you think about it, it's both obvious and brilliant!Find a tutorial that teaches you how to code an FSM. I prefer the two process approach, the one process and three process approaches will also work. You have no idea what I'm going on about but don't worry! It will be covered in great detail when you start on the tutorials. Hint: Don't forget to provide default values for all outputs of the two and three process models. Again, this will be discussed in the tutorial (if it is worthwhile).There's nothing on that page that resembles C++ although I could create a class for every block type and write some sequential code that would do in software what this CPU does in hardware. It might even be an interesting experiment. Hint: It's been done before... My PDP11/70s are software emulations running on a Raspberry Pi and they are faster than the real hardware. No, I didn't write the code.https://obsolescence.wixsite.com/obsolescence/pidp-11Bottom line: Find tutorials that will teach you how to code the basic blocks. We just keep using the same blocks, over and over. Different signals, different widths but, fundamentally, the same blocks.Here are a couple of example MUXen:Code:--PC Mux Controlprocess(PCplusOne, PCadderOutput, mBus, PCSelect)begincase PCSelect iswhen PCplus1 => PCmuxOutput <= PCplusOne;when PCadder => PCmuxOutput <= PCadderOutput;when PCmBus => PCmuxOutput <= mBus;when others => PCmuxOutput <= (others => '0');end case;end process;-- MAR Mux Controlprocess(PCadderOutput, Zext, MARSelect)begincase MARSelect iswhen MARadder => MARmuxOutput <= PCadderOutput;when MARzext => MARmuxOutput <= Zext;when others => MARmuxOutput <= (others => '0');end case;end process;See how straightforward this stuff is? It's the same code, over and over!

author: rstofer
author_rank: Super Contributor
timestamp: December 30, 2020, 08:22:19 pm
content: In terms of VHDL, this book is pretty good and it's FREE!http://freerangefactory.org/pdf/df344hdh4h8kjfh3500ft2/free_range_vhdl.pdfThe FSM discussion on page 93 is worth studying. Remember when I said to provide default values to all outputs in a two process FSM? Well, Z1 <= '0' (line 3 of comb_proc) is that default value and you have to provide defaults for every output of the FSM. It's easy to forget and, more likely than not, nothing works! There's a reason I know this and keep mentioning it. If the synthesizer says you have inferred latches, that's where they are - outputs which aren't defined in every state and have no default value. Every time you expand the capability of the FSM, you are probably creating a new output and you need to provide a default value.See bullet item on page 95An example of default values from my LC3 project:Code:-- set default values for all signalsGateBusSelect <= GatePC;MIOenable <= '0';LD_MAR <= '0';LD_MDR <= '0';LD_IR <= '0';LD_BEN <= '0';LD_PC <= '0';LD_Reg <= '0';LD_CC <= '0';LD_Privilege <= '0';LD_Priority <= '0';LD_PSR <= '0';LD_SavedUSP <= '0';LD_SavedSSP <= '0';LD_VectorAddr <= '0';PCselect <= PCplus1;MARSelect <= MARzext;Addr1Select <= Addr1PC;Addr2Select <= Addr2Zero;SR2select <= SR2OutSel;SR1addrSelect <= SR1usesSR1;ALUop <= ALUpassA;DRaddrSelect <= DRusesDR;MemWr <= '0';SPselect <= SPminusOnesel;VectorMux <= "00";Privilege <= '0';

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 08:46:46 pm
content: I think nandland has the best tutorial series for total beginners. In my opinion his board is worth buying to support the author and so that you can follow tutorials and experiment with them. And they are bilingual, having sections for both Verilog and VHDL, so you can get a glimpse at both.

author: asmi
author_rank: Super Contributor
timestamp: December 30, 2020, 09:37:23 pm
content: Quote from: Canis Dirus Leidy on December 30, 2020, 04:35:59 pmThis is a typical Chinese crap board designed by a mindless drone who obviously had no idea what he was doingBecause if he had even a single working brain cell, he would never placed a 3 Amps DC-DC converter for a device which can draw up to 7 Amps of current, not to mention there having zero provisions for any type of thermal control despite the fact that this FPGA can dissipate up to 10 W of power, and there is no way it won't overheat without some sort of cooling.And this is exactly why I always recommend beginners to avoid these garbage boards in favor of name brands at least until they have enough experience and knowledge to know all of the above so they can judge by themselves if board is designed properly and will actually do what they think it can do.

author: rstofer
author_rank: Super Contributor
timestamp: December 31, 2020, 01:51:06 am
content: Quote from: Canis Dirus Leidy on December 30, 2020, 04:35:59 pmBut where is the 8 digit 7-segment display to hold the Accumulator and Program Counter displays?How about the 16 switches for Console Entry Switches?Or the 16 LEDs for status information?Or even the push buttons for Run, Halt and Single Step?I realize that not everybody needs those features and I also realize the Digilent board is expensive, but I do need the features and I don't care about the extra cost. Rigging up something off the board is certainly possible. I have used one of the Maxim display chips to create 16 7-segment digits over an SPI bus and it worked very well. I also used a port expander to collect up 16 console entry switches over SPI. I would prefer to have the gadgets on the board rather than laying on the bench. Or worse, group mounted on a plywood backboard. Actually, that worked out rather well. Considering...Another use for the console switches: Implement breakpoints based on the PC. This is sometimes useful when bringing up an OS. Once the CPU has hit the breakpoint, resort to single stepping. The status LEDs will be helpful!

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 31, 2020, 05:52:40 pm
content: QMTECH boards are OK if you know what you're doing, but I agree they are not that well adapted to beginners.As to their design itself - from what I've seen (I can only talk about the ones with Xilinx FPGAs), they are OK for the lower end parts (Spartan 6 up to LX25, Artix 7 up to 35T I'd say), but beyond that, nope. The reason is that, as said above, power supplies are not properly sized, there is not heat management, and there is overall poor decoupling.So yes, the board with an Artix 7-100T is basically designed just like the ones with lower end parts, and you won't be able to do anything serious with it in a reliable way, unless maybe you're designing very low frequency stuff.

author: hamster_nz
author_rank: Super Contributor
timestamp: December 31, 2020, 09:07:58 pm
content: It is like saying 'I want to take up cycling as a sport'.You can pop down your local big-box store and buy a $100 bike and aseemble it. It will have two wheels and a handlebar just like any other bike. You will be able to ride down to the local store on it, on nice paved roads.But if you really want to have a bike which will take you places, down tracks and trails you don't even know about yet, and will not break down and leave you stranded then move to a good known brand for a specialist retailer.How many hours do you want to be stranded, figuring things out complex issues on your own, because of lack of documentation and as nobody (not even Google) can offer you meaningful advice?A nice FPGA board is a pleasure to work with, and allows you to focus on your learning and experimenting, not trying to get the blasted thing just to accept a bit stream, clock properly, or work out that your LEDs are active low.I recommend you find the resources you want to use to learn (PDFs, courses, YouTube subs) then get the board they use.

author: james_s
author_rank: Super Contributor
timestamp: January 10, 2021, 12:50:31 am
content: Quote from: asmi on December 30, 2020, 02:44:41 amThe smallest 10 year old FPGAs on the market are "powerful" relative to the small microcontrollers most hobbyists are used to working with. A single IC that I can fit an entire 8 bit computer with VGA video output inside it is "powerful" in my book. It may not be spectacular compared to the state of the art but even small FPGAs can be very capable.

author: james_s
author_rank: Super Contributor
timestamp: January 10, 2021, 12:52:24 am
content: Quote from: radiolistener on December 30, 2020, 05:06:11 amIf you want to make a frequency counter then connect an external high stability timebase, OCXO or GPSDO. I have never once found it necessary to replace the onboard oscillator on any of my FPGA boards, I just haven't built anything where it matters.

author: james_s
author_rank: Super Contributor
timestamp: January 10, 2021, 12:57:33 am
content: Quote from: rstofer on December 31, 2020, 01:51:06 amConnect them externally if you need them. I have a handful of "drivers" in the form of HDL files I can instantiate into larger designs that drive various serially interfaced displays and input devices. A PS/2 keyboard and 8 (or however many) digit LED display can be connected with 4 or 5 pins and a handful of logic fabric.