Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

tracking the rising_edge of 2 clocks

Status
Not open for further replies.

p11

Banned
Joined
Jan 25, 2014
Messages
177
Helped
0
Reputation
0
Reaction score
0
Trophy points
16
Activity points
0
can you plz help me in getting an idea about how to track the rising_edge of two different clocks having differebt time period.i mean i need to make a signal high when the rising_edge of both the clocks come together .

Code:
process (clk,clks)

if (rising_edge (clk)) and rising_edge (clks)) then 

 pout <= 1;
else 
pout <= '0';


this code is ok, for testbench waveform , but when synthesis is done the following error is shown.
FATAL_ERROR:HDLSynthesis:portability/export/Port_Main.h:127:1.17 - This application has discovered an exceptional condition from which it cannot recover. Process will terminate. For more information on this error, please consult the Answers Database or open a WebCase with this project attached at https://www.xilinx.com/support.

i know implementation is not possible as fpga has only 1 clock, but right now i just want synthesis to be done correctly...
 

This is impossible, and unless you align the clock correctly, will not work in simulation either.

Checking 2 clocks like this is impossible.
 

This is impossible, and unless you align the clock correctly, will not work in simulation either.

Checking 2 clocks like this is impossible.



allign the clock correctly means?

Code:
process (clk,clks)
begin 

if (rising_edge (clk)and(rising_edge (clks) )) then 

counter1 <= "0000001";
else 
counter1 <= "0000000"; 
end if ;

end process;



packetouts(6 downto 0) <= counter1;


testbenchh:




Code:
--------------------------------------------------------------------------------
-- Company: 
-- Engineer:
--
-- Create Date:   00:32:10 11/07/2016
-- Design Name:   rom
-- Module Name:   C:/payel/vhdltestbench.vhd
-- Project Name:  payel
-- Target Device:  
-- Tool versions:  
-- Description:   
-- 
-- VHDL Test Bench Created by ISE for module: rom
--
-- Dependencies:
-- 
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes: 
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends 
-- that these types always be used for the top-level I/O of a design in order 
-- to guarantee that the testbench will bind correctly to the post-implementation 
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;

ENTITY vhdltestbench_vhd IS
END vhdltestbench_vhd;

ARCHITECTURE behavior OF vhdltestbench_vhd IS 

	-- Component Declaration for the Unit Under Test (UUT)
	COMPONENT rom
	PORT(
		clk : IN std_logic;
		clks : IN std_logic;
		reset : IN std_logic;          
		firstout : OUT integer;
		dout : OUT std_logic_vector(21 downto 0);
		yout : OUT std_logic_vector(8 downto 0);
		youts : OUT std_logic_vector(8 downto 0);
		packetoutput : OUT std_logic_vector(21 downto 0)
		);
	END COMPONENT;

	--Inputs
	SIGNAL clk :  std_logic := '0';
	SIGNAL clks :  std_logic := '0';
	SIGNAL reset :  std_logic := '1';

	--Outputs
	SIGNAL firstout :  integer;
	SIGNAL dout :  std_logic_vector(21 downto 0);
	SIGNAL yout :  std_logic_vector(8 downto 0);
	SIGNAL youts :  std_logic_vector(8 downto 0);
	SIGNAL packetoutput :  std_logic_vector(21 downto 0);

BEGIN

	-- Instantiate the Unit Under Test (UUT)
	uut: rom PORT MAP(
		clk => clk,
		clks => clks,
		firstout => firstout,
		dout => dout,
		reset => reset,
		yout => yout,
		youts => youts,
		packetoutput => packetoutput
	);

	

	tb : PROCESS
	BEGIN
clk <= '0';
	
	
wait for 1 ns;
clk <= '1';

wait for 1 ns;

reset <= '0';
	END PROCESS;
	
	
	
	
	process
	
	begin
	
	clks <= '0'; 
wait for 2 ns;
clks <= '1'; 
wait for 1 ns;


	
	END PROCESS;

END;


this works ok, if i see waveform, but while synthesizing it is showing..........line 476: Signal counter1 cannot be synthesized, bad synchronous description. just explain me the error , because i think only this mistakes can help in learning vhdl.
 

You are ignoring that VHDL stands for VHSIC Hardware Description Language.

Code:
process (clk,clks)
begin 
  if ([COLOR="#FF0000"][B][I]rising_edge (clk)and(rising_edge (clks) )[/I][/B][/COLOR]) then 
    counter1 <= "0000001";
  else 
    counter1 <= "0000000"; 
  end if ;
end process;
packetouts(6 downto 0) <= counter1;
The statement in bold red italicized text does not exist in any FPGA device in existence. You have described a flip-flop that has two clock inputs, which no FPGA has (and probably no ASIC library).

Therefore no synthesis tool will work on this code no matter how much you want it to. A synthesis tools task is to map HDL to library cells and THERE ARE NO CELLS THAT EXIST IN ANY FPGA LIBRARY THAT THE SYNTHESIS TOOL CAN MAP YOUR LOGIC TO. Are you listening!? (refer to my definition of VHDL above)

p11 said:
just explain me the error , because i think only this mistakes can help in learning vhdl.
Just trying random stuff and finding errors isn't the way to learn VHDL. READ A VHDL BOOK and GO TO PAID VHDL TRAINING CLASSES to learn VHDL for synthesis and for simulation. Your method of learning has proven time and time again (by your posts) to not work.
 

even if there was such thing like a dual-clocked flop, what use would you make of it? I can't even imagine why.
 

even if there was such thing like a dual-clocked flop, what use would you make of it? I can't even imagine why.
As a training exercise to learn how to write unsynthesizable VHDL programs that will never work in hardware, but can allow you to claim VHDL expert programmer on your resume.

This makes perfect sense given the quality of recent grads I've had to waste my time interviewing over the last half decade or so.
 

Hi,

when the rising_edge of both the clocks come together .
What difference in time do you allow?

Two edges can not be exactely the same.
Maybe they have difference in time of 1us, maybe 1ns, maybe 1ps, maybe less

Klaus
 

Maybe they have difference in time of 1us, maybe 1ns, maybe 1ps, maybe less

Paraphrasing, a clock edge has ideally no duration, so for practical viewpoint, a trigger made with simultaneous different clock sources should never be allowed by any compiler.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top