Yesterday, I borrowed a book from someone and the book had a companion CD. Out of curiosity, I checked out the CD's contents and also read the introduction pages of the book. The book said the CD contained Verilog HDL files for some of the examples in the book with the software Verilogger Pro, Waveform Viewer, etc.
The files had 'v' extension which I wasn't able to open even after installing the Verilogger Pro. But I was successful in opening the file with the Notepad. The code below had the contents of one of the files.
After little searching on the net I came to know that Verilog is hardware description language (HDL) and Verilogger Pro is a simulator. Does it mean that if a write a certain code then the simulator can tell me how that code will be implemented like which component you will need etc.? Is HDL primarily used for digital logic?
How do I open that 'v' extension file?
Please help me with the queries above. Thank you very much.
No. The simulator simulates your code. You need to know what function your code implements, and you have to create a "testbench" which provides the necessary stimulus and records results.
I have MultiSim and Circuit Wizard programs. They both let you use gates in electric circuits. But I don't think they do what I describe below. Do they?
I want a program in which I can drag-and-drop the gates etc. and then simply describe the inputs to see what the output should be.
For example, suppose I have created the following circuit after dragging-and-dropping the NAND gates, then I state what the inputs would be to A, B, and C, and then the program tells me the output at Q.
I don't use Multisim or Circuit Wizard. In the past, most digital circuit simulators had a way to enter symbols for conversion to VHDL or verilog for simulation. I've never used those features though.
No, reading "live" input from console is not supported. However you can read input from a file.
Some simulators let you click in the input waveform, some require you to write a file that generates the stimulus for the circuit.
Yes I am pretty sure. Verilog is geared towards running a simulation that is already prepared, along with all the checks and asserts so that you only run it and wait for the final result. Then if you are trying to track a bug you can look at the waveforms, but all that is done with already made inputs.
I nevere used verilogger, so i can't really help you with the second question. Try right clicking the signal if there are some options.
As for the first one, since A, B and Y are buses with many bits, the program is showing them with two lines - this signifies that they are buses and their value is written there. If a single bit signal changes, then you see an edge like with the Sel signal.
When a bus changes state you need to show it somehow, and you can't show a single edge since that would not be true, there could be an edge going up or down on any of the bits, so you show it like a data block with value F has changed into a block with value A, and that double crossing shows where all those edges would be.
Suppose now I want to make a 4x1 multiplexer using three 2x1 multiplexer. I have the code written for 2x1 multiplexer in a file. How can I instantiate 2x1 multiplexers in a new file without copying the original code of 2x1 previously written? Please help me with it. Thanks.
Just like you instantiated the single mutliplexer in that testbench, but you need to use dunnowhatitscalled type of instantiation where you assign each wire of the mux to a specific wire in your upper module. like this:
This is what I was trying to do. I created a new project file titled four_to_one_mux. I have added the code file containing the code for 2x1 multiplexer to this project. Then, I created a new code file in the project titled four_one, and in this file I need to instantiate three 2x1 multiplexers using my previously written code. Am I going a right thing so far?
Actually I had already written few lines before I saw post #17 above but those lines didn't compile.
Code:
//4 to 1 mux using 2 to 1 muxs
two_to_1_mux mux1(Y1,A,B,SEL0,En);
two_to_1_mux mux2(Y2,C,D,SEL0,En);
two_to_1_mux mux3(Y3,Y1,Y2,SEL1,En);
Yes, that tutorial website is really good. I have been using it for some time now. Thanks.
I don't think you need to use include directive, you just need to have the other files within the same project.
Yes that should be right. It seems I messed up the order of the instantiation, the correct is the way you have it - the instantiated module goes first and then the name of this instance.
It is better to use the explicit connections like .Y(Y1) because late when you change something in your code and mess up the order it will keep working and not break up, just because the order of the parameters changed.
Post your code, along with the errors you get.