Course: Introduction to Hardware Language (HDL) Topic: while Statement verilog (BCD While if) Create a verilog program for the following condition: if w3=0, display down counter if w3=1, display up...



Course: Introduction to Hardware Language (HDL)



Topic: while Statement verilog (BCD While if)



Create a verilog program for the following condition:



  • if w3=0, display down counter

  • if w3=1, display up counter

  • Please refer to the output of the program together with the source code


  • Note: Please use the Source Code that I provided to be able to determine the same result.


C:\iverilog\bin>vvp digit_while3<br>time<br>w3w2w1w0 Y<br>0000<br>0111<br>1<br>0001<br>0110<br>2<br>3<br>0010<br>0101<br>0011<br>0100<br>4<br>5<br>0100<br>0011<br>0101<br>0010<br>0110<br>0001<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>0111<br>0000<br>1000<br>0001<br>1001<br>0010<br>1010<br>0011<br>1011<br>0100<br>1100<br>0101<br>1101<br>0110<br>14<br>1110<br>0111<br>15<br>1111<br>1000<br>

Extracted text: C:\iverilog\bin>vvp digit_while3 time w3w2w1w0 Y 0000 0111 1 0001 0110 2 3 0010 0101 0011 0100 4 5 0100 0011 0101 0010 0110 0001 7 8 9 10 11 12 13 0111 0000 1000 0001 1001 0010 1010 0011 1011 0100 1100 0101 1101 0110 14 1110 0111 15 1111 1000
module whilel (y,w3,w2,wl,w0);<br>input [3:0]w3,w2,w1,w0;<br>output [3:0]y;<br>4<br>5<br>7<br>reg [3:0]y;<br>reg [3:0]k;<br>8.<br>10<br>11<br>always e (w)<br>Ebegin<br>13<br>if<br>(w[2]==1'b0)<br>14<br>y=4'b0000;<br>15<br>else<br>begin<br>y=0;|<br>16<br>17<br>18<br>k=0;<br>19<br>while (k<w)<br>20<br>begin<br>у %3D у +1;<br>k + 1;<br>21<br>22<br>k<br>23<br>end<br>24<br>end<br>25<br>end<br>26<br>endmodule<br>27<br>28<br>module TestBench;<br>29<br>reg [2:0]w;<br>wire [3:0]y;<br>30<br>31<br>initial begin<br>$display (

Extracted text: module whilel (y,w3,w2,wl,w0); input [3:0]w3,w2,w1,w0; output [3:0]y; 4 5 7 reg [3:0]y; reg [3:0]k; 8. 10 11 always e (w) Ebegin 13 if (w[2]==1'b0) 14 y=4'b0000; 15 else begin y=0;| 16 17 18 k=0; 19 while (k

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here