Wildcard Week

Wildcard Week

By Saheen Palayi | 14 May 2021 | FAB Academy 2021

week 15 Design and produce something with a digital fabrication process (incorporating computer-aided design and manufacturing) not covered in another assignment, documenting the requirements that My assignment meets, and including everything necessary to reproduce it


We are still under super lock down and the Lab is still not Opened.I like to do and document a Pick and Place Machining Process this week.But only possible after reopening the LAB.

So when we all are left the LAB I was taken A Lattice ICE Evaluation Kit from the LAB to Explore more about it.so The Field Programable Gate Array or known as FPGA is another option to do this week.


The Field Programable Gate Array

The Field Programable Gate Array (FPGA )is a type Programable Chip Includes A large array of Logic Integrated Components that Let user to create their own Microcontroller or Processor for Multi tasking purposes


 Networking&interfacing
From wikipedia article

Software Installation

To program the Lattice ICE40 Evaluation kit development board we need a software SDK supports the board it also listed in the Lattice FPGA website

I found this lattice ICE40 software Installation tutorial video created by a guy name Dom from YouTube.According to Lattice Instructions I might need 3 software tools

The above attached links will lead to the download page.Sign UP needed in order to download the tools.Available for both windows and Linux platforms.I downloaded for the Windows platform


Wildcard Week

I created an FPGA directory on my Desktop and extracted the software tools then Started to install one by one


Wildcard Week

first I installed Lattice Diamond Programmer Standalone tool.This is used for detecting and programing the FPGA Chip


Wildcard Week

This is the Dimond Programer interface


Wildcard Week

Then I installed iCEcube2 Design software.After the installation compete it shows an error


Wildcard Week

It says that "your 30 days free licence expired..." and also it's required a licence file .so I again logged to the latticesemi.com for thelicence


Wildcard Week

Lattice offering a free licence for iCEcube2 Design software so I followed the Instructions to get the licence file


Wildcard Week

It required my computer Physical address for that I used this command in cmd to get the address like the lattice Instruction

ipconfig/all

Wildcard Week

Then I copied the address code to the required input box on the latticesemi website


Wildcard Week

After I clicked generate option that sent me a file to my mail


Wildcard Week

Then I downloaded the file and moved to the FPGA folder directory


Wildcard Week

Then I tried to re-open the iCEcube2 software and shows it required a licence file I navigated to the folder directory


Wildcard Week

Then clicked finish and it Opens the iCEcube2 design software!


Wildcard Week

There are some extra softwares installed too.all come with the iCEcube2 installation pack


Wildcard Week

Still facing issues with the licence file getting error while opening the extra tools installed along with ICECube2


Wildcard Week

So I solved the problem by creating a folder called "flexlm" inside the C drive then moved the 'licence.dat' file in to it.

Let's Begin-NOT Gate in FPGA

For the first project I decide to do a NOT gate on the Lattice ICEStick Evaluation board.So like I said logic gates are the basics of digital electronics.Here NOT gate is the simplest gate in logic gates


Wildcard Week

The above figure shows the symbol of the Not gate and also its input/output truth table.what ever value we gave to the in put,we get Negation of the input value at the out put.and of course there is only a '1' and a '0' in digital electronics


Wildcard Week

I created folder named NOTGATE inside my FPGA/Project Directory and Opened in VS Code editor.Then started to write the code for the NOT gate


    module NOT_GATE(y,a);  
        output y;
        input a;
        
    
    assign y = ~a;
        
    endmodule

You can see from above figure I used this simple code in side the 'Not-gate.v' file ( '.v' stands for Verilog ).then I saved the file.

Then I opened the iCEcube2 FPGA Design software and double clicked on the 'New Project' option


Wildcard Week

I gave a project Name 'Not_gate_ICE40' then liked the file directory of NOTGATE project That I already build .and given other required information ass well shown in the above figure .then clicked 'Next'


Wildcard Week

In the next window I added the Verilog program file by clicking the 'Add' button as shown as in the figure .then clicked finish


Wildcard Week

The project successfully created! now I need to compile te program that I added so double clicked on the 'Run Simplify Pro synthesis' option then it started to compile the code


Wildcard Week

