

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Using Verilog to Implement Functions For a complex design, it is best to implement well-defined subcircuits and design your circuit by calling these subcircuits. To use a sucircuit in a design, you need to know what it does, and what inputs and outputs it has. You don’t really need to know the logic which is used to implement the package. A seven-segment LED is an array of seven LEDs which can be used to display numbers. A seven- segrment LED decoder has four inputs and seven outputs –for an input between 0x0 and 0xF, the outputs will tell which of the segments should be lit to display that number. If you were designing a circuit which used 3 of these decoders, it would be tedious to write this code three times. You could instead use a code that has a subcircuit in a Verilog file: a f b g e c d a f b g e c d a f b g e c d
You could also use a function in the Verilog file. Here is a Verilog program which uses a function to implement a design to display a 12-bit binary number on a ser of three seven-segrment LEDs: You could have Quartus II create your function prototype for you. Open the file Altera_Func_Verilog1.v (File – Open), then create an include file for the decoder (File – Create | Update – Create AHDL Include Files for Current File). You could also use your decoder in a graphics design file. Open the file Altera_Func_Verilog,v (File – Open), then create a symbol for the decoder (File – Create Default Symbol). This will make the file Altera_Func_Verilog.sym which you can then place in a graphics design file. His is the display as a graphics design file: