From the course: Learning Verilog for FPGA Development
Unlock the full course today
Join today to access over 24,000 courses taught by industry experts.
Arithmetic and logic operators - FPGA Tutorial
From the course: Learning Verilog for FPGA Development
Arithmetic and logic operators
- [Instructor] I've been telling you that Verilog resembles c and operators are not an exception to this. Suppose we have three register variables, a, b and c, which are 32 bits long each. Let's start with the usual arithmetic operators. In Verilog, you can perform arithmetic. Addition with the plus operator, subtraction with minus, multiplication with asterisk, integer division or quotient with a slash, and division remainder, or modulo, with the percentage character. Verilog implements the same logical operators of c. These are the operators you would use between boolean expressions in the condition of an "if" statement. These are "and" with a double "and" percent, or, with a double vertical bar, and not with an exclamation sign. The same goes for bitwise logic operators. For the same registers, a, b and c, you can perform a bitwise "and" operation, with the "and" percent operator, or, with the vertical bar, XOR with…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Arithmetic and logic operators2m 59s
-
(Locked)
Challenge: Make a 4-bit arithmetic logic unit (ALU)1m 54s
-
(Locked)
Solution: Make a 4-bit arithmetic logic unit (ALU)2m 36s
-
(Locked)
Getting your ALU on a field-programmable gate array (FPGA)4m 26s
-
(Locked)
A functional demo of the ALU1m 44s
-
(Locked)
-
-