SlideShare a Scribd company logo
1 of 6
Download to read offline
Information Classification: General
Chapter 1
Fundamentals of digital system design
Figure 1.0.1: A simple ASIC digital system design flow.
1.1 MATLAB, Scilab, Octave tools and basic syntax
Hallo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Peaks detection module: finds max and these indexs of a given signal "x"
% INPUT: x: signal in a one-dimensional array
% OUTPUT: Maxs: max peak indexs and max peak values
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function peaks = myPeaksDetector(x)
leng = length(x);
dx = [];
Information Classification: General
peaks = [];
for j = 2 : leng -1
dx(j) = x(j) - x(j-1);
dx(j+1) = x(j+1) - x(j);
if(dx(j) == 0 || (dx(j) >= 0 && dx(j+1) < 0))
peaks = [peaks; j, x(j)];
end
end
end
Table 1.2.1: Basic format of a MATLAB program.
Figure 1.1.1: MATLAB environment development.
1.2 Verilog HDL and basic syntax
Verilog language is parallel, each always block is executed at the same time, while C
language is executed in sequence. Verilog is also hardware description language; when
programming with Verilog, it is better to describe a circuit with Verilog, while C is a program.
module a(b, c, d,...z); // module header a: module name (b,c,d,...z): port list
input b; // Input declaration
input wire c; // Enter and declare wire for wire network type, wire can be omitted
input wire [7:0] d; // [7:0]: input bus bit width 0 ~ 7, so it is 8 bit bus
output e; // Output declaration
output [7:0] f; // Description of the output bus bit width, the default is wire type,
wire is omitted here
output reg [7:0] f; // reg for output bus register type
assign d = a & b; // The assignment statement is also called the data flow modeling
statement or the continuous assignment statement, followed by the combination logic
assign e = (f < g)? 1 : 0; // ternary operator
//always statement, posedge is triggered by rising edge, nagedge is triggered by falling edge, followed
by a signal that when the signal rises or falls, the following program is executed
Information Classification: General
always @ (posedge a or negedge b or posedge c...)
begin // begin...end is equivalent to ()
if(!b) begin
h <= 4'b0000; // The nonblocking assignment statement uses < =, 4'b0000 to indicate
that the bit width is 4, and the binary number 0000
i <= 32'haabbccdd; // Here is the 32-bit width, and the hexadecimal number aabbccdd
end
else // else for branch
case(j) // case statement
0 : k <= k + 1'b1; // There is no self-adding representation in Verilog, so k = k + 1'b1
1 : if(k<m) begin
l <= 8'd7;
j <= 2;
end // j < = 2 indicates next clock jumps to 2: statement after triggering
2 : m < = 4'b0001 << 2; //< shift symbol
default: j <=0; // default means to go when the value of j is not 0,1,2 listed above
endcase // case multi branch statement end flag
end // End of the entire always loop flag
endmodule // End of whole module
Table 1.2.1: Basic format of a Verilog program.
Figure 1.2.1: FSM Moore model.
// module declaration
module xxx
# (parameter p1= 16, p2= 4)
(
input [] iii,
output [] ooo
);
// Internals
reg [] _present, _next;
//---------------1) State registers: --------------
always@ (posedge clk or negedge rst_n)
begin
if(~rst_n) begin
_present <= 0;
end
else begin
_present <= FFF(_next);
end
end
end
//---------------2) Next state logic: --------------
always@ (*)
begin
_next = FFF (_present, iii);
end
Information Classification: General
//-------------- 3) Output logics: --------------
assign ooo = FFF (_present); // with Moore model
assign ooo = FFF (_present, iii); // with Mealy model
endmodule
Table 1.2.2: Basic format of a Verilog program as FSM Moore model.
1.3 Quartus Prime lite edition tool
Figure 1.3.1: Quartus Prime lite environment development.
1.4 ModelSim INTEL FPGA STARTER EDITION 10.5b
Information Classification: General
Figure 1.4.1: ModelSim development environment.
1.5 An introduction of MATLAB HDL
Information Classification: General
Figure 1.5.1: Quartus Prime lite environment development.

