Solve VHDL Synthesis Questions: Learn to Write & Synthesize Code

  • Thread starter Thread starter Tracy_sysu
  • Start date Start date
  • Tags Tags
    Synthesis
AI Thread Summary
The discussion centers on synthesizing VHDL code and troubleshooting errors encountered during the process. Key issues include the requirement for a sensitivity list in processes, as well as the need for registers to hold values consistently outside of clock edges. A specific error arises in the provided code for process S5, where the count signal is updated on both the rising edge of the clock and in an else condition, leading to synthesis errors. Participants emphasize that registers should only be updated on a single clock edge to avoid conflicting behavior. The conversation highlights the importance of understanding VHDL synthesis rules to ensure correct code functionality.
Tracy_sysu
Messages
3
Reaction score
0
Hello, everyone!Now I'm studying VHDL, and our teacher gave us some questions as follows:
1. Complete the following code fragment and try to synthesize the VHDL:
process begin
wait until Clk = '1';
Phase <= "0" after 0 ns; Phase <= "1" after 10 ns;
end process;
What is the error message? Synthesize this code, and explain the results:
process begin
wait until Clk_x_2 = '1';
case (Phase) is
when '0' => Phase <= '1'; when others => Phase <= '0';
end case;
end process;

2.Consider the following processes:
S1: process (clk) begin
if clk'EVENT and clk = '1' then count <= count + inc; end if;
end process;
S2: process (clk) begin
if rst = '1' then count <= 0;
elsif clk'EVENT and clk = '1' then count <= count + inc;
end if;
end process;
S3: process (clk, rst) begin
if rst = '1' then count <= 0; elsif clk'EVENT and clk = '1' then
count <= count + inc; sum <= count + sum;
end if;
end process;
S4: process (clk) begin
if clk'EVENT and clk = '1' then if rst = '1' then count <= 0;
else count <= count + inc; end if;
end if;
end process;
S5: process (clk, rst) begin
if rst = '1' then count <= 0;
elsif clk'EVENT and clk = '1' then count <= count + inc;
else count <= count + 1;
end if;
end process;
S6: process (clk, rst) begin
if rst = '1' then count <= 0;
elsif clk'EVENT and clk = '1' then count <= count + inc;
end if; inc <= not dec;
end process;
Write code to drive each of these processes and simulate them. Explain any errors or problems you encounter. Try to synthesize your code and check that the results behave correctly and match the simulation results. Explain any differences in behavior or any problems you encounter.

For these two questions, I have n o idea about them, is there anyone could help me?
 
Engineering news on Phys.org
1) A process without a sensitivity list is useless. If you don't know what the sensitivity list does...well...the way I think of it is: if there is a change on the variables in the sensitivity list, the process will execute. example:

Process(A)
begin
X <= B and A;
end process;

that means that if B changes at any time...nothing will happen..if X changes at any time nothing will happen...but if A changes...X gets updated (the process executes)
 
Thanks for your help
I have finished part of them,but I met one problem when I write VHDL to test code s5
Here is my code and the error message( I used Quartus II version 7.0 to synthesis):
 for s5
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity cnt4 is
Port (clk : in std_logic;
rst: in std_logic;
inc: in std_logic_vector(3 downto 0);
count: buffer std_logic_vector(3 downto 0));
end entity cnt4;

architecture Behavioral of cnt4 is
begin process (clk, rst)
begin
if rst = '1' then
count <= "0000";
elsif clk'EVENT and clk = '1' then
count <= count + inc;
else
count <= count + "0001";
end if;
end process;
end Behavioral;

The error message is
Error (10818): Netlist error at cnt4.vhd(15): can't infer register for count[0] because it does not hold its value outside the clock edge
Error (10818): Netlist error at cnt4.vhd(15): can't infer register for count[1] because it does not hold its value outside the clock edge
Error (10818): Netlist error at cnt4.vhd(15): can't infer register for count[2] because it does not hold its value outside the clock edge
Error (10818): Netlist error at cnt4.vhd(15): can't infer register for count[3] because it does not hold its value outside the clock edge
Error (10822): HDL error at cnt4.vhd(17): couldn't implement registers for assignments on this clock edge

I want to know what's the problem?It seems to me everything is all right :(
 
I'm no expert here, that's for sure. but from my experience, many devices can't support dual clocking styles. But in theory VHDL can do a lot of things that a particular device can't do. I think the problem with this code is that you're trying to update a register (buffer in this case) on both a rising clock edge AND else (basically a falling clock edge). With most devices it's either one or the other, but not both in a single process.
 
A register can be sensitive for only 1 edge of the clock signal.But in that code we deal with both rising edge and declining edge(or others),i think that is the problem.^_^
 
Thanks for all of your help and your patient and kindness! I don't know how to express that,Thank you!
 
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Back
Top