Design a divide-by-3 sequential circuit with 50% duty circle?



Design a divide-by-3 sequential circuit with 50% duty circle?..

Answer / vikas lakhanpal

Hi guys,
This is code u r looking for.I have made it generic
based.Give any Odd value in the genric.u will get same
divide by clock.if u need ckt u can make it easily frm
it.Is not guys?
---------
------------------------------------------------------------
-----------
--Designer Vikas Lakhanpal;vikas_lakhanpal27@yahoo.com
--Module description : This modules is dividing the
incoming clock by ODD value as assigned in genric
CLK_DIV_BY generic with

50% duty cycle
------------------------------------------------------------
-----------


library IEEE;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_unsigned.all;

entity FDIV is

generic(
CLK_DIV_BY : INTEGER :=15; --Give the
odd value with which you want to divide the clock i.e.
3,5,7,9
COUNTVALUE : INTEGER :=4 --Give the bit
count of division ratio value.Ex upto 3= 2 bits; 5 to 7 =
3; 9 to 15 = 4 and so on..
);

port(
CLK : in std_logic;
CLR : in std_logic;
DIV: out std_logic
);
end FDIV;
--------------------------------------------------
Architecture beh of FDIV is
signal DIV_pos, DIV_neg :std_logic;
signal posedgecounter :std_logic_vector((COUNTVALUE - 1)
downto 0);
signal negedgecounter,test :std_logic_vector((COUNTVALUE -
1) downto 0);
begin
-----------------------------
PROCESS(CLK,CLR)
begin
IF ( CLR = '0') THEN
posedgecounter <= (others =>'0');
ELSIF RISING_EDGE(CLK) THEN
posedgecounter <= posedgecounter + 1;
if posedgecounter = conv_std_logic_vector((CLK_DIV_BY -
1),(COUNTVALUE)) then
posedgecounter <= (others =>'0');
end if;
if posedgecounter <= conv_std_logic_vector(((CLK_DIV_BY -
1)/2),(COUNTVALUE)) then
DIV_pos <= '1';
else
DIV_pos <= '0';
end if;
END IF;
END PROCESS;
------------------------------
PROCESS(CLK,CLR)
begin
IF ( CLR = '0') THEN
negedgecounter <= (others =>'0');
ELSIF FALLING_EDGE(CLK) THEN
negedgecounter <= negedgecounter + 1;
if negedgecounter = conv_std_logic_vector((CLK_DIV_BY -
1),(COUNTVALUE)) then
negedgecounter <= (others =>'0');
end if;
if negedgecounter <= conv_std_logic_vector
(((CLK_DIV_BY -1)/2),(COUNTVALUE)) then
DIV_neg <= '1';
else
DIV_neg <= '0';
end if;
END IF;
END PROCESS;
----------------------------------------
DIV<= DIV_pos and DIV_neg;
----------------------------------------
end beh;

Is This Answer Correct ?    3 Yes 10 No

Post New Answer

More 86 Family Interview Questions

What is PSW?

11 Answers   DRDO,


Explain the different modes of operations of the 8086?

0 Answers  


what type of registers contains an (INTEL) CPU?

2 Answers  


How subroutine can be called from the main program and how the program returns from the subroutine?

0 Answers  


What is a program counter? What is its use?

9 Answers  






Name 5 different addressing modes?

0 Answers  


what are the types of conditional jumps

0 Answers  


load a mul a store t1 load b mul b store t2 mul t2 add t1 then the content in accumulator is

2 Answers   Wipro,


How to control and timing circuitry of the 8085.

0 Answers  


What is the role of segment register?

5 Answers  


What is the stack segment used for?

0 Answers  


What are the different addressing modes in 8085?

25 Answers   Rambala Exports, Syntel,


Categories