More Related Content

What's hot

Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in cniyamathShariff
 
Esg111 midterm review
Esg111 midterm reviewEsg111 midterm review
Esg111 midterm reviewmickeynickey1
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C ProgrammingKamal Acharya
 
12. Exception Handling
12. Exception Handling 12. Exception Handling
12. Exception Handling Intro C# Book
 
Oracle pl sql
Oracle pl sqlOracle pl sql
Oracle pl sqlDurga Rao
 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test BenchDr.YNM
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4Rumman Ansari
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manualkamesh dagia
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014Béo Tú
 
Print Star pattern in java and print triangle of stars in java
Print Star pattern in java and print triangle of stars in javaPrint Star pattern in java and print triangle of stars in java
Print Star pattern in java and print triangle of stars in javaHiraniahmad
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in CMuthuganesh S
 
18CSS101J PROGRAMMING FOR PROBLEM SOLVING
18CSS101J PROGRAMMING FOR PROBLEM SOLVING18CSS101J PROGRAMMING FOR PROBLEM SOLVING
18CSS101J PROGRAMMING FOR PROBLEM SOLVINGGOWSIKRAJAP
 

What's hot (20)

Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
 
Esg111 midterm review
Esg111 midterm reviewEsg111 midterm review
Esg111 midterm review
 
Input Output Management In C Programming
Input Output Management In C ProgrammingInput Output Management In C Programming
Input Output Management In C Programming
 
Plsql programs
Plsql programsPlsql programs
Plsql programs
 
12. Exception Handling
12. Exception Handling 12. Exception Handling
12. Exception Handling
 
Oracle pl sql
Oracle pl sqlOracle pl sql
Oracle pl sql
 
Introduction to Input/Output Functions in C
Introduction to Input/Output Functions in CIntroduction to Input/Output Functions in C
Introduction to Input/Output Functions in C
 
Verilog Test Bench
Verilog Test BenchVerilog Test Bench
Verilog Test Bench
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual
 
Bluespec @waseda
Bluespec @wasedaBluespec @waseda
Bluespec @waseda
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
C programming part2
C programming part2C programming part2
C programming part2
 
Print Star pattern in java and print triangle of stars in java
Print Star pattern in java and print triangle of stars in javaPrint Star pattern in java and print triangle of stars in java
Print Star pattern in java and print triangle of stars in java
 
Tu1
Tu1Tu1
Tu1
 
Arduino
ArduinoArduino
Arduino
 
Input output statement in C
Input output statement in CInput output statement in C
Input output statement in C
 
Unit 3
Unit 3 Unit 3
Unit 3
 
18CSS101J PROGRAMMING FOR PROBLEM SOLVING
18CSS101J PROGRAMMING FOR PROBLEM SOLVING18CSS101J PROGRAMMING FOR PROBLEM SOLVING
18CSS101J PROGRAMMING FOR PROBLEM SOLVING
 

Similar to 0.my book draft chap 1

Similar to 0.my book draft chap 1 (20)

Verilog hdl
Verilog hdlVerilog hdl
Verilog hdl
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
vlsi design using verilog presentaion 1
vlsi design using verilog   presentaion 1vlsi design using verilog   presentaion 1
vlsi design using verilog presentaion 1
 
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
 
Analog to Digital Converter
Analog to Digital ConverterAnalog to Digital Converter
Analog to Digital Converter
 
Arduino introduction
Arduino introductionArduino introduction
Arduino introduction
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Embedded systemsproject_2020
Embedded systemsproject_2020Embedded systemsproject_2020
Embedded systemsproject_2020
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Presentation
PresentationPresentation
Presentation
 
LCD_Example.pptx
LCD_Example.pptxLCD_Example.pptx
LCD_Example.pptx
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 

Recently uploaded

BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024AHOhOops1
 
Russian Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...
Russian  Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...Russian  Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...
Russian Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...shivangimorya083
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证jjrehjwj11gg
 
