smiley_09
Newbie level 4
- Joined
- Jan 26, 2015
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 54
how to solve metastability by writing a verilog code in post synthesis simulation?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
how to solve metastability by writing a verilog code in post synthesis simulation?
process(iClk)
begin
if rising_edge(iCLk)then
sD <=iD;--removing metastability
oQ1 <='0';
oQ2 <='0';
if(sD='1') then
--if(iD='1') then--unregistered version
oQ1 <='1';
else
oQ2 <='1';
end if;
end if;--Clk Rising
end process;
In some cases, like one bit data, a simple registering may be helpful.
in the example code below, iD is registered then used in if statement.
in unregistered version, the if statement may work incorrect,
in the unregistered version of iD, both of oQ1 and oQ2 may be Set.
Code:process(iClk) begin if rising_edge(iCLk)then sD <=iD;--removing metastability oQ1 <='0'; oQ2 <='0'; if(sD='1') then --if(iD='1') then--unregistered version oQ1 <='1'; else oQ2 <='1'; end if; end if;--Clk Rising end process;
reg sD;
always @(posedge iClk)
sD <=iD;
oQ1 <= 1b'0';
oQ2 <= 1b'0';
if (sD)
oQ1 <= 1b'1';
else
oQ2 <= 1b'1';
how to solve metastability by writing a verilog code in post synthesis simulation?