Solve VHDL Synthesis Questions: Learn to Write & Synthesize Code

  • Thread starter Tracy_sysu
  • Start date
  • Tags
    Synthesis
In summary, the code tries to update a register on both rising and falling clock edges, but the device the code is running on can't support dual clocking styles. This causes an error.
  • #1
Tracy_sysu
3
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
  • #2
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)
 
  • #3
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 :(
 
  • #4
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.
 
  • #5
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.^_^
 
  • #6
Thanks for all of your help and your patient and kindness! I don't know how to express that,Thank you!
 

1. What is VHDL synthesis and why is it important?

VHDL synthesis is the process of translating a hardware description written in VHDL (VHSIC Hardware Description Language) into a physical circuit. It is important because it allows for the creation of complex digital systems using a high-level language, making it easier and more efficient to design and debug circuits.

2. What are the steps involved in VHDL synthesis?

The steps involved in VHDL synthesis include analysis, elaboration, optimization, and mapping. In the analysis step, the VHDL code is checked for syntax and semantic errors. Elaboration involves building the design hierarchy and connecting all components. Optimization is the process of improving the design by reducing the number of logic elements and improving timing. Mapping involves mapping the design onto specific hardware components such as logic gates and flip-flops.

3. What are the key elements of VHDL that need to be considered for synthesis?

Some key elements of VHDL that need to be considered for synthesis include data types, concurrent statements, sequential statements, and structural elements. Data types define the type of data and operations that can be performed on it. Concurrent statements describe the behavior of the circuit in terms of logical and arithmetic operations. Sequential statements describe the flow of data and control within the circuit. Structural elements are used to instantiate and connect components in the design.

4. How can I write efficient VHDL code for synthesis?

To write efficient VHDL code for synthesis, it is important to understand the hardware implementation of the design and to use the appropriate data types and statements. It is also important to optimize the design by reducing the number of logic elements and improving timing. Following coding guidelines and using good coding practices can also help in writing efficient VHDL code.

5. Are there any tools or software available for VHDL synthesis?

Yes, there are several tools and software available for VHDL synthesis, such as Xilinx Vivado, Altera Quartus, and Mentor Graphics Precision. These tools provide a complete design environment for creating and synthesizing VHDL code, as well as performing simulations and optimizations. Some of these tools also offer debugging and verification features to ensure the accuracy of the synthesized design.

Similar threads

  • Electrical Engineering
Replies
6
Views
4K
  • Electrical Engineering
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
11K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Electrical Engineering
Replies
5
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Back
Top