So the compilation successful! without any error You can see the log results on the window.Two file associated this project being created in side the iCEcube2 project folder.we can see that under the P&R Option on the iCEcube2 Software. This editor only used for compile and generate code we cant edit the program using iCEcube2


Wildcard Week

Then I double clicked on the "Import P&R Input Files" option from the left which import the files from thee directory for preparation of the bin file generation process


Wildcard Week

Now I need to set the pins for out put and the input.It has 5 on board LEDs,but doesn't have any onboard buttons .I'm decided to use this pins from the Pmode connector of the Lattice ICEStick Evaluation board for a button as an external input


Wildcard Week

I found the PIN OUT information of ICEStick from the user guid.So I selected the green LED which connected to PIN number '95'.Also found the PIN OUTS of the Pmode connector


Wildcard Week

I selected the 4th pin of Pmode connector which is right above the GND pin But it desnot provided the PIN number I refereed the circuit diagram of Lattice ICEStick to get the pin Number.given on the same document


Wildcard Week

so The PIN Number for the button is '81'. Then I selected the Pin configure Icon on the ICECube2 tab to set the input Out put Pins


Wildcard Week

That opens a new window tab in the iCEcube2 to setup input,output pins


Wildcard Week

I entered both the input and output PIN numbers and also made Pull-up enabled for the INPUT PIN because i'm connecting button without any pull up resistor . some pin of this Board supports the Pull-up features


Wildcard Week

We can also save the pin configuration setup as a file for future modification.So,by clicking Save icon on the top I saved to the project directory along with the Not-gate.v code


Wildcard Week

PIN configuration file saved with '.pcf. file name extension that we can open in code for future editing and other modifications


Wildcard Week

Then I Generated the bin file in the ICECube2 by clicking 'Tool >> Run All' option that generated the BIN file for programing to the ICEStick inside the project directory the Job of the iCEcube2 is finished here


Wildcard Week

I Plugged the ICEStick Evaluation Board to my Pc's USB port and opened the Diamond Programer tool.Then I clicked detect Cable it will detect the ICEStick as an USB FTDI Device.after I Clicked 'OK' button to continue


Wildcard Week

After that I started to setup the device By selecting...

Then I clicked 'program' under Operation


Wildcard Week

In the Opened window I changed the Access Mode: to SPI Flash Programing.Then I started to change the rest of the information


Wildcard Week

After selecting all options I loaded the BIN file generated by the iCEcube2


Wildcard Week

The file located in the Project Directory saved by the iCEcube2 which is Not_gate_ICE40 >> Not_gate_ICE40_Implmnt >> sbt >> outputs >> bitmap >> NOT_GATE_bitmap.bin file


Wildcard Week

After selecting the setup is finishes then I clicked the Down Green arrow Icon above to download the program to the ICEStick Board


Wildcard Week

The Programing started it Red the chip then will Erase,Flash,Then verify


Wildcard Week

Done! I got Success message .(I also got error on first try but changing the USB PORT of My PC worked! without any error.Refer this )


Wildcard Week

I prepared a push button on a bread board and wired like in the above figure.See the video below to for the results!


Servo Sweep Experiment


Wildcard Week

I found a Servo sweep program which was done in a FPGA from vhdlwhiz.com.It was written in vhdl Language I wasn't familiar with VHDL.so I gave it a try




Simulation using Mentor ModelSim

Lattice Also providing it's own version of Simulation software Called Mentor ModelSim.So I tried out the software for simulating the Not gate.We get Digital wave OUT PUT as simulation results


Wildcard Week

In order to simulate I created another program in vs code with a different file in the same directory



        module NOT_GATE_SIMULATE; 
            reg A;
            wire Y;
            
        module NOT_GATE a1(.a(A),.y(Y)); // calling the NOT_GATE program here

            initial Begin-NOT
          
          A=1'b0; // Input set to 0
        #1        //1 pico Second time delay
          A=1'b1  //Input set to 1


            end
            
        endmodule

so the above code is made for the simulation only not for programing the FPGA. I made diffrent module called 'NOT_GATE_SIMULATE' then I added an input 'reg A' then wired output to 'wire Y' next I called the 'NOT_GATE' module I build in the previous program in to this program and passed the input and output variables


Wildcard Week

