|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
先付状态机代码:
`timescale 1ns/1ps
module FSM_test
(
input wire last,
input wire f_begin,
input wire clk,
input wire rst,
output reg [7:0] data
);
reg [3:0] stute;
reg [3:0] next_stute;
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
stute <= 'd1;
end
else
begin
stute <= next_stute;
end
end
always @ (*)
begin
if(rst)
begin
next_stute <= 'd1;
end
else
begin
case (stute)
'd1 : begin
if(f_begin)
next_stute <= 'd2;
end
'd2 : begin
next_stute <= 'd4;
end
'd4 : begin
next_stute <= 'd8;
end
'd8 : begin
next_stute <= 'd2;
if (last)
next_stute <= 'd1;
end
default : begin
next_stute <= 'd1;
end
endcase
end
end
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
data <= 'd0;
end
else
begin
case (stute)
'd1 : begin
if(f_begin)
data <= 'd2;
end
'd2 : begin
data <= 'd4;
end
'd4 : begin
data <= 'd8;
end
'd8 : begin
data <= data+1;
end
default : begin
data <= 'd0;
end
endcase
end
end
endmodule
为什么xst不把这段代码当成FSM处理?综合时,next_stute 变了生成了不推荐的锁存器。我百思不得其解,不知道是不是代码中存在一些不妥的地方,请指点!多谢!
付xst报告,大家可以拿去综合下,V7的片子。
Release 14.1 - xst P.15xf (nt)
Copyright (c) 1995-2012 Xilinx, Inc. All rights reserved.
--> Parameter TMPDIR set to xst/projnav.tmp
Total REAL time to Xst completion: 1.00 secs
Total CPU time to Xst completion: 0.80 secs
--> Parameter xsthdpdir set to xst
Total REAL time to Xst completion: 1.00 secs
Total CPU time to Xst completion: 0.80 secs
--> Reading design: FSM_test.prj
TABLE OF CONTENTS
1) Synthesis Options Summary
2) HDL Parsing
3) HDL Elaboration
4) HDL Synthesis
4.1) HDL Synthesis Report
5) Advanced HDL Synthesis
5.1) Advanced HDL Synthesis Report
6) Low Level Synthesis
7) Partition Report
8) Design Summary
8.1) Primitive and Black Box Usage
8.2) Device utilization summary
8.3) Partition Resource Summary
8.4) Timing Report
8.4.1) Clock Information
8.4.2) Asynchronous Control Signals Information
8.4.3) Timing Summary
8.4.4) Timing Details
8.4.5) Cross Clock Domains Report
=========================================================================
* Synthesis Options Summary *
=========================================================================
---- Source Parameters
Input File Name : "FSM_test.prj"
Ignore Synthesis Constraint File : NO
---- Target Parameters
Output File Name : "FSM_test"
Output Format : NGC
Target Device : xc7vx485t-2-ffg1761
---- Source Options
Top Module Name : FSM_test
Automatic FSM Extraction : YES
FSM Encoding Algorithm : Auto
Safe Implementation : No
FSM Style : LUT
RAM Extraction : Yes
RAM Style : Auto
ROM Extraction : Yes
Shift Register Extraction : YES
ROM Style : Auto
Resource Sharing : YES
Asynchronous To Synchronous : NO
Shift Register Minimum Size : 2
Use DSP Block : Auto
Automatic Register Balancing : No
---- Target Options
LUT Combining : Auto
Reduce Control Sets : Auto
Add IO Buffers : YES
Global Maximum Fanout : 100000
Add Generic Clock Buffer(BUFG) : 32
Register Duplication : YES
Optimize Instantiated Primitives : NO
Use Clock Enable : Auto
Use Synchronous Set : Auto
Use Synchronous Reset : Auto
Pack IO Registers into IOBs : Auto
Equivalent register Removal : YES
---- General Options
Optimization Goal : Speed
Optimization Effort : 1
Power Reduction : NO
Keep Hierarchy : No
Netlist Hierarchy : As_Optimized
RTL Output : Yes
Global Optimization : AllClockNets
Read Cores : YES
Write Timing Constraints : NO
Cross Clock Analysis : NO
Hierarchy Separator : /
Bus Delimiter : <>
Case Specifier : Maintain
Slice Utilization Ratio : 100
BRAM Utilization Ratio : 100
DSP48 Utilization Ratio : 100
Auto BRAM Packing : NO
Slice Utilization Ratio Delta : 5
=========================================================================
=========================================================================
* HDL Parsing *
=========================================================================
Analyzing Verilog file "D:/verlog/FSM_test/FSM_tst.v" into library work
Parsing module .
=========================================================================
* HDL Elaboration *
=========================================================================
Elaborating module .
WARNING:HDLCompiler:413 - "D:/verlog/FSM_test/FSM_tst.v" Line 78: Result of 9-bit expression is truncated to fit in 8-bit target.
=========================================================================
* HDL Synthesis *
=========================================================================
Synthesizing Unit .
Related source file is "D:/verlog/FSM_test/FSM_tst.v".
Found 8-bit register for signal .
Found 4-bit register for signal .
Found 8-bit adder for signal created at line 78.
WARNING:Xst:737 - Found 1-bit latch for signal <next_stute>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <next_stute>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <next_stute>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <next_stute>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
Summary:
inferred 1 Adder/Subtractor(s).
inferred 12 D-type flip-flop(s).
inferred 4 Latch(s).
inferred 2 Multiplexer(s).
Unit synthesized.
=========================================================================
HDL Synthesis Report
Macro Statistics
# Adders/Subtractors : 1
8-bit adder : 1
# Registers : 2
4-bit register : 1
8-bit register : 1
# Latches : 4
1-bit latch : 4
# Multiplexers : 2
1-bit 2-to-1 multiplexer : 1
8-bit 2-to-1 multiplexer : 1
=========================================================================
=========================================================================
* Advanced HDL Synthesis *
=========================================================================
=========================================================================
Advanced HDL Synthesis Report
Macro Statistics
# Adders/Subtractors : 1
8-bit adder : 1
# Registers : 12
Flip-Flops : 12
# Multiplexers : 2
1-bit 2-to-1 multiplexer : 1
8-bit 2-to-1 multiplexer : 1
=========================================================================
=========================================================================
* Low Level Synthesis *
=========================================================================
Optimizing unit ...
Mapping all equations...
Building and optimizing final netlist ...
Found area constraint ratio of 100 (+ 5) on block FSM_test, actual ratio is 0.
Final Macro Processing ...
=========================================================================
Final Register Report
Macro Statistics
# Registers : 12
Flip-Flops : 12
=========================================================================
=========================================================================
* Partition Report *
=========================================================================
Partition Implementation Status
-------------------------------
No Partitions were found in this design.
-------------------------------
=========================================================================
* Design Summary *
=========================================================================
Top Level Output File Name : FSM_test.ngc
Primitive and Black Box Usage:
------------------------------
# BELS : 25
# LUT3 : 2
# LUT4 : 5
# LUT5 : 7
# LUT6 : 8
# MUXF7 : 3
# FlipFlops/Latches : 16
# FDC : 11
# FDP : 1
# LDC : 3
# LDP : 1
# Clock Buffers : 1
# BUFGP : 1
# IO Buffers : 11
# IBUF : 3
# OBUF : 8
Device utilization summary:
---------------------------
Selected Device : 7vx485tffg1761-2
Slice Logic Utilization:
Number of Slice Registers: 16 out of 607200 0%
Number of Slice LUTs: 22 out of 303600 0%
Number used as Logic: 22 out of 303600 0%
Slice Logic Distribution:
Number of LUT Flip Flop pairs used: 25
Number with an unused Flip Flop: 9 out of 25 36%
Number with an unused LUT: 3 out of 25 12%
Number of fully used LUT-FF pairs: 13 out of 25 52%
Number of unique control sets: 2
IO Utilization:
Number of IOs: 12
Number of bonded IOBs: 12 out of 700 1%
Specific Feature Utilization:
Number of BUFG/BUFGCTRLs: 1 out of 32 3%
---------------------------
Partition Resource Summary:
---------------------------
No Partitions were found in this design.
---------------------------
=========================================================================
Timing Report
NOTE: THESE TIMING NUMBERS ARE ONLY A SYNTHESIS ESTIMATE.
FOR ACCURATE TIMING INFORMATION PLEASE REFER TO THE TRACE REPORT
GENERATED AFTER PLACE-and-ROUTE.
Clock Information:
------------------
-----------------------------------+------------------------+-------+
Clock Signal | Clock buffer(FF name) | Load |
-----------------------------------+------------------------+-------+
clk | BUFGP | 12 |
_n0032(Mmux__n003211:O) | NONE(*)(next_stute_3) | 4 |
-----------------------------------+------------------------+-------+
(*) This 1 clock signal(s) are generated by combinatorial logic,
and XST is not able to identify which are the primary clock signals.
Please use the CLOCK_SIGNAL constraint to specify the clock signal(s) generated by combinatorial logic.
INFO:Xst:2169 - HDL ADVISOR - Some clock signals were not automatically buffered by XST with BUFG/BUFR resources. Please use the buffer_type constraint in order to insert these buffers to the clock signals to help prevent skew problems.
Asynchronous Control Signals Information:
----------------------------------------
No asynchronous control signals found in this design
Timing Summary:
---------------
Speed Grade: -2
Minimum period: 1.511ns (Maximum Frequency: 662.011MHz)
Minimum input arrival time before clock: 0.754ns
Maximum output required time after clock: 0.632ns
Maximum combinational path delay: No path found
Timing Details:
---------------
All values displayed in nanoseconds (ns)
=========================================================================
Timing constraint: Default period analysis for Clock 'clk'
Clock period: 1.511ns (frequency: 662.011MHz)
Total number of paths / destination ports: 97 / 8
-------------------------------------------------------------------------
Delay: 1.511ns (Levels of Logic = 2)
Source: stute_0 (FF)
Destination: data_6 (FF)
Source Clock: clk rising
Destination Clock: clk rising
Data Path: stute_0 to data_6
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- ------------
FDP:C->Q 14 0.254 0.620 stute_0 (stute_0)
LUT4:I0->O 4 0.049 0.534 stute[3]_data[7]_select_21_OUT<5>21 (stute[3]_data[7]_select_21_OUT<5>2)
LUT6:I3->O 1 0.049 0.000 stute[3]_data[7]_select_21_OUT<1>1 (stute[3]_data[7]_select_21_OUT<7>)
FDC 0.004 data_7
----------------------------------------
Total 1.511ns (0.356ns logic, 1.155ns route)
(23.6% logic, 76.4% route)
=========================================================================
Timing constraint: Default OFFSET IN BEFORE for Clock 'clk'
Total number of paths / destination ports: 21 / 20
-------------------------------------------------------------------------
Offset: 0.754ns (Levels of Logic = 2)
Source: f_begin (PAD)
Destination: data_4 (FF)
Destination Clock: clk rising
Data Path: f_begin to data_4
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- ------------
IBUF:I->O 10 0.000 0.701 f_begin_IBUF (f_begin_IBUF)
LUT6:I0->O 1 0.049 0.000 stute[3]_data[7]_select_21_OUT<1>1 (stute[3]_data[7]_select_21_OUT<7>)
FDC 0.004 data_7
----------------------------------------
Total 0.754ns (0.053ns logic, 0.701ns route)
(7.0% logic, 93.0% route)
=========================================================================
Timing constraint: Default OFFSET IN BEFORE for Clock '_n0032'
Total number of paths / destination ports: 6 / 6
-------------------------------------------------------------------------
Offset: 0.707ns (Levels of Logic = 1)
Source: rst (PAD)
Destination: next_stute_3 (LATCH)
Destination Clock: _n0032 falling
Data Path: rst to next_stute_3
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- ------------
IBUF:I->O 16 0.000 0.422 rst_IBUF (rst_IBUF)
LDC:CLR 0.285 next_stute_3
----------------------------------------
Total 0.707ns (0.285ns logic, 0.422ns route)
(40.3% logic, 59.7% route)
=========================================================================
Timing constraint: Default OFFSET OUT AFTER for Clock 'clk'
Total number of paths / destination ports: 8 / 8
-------------------------------------------------------------------------
Offset: 0.632ns (Levels of Logic = 1)
Source: data_1 (FF)
Destination: data<1> (PAD)
Source Clock: clk rising
Data Path: data_1 to data<1>
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- ------------
FDC:C->Q 8 0.254 0.378 data_1 (data_1)
OBUF:I->O 0.000 data_1_OBUF (data<1>)
----------------------------------------
Total 0.632ns (0.254ns logic, 0.378ns route)
(40.2% logic, 59.8% route)
=========================================================================
Cross Clock Domains Report:
--------------------------
Clock to Setup on destination clock _n0032
---------------+---------+---------+---------+---------+
| Src:Rise| Src:Fall| Src:Rise| Src:Fall|
Source Clock |Dest:Rise|Dest:Rise|Dest:Fall|Dest:Fall|
---------------+---------+---------+---------+---------+
clk | | | 1.015| |
---------------+---------+---------+---------+---------+
Clock to Setup on destination clock clk
---------------+---------+---------+---------+---------+
| Src:Rise| Src:Fall| Src:Rise| Src:Fall|
Source Clock |Dest:Rise|Dest:Rise|Dest:Fall|Dest:Fall|
---------------+---------+---------+---------+---------+
_n0032 | | 0.698| | |
clk | 1.511| | | |
---------------+---------+---------+---------+---------+
=========================================================================
Total REAL time to Xst completion: 14.00 secs
Total CPU time to Xst completion: 13.67 secs
-->
Total memory usage is 316800 kilobytes
Number of errors : 0 ( 0 filtered)
Number of warnings : 5 ( 0 filtered)
Number of infos : 1 ( 0 filtered)
</next_stute</next_stute</next_stute</next_stute |
|