I need help with coding...
I'm making a digital watch code.
There is no problem with the code itself, but as I input things like BUTTON_SW and BUS_SW, I didn't have enough buttons in my kit to run the hour, minute, second, and mode conversion…
So I want to allocate BUTTON_SW to work as much as the DIP button in the kit is turned on. But that code failed.
Could you please help me?
<code>
always @ (negedge RESETN or posedge CLK_100HZ) begin
if (~RESETN)
DIP = 1'b0;
else begin
if (DIP < 17)
if (DIP == 4'b0000)
DIP = BUTTON_SW[0];
else if (DIP == 4'b0001)
DIP = BUTTON_SW[1];
else if (DIP == 4'b0010)
DIP = BUTTON_SW[2];
else if (DIP == 4'b0011)
DIP = BUTTON_SW[3];
else if (DIP == 4'b0100)
DIP = BUTTON_SW[4];
else if (DIP == 4'b0101)
DIP = BUTTON_SW[5];
else if (DIP == 4'b0110)
DIP = BUTTON_SW[6];
else if (DIP == 4'b0111)
DIP = BUTTON_SW[7];
else if (DIP == 4'b1000)
DIP = BUTTON_SW[8];
else if (DIP == 4'b1001)
DIP = BUTTON_SW[9];
else if (DIP == 4'b1010)
DIP = BUTTON_SW[10];
else if (DIP == 4'b1011)
DIP = BUTTON_SW[11];
else if (DIP == 4'b1100)
DIP = BUTTON_SW[12];
else if (DIP == 4'b1101)
DIP = BUTTON_SW[13];
else if (DIP == 4'b1110)
DIP = BUTTON_SW[14];
else if (DIP == 4'b1111)
DIP = BUTTON_SW[15];
end
end