Question

In: Electrical Engineering

Create a counter that continuously counts odd numbers backwards (i.e from ‘F’ to ‘0’) and display...

Create a counter that continuously counts odd numbers backwards (i.e from ‘F’ to ‘0’) and display it on 7-sd by using the Verilog code.

On this part, you are required to use the clock from the FPGA board. However, the clock frequency is 100 MHz, and it is too fast to be used (10 ?s). Thus, we need to derive a slower clock with a speed of almost 1 s, which the frequency of it is 1 Hz. This process is called clock division.

MY FPGA is BASYS 3 and program must be written in verilog. Could you please help me? At least write the design code.

If you help me, I will be the happiest person in the world.

Solutions

Expert Solution

use structural modelling.

Clock divider and counter module is given below.

Instantiate these modules in a top.v file (create ur own).

module clock_divider (clk_100MHZ, clk_1HZ);

input clk_100MHZ;

output clk_1HZ;

reg [26 : 0] counter = 27'd0;

reg clkout = 1'b0;

always @(posedge clk_100MHZ)

begin

if (counter == 27'd50000000) // count 50x10e6 and toggle to get 1 HZ

begin

counter <= 27'd0;

clkout <= ~clkout;

end

else

counter <= counter + 1;

end

assign clk_1HZ = clkout;

endmodule

module odd_counter (clk_1HZ, reset, display, binary);

input clk_1HZ, reset;

output reg [6:0] display;

output [3:0] binary;

parameter fifteen = 4'b1111, thirteen = 4'b1101, eleven = 4'b1011, nine = 4'b1001, seven = 4'b0111, five = 4'b0101, three = 4'b0011, one = 4'b0001;

reg [3:0] state = 4'b1111;

reg [3:0] next_state;

always @ (posedge clk_1HZ)

begin

if (reset == 1'b1)

state <= fifteen;

else

state <= next_state;

end

always @ (state)

begin

case (state)

fifteen: begin next_state <= thirteen;

display <= 7'b1000111;

end

thirteen: begin next_state <= eleven;

display <= 7'b0111101;

end

eleven: begin next_state <= nine;

display <= 7'b0011111;

end

nine: begin next_state <= seven;

display <= 7'b1111011;

end

seven: begin next_state <= five;

display <= 7'b1110000;

end

five: begin next_state <= three;

display <= 7'b1011011;

end

three: begin next_state <= one;

display <= 7'b1111000;

end

one: begin next_state <= fifteen;

display <= 7'b0110000;

end

default : next_state <= fifteen;

endcase

end

assign binary = state;

endmodule


Related Solutions

write a verilog code to implement a digital system that has an odd counter that counts...
write a verilog code to implement a digital system that has an odd counter that counts from 1 to 11. Also, this system has an output Y that detects a specific number in the odd counter. Test your code when you detect the number 3, the output Y is 1, if the counter value is set to 3, otherwise 0.
Please, write a loop to print odd numbers an array a with pointers backwards. You can...
Please, write a loop to print odd numbers an array a with pointers backwards. You can use a variable “size” for array size.
Question 3: A)Design a BCD counter. -The circuit counts from 0 to 9, then resets back...
Question 3: A)Design a BCD counter. -The circuit counts from 0 to 9, then resets back to 0 to restart the counting sequence. -The circuit has one input run/stop. If the input is 1, the eounter will count. If the input is 0, the counter will freeze in its current location until the input is set to 1 again. -The circuit has one output. It becomes 1 when the counter completes a cycle and starts the next one. Otherwise, that...
Design a four bit down counter with a 7 segment display (hexadecimal digits 0-F) Part 1:...
Design a four bit down counter with a 7 segment display (hexadecimal digits 0-F) Part 1: Implement a seven segment display for hexadecimal digits (0-F). Recommended to first try implementing the seven segment displays for each of the hexadecimal digits using switches as inputs. Part 2: Implement a four bit down counter. When this component is complete, add the counter and wire the outputs of the JK flip flops to where the switches were once. The last JK flip flop...
Design a decoder counter MOD '10' that counts from 0-9 using 4 flip flops and a...
Design a decoder counter MOD '10' that counts from 0-9 using 4 flip flops and a NAND gate.
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off . 1.by using multisim (explain in details and information of how you do it in multisim) show steps of multisim and which gates numbers you used.
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off by D flip-flop by training borad
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off and write a report about it.
Design a 4 bit Counter that displays even numbers when a switch on, and odd when...
Design a 4 bit Counter that displays even numbers when a switch on, and odd when the switch off and write a report about it.
Python Exercise 2 A program is to display all odd numbers between 10 and 3000. The...
Python Exercise 2 A program is to display all odd numbers between 10 and 3000. The starting value and end value are to be assigned by the programmer, not requested from user.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT