Till KTH:s startsida Till KTH:s startsida

Ändringar mellan två versioner

Här visas ändringar i "VHDL-program with Quartus (en)" mellan 2014-11-03 12:52 av William Sandqvist och 2014-11-04 16:31 av William Sandqvist.

Visa < föregående | nästa > ändring.

VHDL-program with Quartus (en)

en VHDL-program with Quartus

[IMAGE] QuartusTutor_eng.pdf

quartussoftware.gif

Välj rätChoose the right program version - i skolan finns flera olika installerade underfrom the school's start menyn!u :

Altera 13.0.1.232 Web edition\ Quartus II Web Edition 13.0.1.232\ Quartus II 13.0sp1 (32bit)

dontbuyx.gif

Starta Quartus. Du behöver ingen licens och inte heller köpa något. Blir Du inte direkt erbjuden attYou need no license and you do not need not buy anything. If not be directly offered to starta New Project Wizard, så kan Du även välja det alternativet frånYou may also select this option from the File- menynu.

newprojectwizard.gif

Introduction KClicka på on Next.

newprojwizard.gif

Project Name and Directory

I skolan måste hela projektet ligga i en mapp på ditt

In school, the entire project must be on your
H:\, texeg. H:\MAXwork (hemma på dittat home on C:\, texeg. C:\MAXwork)Name: codelockTop-Level Entity: codelock(OBSNote! the namnete codelock måuste "matcha" detthe namn Du senare anger some you later on specify as entity i dinn your VHDL-file)

Gå vidare med

Proceed with
Next.

newprojwizard1.gif

Add files ViWe har inga filer att lägga tillve no files to add to the projektect, så vi går vidare medo we proceed with Next.

addfiles.gif

Family and Device Settings Här anger vi vilket chip vi tänker använda under laborationenere we specify which chip we intend to use during the lab.

Family: MAX3000A Available devices: EPM3032ALC44-10

Gå vidare medProceed with Next.

devicesettings.gif

EDA tools setting Här kan man skapa sammanhang med programverktyg från andra leverantörer. Vi kommer att simulera med programmet ModelSim men det behöver vi inte ange. Gå vidare med Next.¶ edasetting.gif¶ Summary, sammanfattning. Här ser Du en sammanfattning av dina val, avslutaere you can create context with software tools from other vendors. We will simulate with the ModelSim program but that we need not enter. Proceed with Next.¶

edasetting.gif¶

Summary. Here you can see a summary of your selections, exit the
"Wizard" medwith Finish.

newprojwisardsummary.gif

PThe projektect har skapatss been created quartuscodelockproject.gif

VHDL-kcoden newvhdlfile.gif

Skapa enCreate a blank file föor VHDL-kcoden. File, New, VHDL File.

KCopiera Mall-programmet lockmall.vhd och klistra in dey the Template lockmall.vhd and paste it in Quartus text editor.

library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; entity codelock is port( clk: in std_logic; K: in std_logic_vector(1 to 3); R: in std_logic_vector(1 to 4); q: out std_logic_vector(4 downto 0); UNLOCK: out std_logic ); end codelock; architecture behavior of codelock is subtype state_type is integer range 0 to 31; signal state, nextstate: state_type; begin nextstate_decoder: -- next state decoding part process(state, K, R) begin case state is when 0 => if (K = "001" and R ="0001") then nextstate <= 1; else nextstate <= 0; end if; when 1 => if (K = "001" and R = "0001") then nextstate <= 1; elsif (K = "000" and R = "0000") then nextstate <= 2; else nextstate <= 0; end if; when 2 to 30 => nextstate <= state + 1; when 31 => nextstate <= 0; end case; end process; debug_output: -- display the state q <= conv_std_logic_vector(state,5); output_decoder: -- output decoder part process(state) begin case state is when 0 to 1 => UNLOCK <= '0'; when 2 to 31 => UNLOCK <= '1'; end case; end process; state_register: -- the state register part (the flipflops) process(clk) begin if rising_edge(clk) then state <= nextstate; end if; end process; end behavior; vhdlfile lockmall.vhd ( text.gif lockmall.txt)

vhdlsaveas.gif

Observera atNote that entity in the VHDL-filen ska matcha must "match" the projektetsct Top Level Entity!

Spara filen medave the file: File, Save As och somand as VHDL-file. Namnet kan varaThe name could be codelock.vhd (eller annator another). Add File to current project skhall vara förbockatbe checked!

Analysis and Synthesis

analysesynthesisicon.gif

analysesynthesis.gif

När man har nyskriven kod är det onödigt att köra hela verktygskedjan, risken är stor att det kan finnas felaktigheter längs vägen.¶ Från början kör man baraWhen you have new code, it is unnecessary to run the entire tool chain - chances are that there are errors along the way ...¶

From the start you only do
Analysis & Synthesis.

analysesynthesisok.gif

Start Compilation

startcompilation.gif

startcompilation.gif

Start Compilation kör hela verktygskedjaruns the full tool chain.

compilationsuccess.gif

Varningarna handlar om "verktyg" som saknas i våThe 3 warnings (moore with other program version men som vi inte behöver. ( Antales) are about "software tools" that varningar kan variera lite mede missing in our program version, detta är ingen anledning till oro ). but we don’t need them.¶