Then I opened the Mentor ModelSim Lattice FPGA edition software .which already installed along with iCEcube2


Wildcard Week

Then I opened a new project by clicking File >> New >> Project


Wildcard Week

I given a name to the project and stored into same directory which I created for the Not gate Project


Wildcard Week

After clicking OK now I have to provide the files so, I clicked on "Add existing File" button because I already the program


Wildcard Week

Then I selected browsed and selected both file and opened to this ModelSim software


Wildcard Week

You can see both files available on tab.Unlike ICECube2 software ModelSim supports It's own Editor to write code and save them .by right clicking the mouse on the file will allows to get the text editor to edit file


Wildcard Week

Then I compiled the files by clicking Compile >> Compile all option from the above tab


Wildcard Week

Compilation was successful and got verified tik marks for the files .After that I clicked on Simulate >> Start simulation option for starting the simulation


Wildcard Week

In the Opened window I selected the Simulation code file only which is shown under the work directory


Wildcard Week

Then I used the terminal command for opening the wave out put window

view wave

Wildcard Week

The wave window opened.By typing the add wave command load the wave file from the compiled directory

add wave *

Wildcard Week

Then Runs the simulation for 2 Pico second by timing run 2ps code in the command line.I programed each signal delay for 1 pico second .so I have two inputs 1 and 0 total for 2 pico second

run 2ps

Wildcard Week

we can see on the figure that the wave window got something on the screen I have to zoom to see that because it was only for 2 pico second


Wildcard Week

This is the wave form Expected for the NOT Gate program and also I got the same results in the simulation


Wildcard Week

we can also wrote the both code in the same file which also works .this type experiments are the one that I learned during my Diploma.we were using a different software. but I didn't find interesting to do this kind of simulation.but it necessary to study the OUTPUTS

Icestudio the Open Visual editor for FPGA


Wildcard Week

Icestudio is a revolutionary Open Visual Editor software builds for open FPGA boards.Which is completely open source like arduino and available to download for all the platforms


 Networking&interfacing
From icestudio.io

The Components like Logic gates,counters...etc.. are available in the Icestudio,That we can just drag and drop and can br connect just using mouse also each blocks editable as in Verilog language

I downloaded the Icestudio for windows from the icestudio.io and installed in my PC.It's supports all the open source FPGA hardwares like Tiny FPGA boards ,Lattice ICEStick and etc...


Wildcard Week

After Installation complete software asks which board that I'm using.The ICEStick Evaluation Kit also listed along with all supported Open FPGA boards


Wildcard Week

Then It shows notification banner says Toolchain not installed.so by clicking the banner it started to install the tool chain from the internetS


Wildcard Week

It takes some time.All features in this software is very simple with super optimized UI


Wildcard Week

Then it says to setup the driver for the board.by clicking on that also shows a mini 4 step guide to navigate the driver installation process


Wildcard Week

So I plugged the lattice ICEStick Evaluation Board to my pc and clicked 'OK' to continue


Wildcard Week

It detected the Board and recommended a new version of the driver automatically.I already have A driver in PC because I installed the lattice Dimond Programer first to try out


Wildcard Week

closed the tab after driver installation then unplugged and re-plugged the ICEStick board as per the Instructions


Wildcard Week

SO examples provided by Icestudio by default to Explore.The whole menu options are just like the arduino IDE


Wildcard Week

on right top options we can get some blocks which includes inputs,outputs,Logic gates,Flipflops and etc.. to make our own designs


Wildcard Week

This the NOT gate project in Icestudio which I created similar to the previous ICECube2 NOT gate Project.It is very simple to do project on Icestudio only thing is we have to wire from output to inputs

Each block on the pictures are very relatable. first one is an Input block for the button and next one is the pull-up enable block.Then a NOT gate block and finaly a output block fo the LED.All the pin configuration are just dropdown-select methods.all are named by default According to the board


Wildcard Week

Like I said all the options are just like the arduino IDE very simple to verify and upload the programs


Wildcard Week

I mentioned that unlike the microcontrollers FPGA can do Multitasking at the same time.So,I did this running LED and a button toggle program for experimentation


on the video you can see I'm toggling the green led using a button at the same time the RED LEDs are running with out any delay or problems

Back to Top Back to top