Independent Andheri Call Girls 9833363713
Independent Andheri Call Girls 9833363713Independent Andheri Call Girls 9833363713
Independent Andheri Call Girls 9833363713Komal Khan
 
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kasba 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Roomdivyansh0kumar0
 
Digamma / CertiCon Company Presentation
Digamma / CertiCon Company  PresentationDigamma / CertiCon Company  Presentation
Digamma / CertiCon Company PresentationMihajloManjak
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607dollysharma2066
 
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂Hot Call Girls In Sector 58 (Noida)
 
VDA 6.3 Process Approach in Automotive Industries
VDA 6.3 Process Approach in Automotive IndustriesVDA 6.3 Process Approach in Automotive Industries
VDA 6.3 Process Approach in Automotive IndustriesKannanDN
 
2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid
2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid
2024 WRC Hyundai World Rally Team’s i20 N Rally1 HybridHyundai Motor Group
 
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一F La
 
UNIT-1-VEHICLE STRUCTURE AND ENGINES.ppt
UNIT-1-VEHICLE STRUCTURE AND ENGINES.pptUNIT-1-VEHICLE STRUCTURE AND ENGINES.ppt
UNIT-1-VEHICLE STRUCTURE AND ENGINES.pptDineshKumar4165
 
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一ypfy7p5ld
 
办理埃默里大学毕业证Emory毕业证原版一比一
办理埃默里大学毕业证Emory毕业证原版一比一办理埃默里大学毕业证Emory毕业证原版一比一
办理埃默里大学毕业证Emory毕业证原版一比一mkfnjj
 
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一fjjwgk
 
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full Night
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full NightCall Girls Vastrapur 7397865700 Ridhima Hire Me Full Night
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaFULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaMalviyaNagarCallGirl
 
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一fhhkjh
 

Recently uploaded (20)

BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024BLUE VEHICLES the kids picture show 2024
BLUE VEHICLES the kids picture show 2024
 
Russian Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...
Russian  Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...Russian  Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...
Russian Call Girls Delhi Indirapuram {9711199171} Aarvi Gupta ✌️Independent ...
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
 
Independent Andheri Call Girls 9833363713
Independent Andheri Call Girls 9833363713Independent Andheri Call Girls 9833363713
Independent Andheri Call Girls 9833363713
 
Call Girls In Kirti Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kirti Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Kirti Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kirti Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Hot Sexy call girls in Pira Garhi🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Pira Garhi🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Pira Garhi🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Pira Garhi🔝 9953056974 🔝 escort Service
 
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kasba 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kasba 👉 8250192130 Available With Room
 
Digamma / CertiCon Company Presentation
Digamma / CertiCon Company  PresentationDigamma / CertiCon Company  Presentation
Digamma / CertiCon Company Presentation
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
 
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
 
VDA 6.3 Process Approach in Automotive Industries
VDA 6.3 Process Approach in Automotive IndustriesVDA 6.3 Process Approach in Automotive Industries
VDA 6.3 Process Approach in Automotive Industries
 
2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid
2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid
2024 WRC Hyundai World Rally Team’s i20 N Rally1 Hybrid
 
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
 
UNIT-1-VEHICLE STRUCTURE AND ENGINES.ppt
UNIT-1-VEHICLE STRUCTURE AND ENGINES.pptUNIT-1-VEHICLE STRUCTURE AND ENGINES.ppt
UNIT-1-VEHICLE STRUCTURE AND ENGINES.ppt
 
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
如何办理(Flinders毕业证)查理斯特大学毕业证毕业证成绩单原版一比一
 
办理埃默里大学毕业证Emory毕业证原版一比一
办理埃默里大学毕业证Emory毕业证原版一比一办理埃默里大学毕业证Emory毕业证原版一比一
办理埃默里大学毕业证Emory毕业证原版一比一
 
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一
如何办理(UC毕业证书)堪培拉大学毕业证毕业证成绩单原版一比一
 
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full Night
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full NightCall Girls Vastrapur 7397865700 Ridhima Hire Me Full Night
Call Girls Vastrapur 7397865700 Ridhima Hire Me Full Night
 
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | NoidaFULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
FULL ENJOY - 9953040155 Call Girls in Sector 61 | Noida
 
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
 

