Question

In: Electrical Engineering

Can someone explain how to manipulate the clock in verilog code? For example, I do not...

Can someone explain how to manipulate the clock in verilog code? For example, I do not understand how to go from 100MHz to 68027Hz.

Solutions

Expert Solution

so for out_clk low "0" period I used the counter named clock_count to count between range (000-2DF)

And

For out_clk high "1" period I used the clock_count to count between range (2DE - 5BE )

Verilog code for clock converter from 100M Hz to 68027 Hz

// Code your design here
module clock_converter(in_clk,out_clk);
  
  
input in_clk;
  
output out_clk;
  
reg [10:0] clock_count=11'b0;
  
  
always @(posedge in_clk)
begin
if(clock_count == 11'b10110111110)// clock_count==5BE
clock_count <= 11'b0;
else
clock_count <= clock_count+1'b1;
  
end
  
assign out_clk = (clock_count<11'b01011011111)?1'b0:1'b1;

  
endmodule
  

//testbench

// Code your testbench here
// or browse Examples
module test ;
  
reg in_clk;
  
wire out_clk;
  
clock_converter dut (in_clk,out_clk);
  
initial
begin
in_clk = 1'b0;
forever #5 in_clk = ~in_clk;
end
  
initial
begin
$dumpfile("dump.vcd");
$dumpvars;
#1000000000000;
$finish;
end
endmodule

// Simulated waveform

Clock_count observation at 1 -> 0 transition

Clock_count observation at 0 - > 1 transition


Related Solutions

Can someone please explain how to calculate this? I truely do not understand how to do...
Can someone please explain how to calculate this? I truely do not understand how to do theoretical yield... calculate theoretical yield and percent yield for anthracene-9-methylmalemide and N-methylmalemide in water amounts used were 0.070 g of anthracene-9-methanol and 50 mL of water and 0.103 g of N-methylmaleimide. the weight of the product was 0.043 g
Can someone please explain how to do the steps for this? I already have part a...
Can someone please explain how to do the steps for this? I already have part a completed but I need help with b-e. Thank you. Problem 1: (a) What is spurious regression? Explain. (b) Assuming , randomly generate 1000 observations of variables X and Y using the following equations: Report the graphs of X and Y. (c) Run the regression: and report the estimated results. (d) What did you expect about the magnitudes and R-square? How are the estimated values...
Write a verilog code for digital clock and display it’s seven segment using fpga?
Write a verilog code for digital clock and display it’s seven segment using fpga?
can someone explain to me a the design of macro in verilog(high level view)?
can someone explain to me a the design of macro in verilog(high level view)?
I am getting 7 errors can someone fix and explain what I did wrong. My code...
I am getting 7 errors can someone fix and explain what I did wrong. My code is at the bottom. Welcome to the DeVry Bank Automated Teller Machine Check balance Make withdrawal Make deposit View account information View statement View bank information Exit          The result of choosing #1 will be the following:           Current balance is: $2439.45     The result of choosing #2 will be the following:           How much would you like to withdraw? $200.50      The...
Can someone please explain the following program to me? I have ran it, but do not...
Can someone please explain the following program to me? I have ran it, but do not understand how the answers are being derived. #include<iostream> using namespace std; int num1 = 1; int quiz(int num) { static int n1 = 10; int n2 = 20; n1--; n2++; num1++; if (num == 1) return num1; else if (num < 3) return n1; else return n2; } // quiz main() { cout << quiz(num1) << endl; cout << quiz(num1) << endl; cout <<...
How is net income overstated or understated determined? Can someone explain with an example please.
How is net income overstated or understated determined? Can someone explain with an example please.
How would I go about making a simple code for an analog clock using matlab?
How would I go about making a simple code for an analog clock using matlab?
in verilog if i have a hex number how do i get a specific 4 bits?...
in verilog if i have a hex number how do i get a specific 4 bits? for exampe if i have a hex number 5055 how do i get the last four bits which would be 0101?
can someone explain curvilinear correlation or use an example to explain curvilinear correlation.
can someone explain curvilinear correlation or use an example to explain curvilinear correlation.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT