0

I've taken a project using verilog. We have two 4-bits number, a multiplexer(S0,S1) and four module(adder,substractor,and,xor). Output is 4 bit. I think it seems simple alu. I have written a verilog code that contains all of them as modules. I have assigned pins to DE0 board. As you can see, the output can be seen on leds. There is no problem about that. But, how the output can be displayed on Seven Segment Display instead of LEDs? However, the result should be hexadecimal instead of binary. I have also pins about seven segment display, so I think I will implement them like the leds. I'm new about verilog. It will be my first program.

  • If S is 0 (00), adder result will be seen on LEDs.
  • If S is 1 (01), subtraction result will be seen on LEDs.
  • If S is 2 (10), AND operation result will be seen on LEDs.
  • If S is 3 (11), XOR operation result will be seen on LEDs.

enter image description here

enter image description here

1 Answers1

1

A seven segment display is really just 7 LEDs in a figure 8 pattern (with a 8th LED for the decimal point). As such, you need only drive the pin attached to that segment of the display LOW to light up the segment (See the handbook on the DE0, Section 4.3, for the pins attached to the seven segment display: ftp://ftp.altera.com/up/pub/Altera_Material/Boards/DE0/DE0_User_Manual.pdf ). Now, this means you have control over each segment but just driving your 4 bit number into the display wont product something you can easily read. For this, youre going to need a converter from your 4bit value into a 7bit values representing the pattern to light the seven segment up (Ie, if your output is 4'b0001, you want your seven segment to display a 1, so you need to convert the 4'b0001 into a 7bit value that will result in a 1 being displayed). I think this is a worthy design challenge for you to take on as you learn Verilog, so I will not provide code for a 4-bit to seven segment display module. But if you run into any issues creating your own; feel free to comment to this answer and we can try and help. Or make a new question if its a big issue.

Unn
  • 4,775
  • 18
  • 30
  • firstly thanks. I've just obtain 4-bit to seven segment list http://justpaste.it/o6kj so what can I do now? –  Oct 07 '15 at 19:33
  • Now you need to create a Verilog module that will preform the conversion – Unn Oct 07 '15 at 19:54
  • how can I make? It is not simple. Would you mind describing? –  Oct 07 '15 at 20:14
  • Im a little confused how you were able to do the rest of the project as you described it without working at at a bit with Verilog. If you are still having trouble, there are tons of tutorials online for getting started with Verilog; these will give you the basics of how to write your own modules. – Unn Oct 07 '15 at 20:33