0.my book draft chap 1

  • 1. Information Classification: General Chapter 1 Fundamentals of digital system design Figure 1.0.1: A simple ASIC digital system design flow. 1.1 MATLAB, Scilab, Octave tools and basic syntax Hallo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Peaks detection module: finds max and these indexs of a given signal "x" % INPUT: x: signal in a one-dimensional array % OUTPUT: Maxs: max peak indexs and max peak values %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function peaks = myPeaksDetector(x) leng = length(x); dx = [];
  • 2. Information Classification: General peaks = []; for j = 2 : leng -1 dx(j) = x(j) - x(j-1); dx(j+1) = x(j+1) - x(j); if(dx(j) == 0 || (dx(j) >= 0 && dx(j+1) < 0)) peaks = [peaks; j, x(j)]; end end end Table 1.2.1: Basic format of a MATLAB program. Figure 1.1.1: MATLAB environment development. 1.2 Verilog HDL and basic syntax Verilog language is parallel, each always block is executed at the same time, while C language is executed in sequence. Verilog is also hardware description language; when programming with Verilog, it is better to describe a circuit with Verilog, while C is a program. module a(b, c, d,...z); // module header a: module name (b,c,d,...z): port list input b; // Input declaration input wire c; // Enter and declare wire for wire network type, wire can be omitted input wire [7:0] d; // [7:0]: input bus bit width 0 ~ 7, so it is 8 bit bus output e; // Output declaration output [7:0] f; // Description of the output bus bit width, the default is wire type, wire is omitted here output reg [7:0] f; // reg for output bus register type assign d = a & b; // The assignment statement is also called the data flow modeling statement or the continuous assignment statement, followed by the combination logic assign e = (f < g)? 1 : 0; // ternary operator //always statement, posedge is triggered by rising edge, nagedge is triggered by falling edge, followed by a signal that when the signal rises or falls, the following program is executed
  • 3. Information Classification: General always @ (posedge a or negedge b or posedge c...) begin // begin...end is equivalent to () if(!b) begin h <= 4'b0000; // The nonblocking assignment statement uses < =, 4'b0000 to indicate that the bit width is 4, and the binary number 0000 i <= 32'haabbccdd; // Here is the 32-bit width, and the hexadecimal number aabbccdd end else // else for branch case(j) // case statement 0 : k <= k + 1'b1; // There is no self-adding representation in Verilog, so k = k + 1'b1 1 : if(k<m) begin l <= 8'd7; j <= 2; end // j < = 2 indicates next clock jumps to 2: statement after triggering 2 : m < = 4'b0001 << 2; //< shift symbol default: j <=0; // default means to go when the value of j is not 0,1,2 listed above endcase // case multi branch statement end flag end // End of the entire always loop flag endmodule // End of whole module Table 1.2.1: Basic format of a Verilog program. Figure 1.2.1: FSM Moore model. // module declaration module xxx # (parameter p1= 16, p2= 4) ( input [] iii, output [] ooo ); // Internals reg [] _present, _next; //---------------1) State registers: -------------- always@ (posedge clk or negedge rst_n) begin if(~rst_n) begin _present <= 0; end else begin _present <= FFF(_next); end end end //---------------2) Next state logic: -------------- always@ (*) begin _next = FFF (_present, iii); end
  • 4. Information Classification: General //-------------- 3) Output logics: -------------- assign ooo = FFF (_present); // with Moore model assign ooo = FFF (_present, iii); // with Mealy model endmodule Table 1.2.2: Basic format of a Verilog program as FSM Moore model. 1.3 Quartus Prime lite edition tool Figure 1.3.1: Quartus Prime lite environment development. 1.4 ModelSim INTEL FPGA STARTER EDITION 10.5b
  • 5. Information Classification: General Figure 1.4.1: ModelSim development environment. 1.5 An introduction of MATLAB HDL
  • 6. Information Classification: General Figure 1.5.1: Quartus Prime lite environment development.