Timing Issues with ZedBoard Audio Codec - audio
I keep getting this error in my FPGA Design:
[Timing 38-282] The design failed to meet the timing requirements. Please see the timing summary report for details on the timing violations.
The goal of this project is to build a a system on a zedboard that has audio input/output in Vivado with an IP integrator. This is from problem 5B in "The Zynq Book Tutorials", and the instructions are summarized below.
Custom IP modules were already created, and are combined with other IP
from the source files to create a DSP system to implement on a Zynq
development board (zedboard in my case). Exercise 5A loaded the custom
IP modules into the system, and in 5B the audio codec on the ZedBoard
was loaded with some pre-packaged IP from the source files. The audio
is transferred between PL and PS through AXI-Lite connection.
The audio codec requires a second fabric clock to drive the codec, and
this is where my trouble begins. It also requires enabling the I2C
interface for communication of control signals between the PS and
codec, but I do not think this was an issue. The .xdc file was created
as a constraint for placement and route (P&R).
I am new to FPGA design, and do not understand clock functions or how to fix them. From my understanding, the problematic clock function stems from the pcore, but I am not sure what to do about this. This project was done in Vivado 2018.3. It should also be noted that all clocks in Vivado are synchronous unless specified otherwise.
Following the tutorial, I set my clock functions for the PL fabric to 100 MHz and 10 MHz. The 10 MHz clock is the driver for the codec.
The timing summary generated in an attempted P&R is:
And the problematic clock looks to be clk_fpga_0:
Here is the diagram where the highlighted block contains the clk_fpga_0 clock, and the device report is pictured below the first picture:
Here is my constraint file (XDC):
# ZedBoard LED Constraints
set_property PACKAGE_PIN T22 [get_ports {LEDs_out_0[0]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[0]}]
set_property PACKAGE_PIN T21 [get_ports {LEDs_out_0[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[1]}]
set_property PACKAGE_PIN U22 [get_ports {LEDs_out_0[2]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[2]}]
set_property PACKAGE_PIN U21 [get_ports {LEDs_out_0[3]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[3]}]
set_property PACKAGE_PIN V22 [get_ports {LEDs_out_0[4]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[4]}]
set_property PACKAGE_PIN W22 [get_ports {LEDs_out_0[5]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[5]}]
set_property PACKAGE_PIN U19 [get_ports {LEDs_out_0[6]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[6]}]
set_property PACKAGE_PIN U14 [get_ports {LEDs_out_0[7]}]
set_property IOSTANDARD LVCMOS33 [get_ports {LEDs_out_0[7]}]
# ZedBoard Audio Codec Constraints
set_property PACKAGE_PIN AA6 [get_ports BCLK_0]
set_property IOSTANDARD LVCMOS33 [get_ports BCLK_0]
set_property PACKAGE_PIN Y6 [get_ports LRCLK_0]
set_property IOSTANDARD LVCMOS33 [get_ports LRCLK_0]
set_property PACKAGE_PIN AA7 [get_ports SDATA_I_0]
set_property IOSTANDARD LVCMOS33 [get_ports SDATA_I_0]
set_property PACKAGE_PIN Y8 [get_ports SDATA_O_0]
set_property IOSTANDARD LVCMOS33 [get_ports SDATA_O_0]
#MCLK
set_property PACKAGE_PIN AB2 [get_ports FCLK_CLK1_0]
set_property IOSTANDARD LVCMOS33 [get_ports FCLK_CLK1_0]
set_property PACKAGE_PIN AB4 [get_ports IIC_0_0_scl_io]
set_property IOSTANDARD LVCMOS33 [get_ports IIC_0_0_scl_io]
set_property PACKAGE_PIN AB5 [get_ports IIC_0_0_sda_io]
set_property IOSTANDARD LVCMOS33 [get_ports IIC_0_0_sda_io]
set_property PACKAGE_PIN AB1 [get_ports {GPIO_0_tri_io[0]}]
set_property IOSTANDARD LVCMOS33 [get_ports {GPIO_0_tri_io[0]}]
set_property PACKAGE_PIN Y5 [get_ports {GPIO_0_tri_io[1]}]
set_property IOSTANDARD LVCMOS33 [get_ports {GPIO_0_tri_io[1]}]
And my wrapper file generated from the HDL wrapper function:
--Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
----------------------------------------------------------------------------------
--Tool Version: Vivado v.2018.3 (win64) Build 2405991 Thu Dec 6 23:38:27 MST 2018
--Date : Thu Dec 10 07:42:56 2020
--Host : LHAAPNTSop running 64-bit major release (build 9200)
--Command : generate_target ip_design_wrapper.bd
--Design : ip_design_wrapper
--Purpose : IP block netlist
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
entity ip_design_wrapper is
port (
BCLK_0 : out STD_LOGIC;
DDR_addr : inout STD_LOGIC_VECTOR ( 14 downto 0 );
DDR_ba : inout STD_LOGIC_VECTOR ( 2 downto 0 );
DDR_cas_n : inout STD_LOGIC;
DDR_ck_n : inout STD_LOGIC;
DDR_ck_p : inout STD_LOGIC;
DDR_cke : inout STD_LOGIC;
DDR_cs_n : inout STD_LOGIC;
DDR_dm : inout STD_LOGIC_VECTOR ( 3 downto 0 );
DDR_dq : inout STD_LOGIC_VECTOR ( 31 downto 0 );
DDR_dqs_n : inout STD_LOGIC_VECTOR ( 3 downto 0 );
DDR_dqs_p : inout STD_LOGIC_VECTOR ( 3 downto 0 );
DDR_odt : inout STD_LOGIC;
DDR_ras_n : inout STD_LOGIC;
DDR_reset_n : inout STD_LOGIC;
DDR_we_n : inout STD_LOGIC;
FCLK_CLK1_0 : out STD_LOGIC;
FIXED_IO_ddr_vrn : inout STD_LOGIC;
FIXED_IO_ddr_vrp : inout STD_LOGIC;
FIXED_IO_mio : inout STD_LOGIC_VECTOR ( 53 downto 0 );
FIXED_IO_ps_clk : inout STD_LOGIC;
FIXED_IO_ps_porb : inout STD_LOGIC;
FIXED_IO_ps_srstb : inout STD_LOGIC;
GPIO_0_tri_io : inout STD_LOGIC_VECTOR ( 1 downto 0 );
IIC_0_0_scl_io : inout STD_LOGIC;
IIC_0_0_sda_io : inout STD_LOGIC;
LEDs_out_0 : out STD_LOGIC_VECTOR ( 7 downto 0 );
LRCLK_0 : out STD_LOGIC;
SDATA_I_0 : in STD_LOGIC;
SDATA_O_0 : out STD_LOGIC;
btns_5bits_tri_i : in STD_LOGIC_VECTOR ( 4 downto 0 );
sws_8bits_tri_i : in STD_LOGIC_VECTOR ( 7 downto 0 )
);
end ip_design_wrapper;
architecture STRUCTURE of ip_design_wrapper is
component ip_design is
port (
DDR_cas_n : inout STD_LOGIC;
DDR_cke : inout STD_LOGIC;
DDR_ck_n : inout STD_LOGIC;
DDR_ck_p : inout STD_LOGIC;
DDR_cs_n : inout STD_LOGIC;
DDR_reset_n : inout STD_LOGIC;
DDR_odt : inout STD_LOGIC;
DDR_ras_n : inout STD_LOGIC;
DDR_we_n : inout STD_LOGIC;
DDR_ba : inout STD_LOGIC_VECTOR ( 2 downto 0 );
DDR_addr : inout STD_LOGIC_VECTOR ( 14 downto 0 );
DDR_dm : inout STD_LOGIC_VECTOR ( 3 downto 0 );
DDR_dq : inout STD_LOGIC_VECTOR ( 31 downto 0 );
DDR_dqs_n : inout STD_LOGIC_VECTOR ( 3 downto 0 );
DDR_dqs_p : inout STD_LOGIC_VECTOR ( 3 downto 0 );
FIXED_IO_mio : inout STD_LOGIC_VECTOR ( 53 downto 0 );
FIXED_IO_ddr_vrn : inout STD_LOGIC;
FIXED_IO_ddr_vrp : inout STD_LOGIC;
FIXED_IO_ps_srstb : inout STD_LOGIC;
FIXED_IO_ps_clk : inout STD_LOGIC;
FIXED_IO_ps_porb : inout STD_LOGIC;
LEDs_out_0 : out STD_LOGIC_VECTOR ( 7 downto 0 );
BCLK_0 : out STD_LOGIC;
LRCLK_0 : out STD_LOGIC;
SDATA_O_0 : out STD_LOGIC;
FCLK_CLK1_0 : out STD_LOGIC;
IIC_0_0_sda_i : in STD_LOGIC;
IIC_0_0_sda_o : out STD_LOGIC;
IIC_0_0_sda_t : out STD_LOGIC;
IIC_0_0_scl_i : in STD_LOGIC;
IIC_0_0_scl_o : out STD_LOGIC;
IIC_0_0_scl_t : out STD_LOGIC;
GPIO_0_tri_i : in STD_LOGIC_VECTOR ( 1 downto 0 );
GPIO_0_tri_o : out STD_LOGIC_VECTOR ( 1 downto 0 );
GPIO_0_tri_t : out STD_LOGIC_VECTOR ( 1 downto 0 );
btns_5bits_tri_i : in STD_LOGIC_VECTOR ( 4 downto 0 );
sws_8bits_tri_i : in STD_LOGIC_VECTOR ( 7 downto 0 );
SDATA_I_0 : in STD_LOGIC
);
end component ip_design;
component IOBUF is
port (
I : in STD_LOGIC;
O : out STD_LOGIC;
T : in STD_LOGIC;
IO : inout STD_LOGIC
);
end component IOBUF;
signal GPIO_0_tri_i_0 : STD_LOGIC_VECTOR ( 0 to 0 );
signal GPIO_0_tri_i_1 : STD_LOGIC_VECTOR ( 1 to 1 );
signal GPIO_0_tri_io_0 : STD_LOGIC_VECTOR ( 0 to 0 );
signal GPIO_0_tri_io_1 : STD_LOGIC_VECTOR ( 1 to 1 );
signal GPIO_0_tri_o_0 : STD_LOGIC_VECTOR ( 0 to 0 );
signal GPIO_0_tri_o_1 : STD_LOGIC_VECTOR ( 1 to 1 );
signal GPIO_0_tri_t_0 : STD_LOGIC_VECTOR ( 0 to 0 );
signal GPIO_0_tri_t_1 : STD_LOGIC_VECTOR ( 1 to 1 );
signal IIC_0_0_scl_i : STD_LOGIC;
signal IIC_0_0_scl_o : STD_LOGIC;
signal IIC_0_0_scl_t : STD_LOGIC;
signal IIC_0_0_sda_i : STD_LOGIC;
signal IIC_0_0_sda_o : STD_LOGIC;
signal IIC_0_0_sda_t : STD_LOGIC;
begin
GPIO_0_tri_iobuf_0: component IOBUF
port map (
I => GPIO_0_tri_o_0(0),
IO => GPIO_0_tri_io(0),
O => GPIO_0_tri_i_0(0),
T => GPIO_0_tri_t_0(0)
);
GPIO_0_tri_iobuf_1: component IOBUF
port map (
I => GPIO_0_tri_o_1(1),
IO => GPIO_0_tri_io(1),
O => GPIO_0_tri_i_1(1),
T => GPIO_0_tri_t_1(1)
);
IIC_0_0_scl_iobuf: component IOBUF
port map (
I => IIC_0_0_scl_o,
IO => IIC_0_0_scl_io,
O => IIC_0_0_scl_i,
T => IIC_0_0_scl_t
);
IIC_0_0_sda_iobuf: component IOBUF
port map (
I => IIC_0_0_sda_o,
IO => IIC_0_0_sda_io,
O => IIC_0_0_sda_i,
T => IIC_0_0_sda_t
);
ip_design_i: component ip_design
port map (
BCLK_0 => BCLK_0,
DDR_addr(14 downto 0) => DDR_addr(14 downto 0),
DDR_ba(2 downto 0) => DDR_ba(2 downto 0),
DDR_cas_n => DDR_cas_n,
DDR_ck_n => DDR_ck_n,
DDR_ck_p => DDR_ck_p,
DDR_cke => DDR_cke,
DDR_cs_n => DDR_cs_n,
DDR_dm(3 downto 0) => DDR_dm(3 downto 0),
DDR_dq(31 downto 0) => DDR_dq(31 downto 0),
DDR_dqs_n(3 downto 0) => DDR_dqs_n(3 downto 0),
DDR_dqs_p(3 downto 0) => DDR_dqs_p(3 downto 0),
DDR_odt => DDR_odt,
DDR_ras_n => DDR_ras_n,
DDR_reset_n => DDR_reset_n,
DDR_we_n => DDR_we_n,
FCLK_CLK1_0 => FCLK_CLK1_0,
FIXED_IO_ddr_vrn => FIXED_IO_ddr_vrn,
FIXED_IO_ddr_vrp => FIXED_IO_ddr_vrp,
FIXED_IO_mio(53 downto 0) => FIXED_IO_mio(53 downto 0),
FIXED_IO_ps_clk => FIXED_IO_ps_clk,
FIXED_IO_ps_porb => FIXED_IO_ps_porb,
FIXED_IO_ps_srstb => FIXED_IO_ps_srstb,
GPIO_0_tri_i(1) => GPIO_0_tri_i_1(1),
GPIO_0_tri_i(0) => GPIO_0_tri_i_0(0),
GPIO_0_tri_o(1) => GPIO_0_tri_o_1(1),
GPIO_0_tri_o(0) => GPIO_0_tri_o_0(0),
GPIO_0_tri_t(1) => GPIO_0_tri_t_1(1),
GPIO_0_tri_t(0) => GPIO_0_tri_t_0(0),
IIC_0_0_scl_i => IIC_0_0_scl_i,
IIC_0_0_scl_o => IIC_0_0_scl_o,
IIC_0_0_scl_t => IIC_0_0_scl_t,
IIC_0_0_sda_i => IIC_0_0_sda_i,
IIC_0_0_sda_o => IIC_0_0_sda_o,
IIC_0_0_sda_t => IIC_0_0_sda_t,
LEDs_out_0(7 downto 0) => LEDs_out_0(7 downto 0),
LRCLK_0 => LRCLK_0,
SDATA_I_0 => SDATA_I_0,
SDATA_O_0 => SDATA_O_0,
btns_5bits_tri_i(4 downto 0) => btns_5bits_tri_i(4 downto 0),
sws_8bits_tri_i(7 downto 0) => sws_8bits_tri_i(7 downto 0)
);
end STRUCTURE;
Related
why the LEDS remain the initial state after programming a flowing-light program while the simulation went no wrong?
I am a FPGA beginner and recently I tried a very simple flowing-light program that went well on my computer. However, the LEDs on my Zybo remain the initial state(only the leftmost LED lights up) no matter how long I wait. I searched for the solution for a week and tried any way I can think of even borrowed another board from my friend, yet the problem just exists. Here's my verilog code top.v module top( input clk, output [3:0] led ); reg [23:0] cnt_reg; reg [3:0] led_reg; initial begin cnt_reg <= 0; led_reg <= 4'b1000; end always #(posedge clk)begin if(cnt_reg == 24'h00000f) begin if(led_reg == 4'b0001) led_reg <= 4'b1000; else led_reg <= led_reg>>1; end else cnt_reg <= cnt_reg + 1; end assign led = led_reg; endmodule Here's my constraint set_property -dict { PACKAGE_PIN M14 IOSTANDARD LVCMOS33 } [get_ports { led[0] }]; #IO_L23P_T3_35 Sch=LED0 set_property -dict { PACKAGE_PIN M15 IOSTANDARD LVCMOS33 } [get_ports { led[1] }]; #IO_L23N_T3_35 Sch=LED1 set_property -dict { PACKAGE_PIN G14 IOSTANDARD LVCMOS33 } [get_ports { led[2] }]; #IO_0_35=Sch=LED2 set_property -dict { PACKAGE_PIN D18 IOSTANDARD LVCMOS33 } [get_ports { led[3] }]; #IO_L3N_T0_DQS_AD1N_35 Sch=LED3 set_property -dict { PACKAGE_PIN L16 IOSTANDARD LVCMOS33 } [get_ports { clk }]; #IO_L11P_T1_SRCC_35 Sch=sysclk Here's my testbench `timescale 1ns/1ps module tb(); reg clk; wire [3:0] led; top U0 (.clk(clk), .led(led)); parameter Period = 10; always begin clk = 1'b0; #(Period/2) clk=1'b1; #(Period/2); end initial begin clk = 1'b0; #1000000; end endmodule And the simulation result shows below: the simulation result After programming my device LEDs just remain the initial state
After programming my device LEDs just remain the initial state Your LEDS do not remain in the init state because all four of them light up. In the init state you have "1000". Which would be one on and three off (or vice versa depending on on how they are connected). What is happening is that you board behave just like your simulation result shows you: every clock cycle the next LED lights up. Your clock is probably around 10MHz or 100MHz so you don't see that. To fix this you need two things: You need to count longer. How big depends on your clock frequency so find out what it is. Fix your counter code. Once the counter value is reached it no longer counts. It stays at 24'h00000F. You waveform does not show that but your code is obvious.
System verilog switch does not change
This code is used to turn a led on if a switch is on. This the top module. module myb( input clk, input execute, input switch, output reg k ); logic [5:0] led; always#(posedge clk) begin if(switch) led[0] = 1; end endmodule This is the constraint set_property PACKAGE_PIN U16 [get_ports {led[0]}] set_property IOSTANDARD LVCMOS33 [get_ports {led[0]}] set_property PACKAGE_PIN E19 [get_ports k] set_property IOSTANDARD LVCMOS33 [get_ports k] set_property PACKAGE_PIN U19 [get_ports {led[2]}] set_property IOSTANDARD LVCMOS33 [get_ports {led[2]}] set_property PACKAGE_PIN V19 [get_ports {led[3]}] set_property IOSTANDARD LVCMOS33 [get_ports {led[3]}] set_property PACKAGE_PIN T18 [get_ports execute] set_property IOSTANDARD LVCMOS33 [get_ports execute] #------------------------------------------------------------ #---------------------- Clock signal ------------------------ #------------------------------------------------------------ set_property PACKAGE_PIN W5 [get_ports clk] set_property IOSTANDARD LVCMOS33 [ get_ports clk] create_clock -period 10.000 -name sys_clk_pin -waveform {0.000 5.000} -add [get_ports clk] set_property PACKAGE_PIN V17 [get_ports {switch] set_property IOSTANDARD LVCMOS33 [get_ports {switch] But somehow, nothing changes. I also tried it with buttons,debouncers etc. What am I doing wrong?
As Serge said: for a signal to come out of an FPGA your top module should have an output port. Did your tool gave you no warning or errors? Because your constraints could not be fulfilled! Secondly I would generate two outputs: one high and one low. This guarantees that at least one of the LEDs will light up. Make sure to thorough check the ports to FPGA pins mapping. It is, apart from coding errors, the most common source of errors when I/O pins don't work. You where very good with getting back to basic code to test your I/O. That is the right way of debugging. You could have gone one more step and omitted the clock as well. Just: assign led = 6'b101010; Then after you get them to work add the clock. Final remark: your output k is unused and undefined.
Basys3 board 4-bit counter, I don't know why its not producing bit-stream? Error in implementation
I wanted to make a 4-bit counter on Basys3 board using Vivado. I wrote a code for it in verilog. I am not able to generate the bit stream. I have pasted stopwatch.v module and constraint file. The onboard clock speed of Basys3 is 100MHz. //`timescale 1ns/1ps module stopwatch( input clk, input reset, input start, input pause, output reg [3:0] out); reg [26:0] clock; reg starter; always #(posedge clk or posedge reset) begin if (reset) begin out <= 0; clock <= 0; end else if (starter) begin if (clock == 25'd10000000) begin out <= out + 1'b1; clock <= 0; end else clock <= clock + 1'b1; end end // always # (posedge clk or posedge reset) always #(*) begin if (start) starter <= 1'b1; else if (pause) starter <= 0; end endmodule // stopwatch Constraint_file.xdc set_property PACKAGE_PIN U18 [get_ports {reset}] set_property PACKAGE_PIN T18 [get_ports {start}] set_property PACKAGE_PIN U17 [get_ports {pause}] set_property PACKAGE_PIN U16 [get_ports {out[0]}] set_property PACKAGE_PIN E19 [get_ports {out[1]}] set_property PACKAGE_PIN U19 [get_ports {out[2]}] set_property PACKAGE_PIN V19 [get_ports {out[3]}] set_property PACKAGE_PIN W5 [get_ports clk] create_clock -add -name sys_clk_pin -period 10.00 -waveform {0 5} [get_ports clk] set_property IOSTANDARD LVCMOS33 [get_ports clk] set_property IOSTANDARD LVCMOS33 [get_ports {reset start pause out}] Below is the error I am keep getting: [Place 30-574] Poor placement for routing between an IO pin and BUFG. If this sub optimal condition is acceptable for this design, you may use the CLOCK_DEDICATED_ROUTE constraint in the .xdc file to demote this message to a WARNING. However, the use of this override is highly discouraged. These examples can be used directly in the .xdc file to override this clock rule. < set_property CLOCK_DEDICATED_ROUTE FALSE [get_nets pause_IBUF] > pause_IBUF_inst (IBUF.O) is locked to IOB_X0Y14 and pause_IBUF_BUFG_inst (BUFG.I) is provisionally placed by clockplacer on BUFGCTRL_X0Y0
The tools is complaining about your choice for the 'pause' I/O buffer. It says you should use a global clock buffer input (BUFG) for that signal. It has routed the signal through a global clock buffer "BUFGCTRL_X0Y0". This might have to do with the fact that 'starter' is a latch and Vivado thinks your pause signal is a clock. This piece of code is wrong: always #(*) begin if (start) starter <= 1'b1; else if (pause) starter <= 0; end First of all: In an always combinatorial block you do not use non-blocking assignments. You use '=' Secondly : there is no closing 'else' so you get a latch. Or was this the code you wanted: assign starter = start & ~pause; Alternative you could move that code, as it is, into your clocked section. In that case make sure you reset "starter" as well.
Connecting components in VHDL structural
I am working in VHDL, trying to connect three components M88, A8, A16, but once I synthesize the circuit and look at the RTL Schematic none of the components are connected. For example, I want to connect the output of M88 'out_high' to the input A16 of component A16. I do this by defining a signal OUT_H. Below is the structural of the main circuit and the entities of M88 and A16. The library 'Mult8x8.Components' is where I've defined the components. None of the connections between the components I've defined work, but I believe that I'm doing the same mistake that I can't figure out. Thanks entity Structure is Port ( Clock, RST, Start : in BIT; IN1, IN2 : in BIT_VECTOR (7 downto 0); RESULT8x8 : out BIT_VECTOR (15 downto 0); Done : out BIT_VECTOR(3 downto 0) ); end Structure; architecture Structural of Structure is use work.Mult8x8_Components.all; signal OUT_M1, OUT_M2: BIT_VECTOR(7 downto 0); signal OUT_H, OUT_L, ADD_MIXout, result16: BIT_VECTOR(15 downto 0); signal Zero, Init, Shift, Add, Low: BIT := '0'; signal High: BIT := '1'; signal F, OFL, REGclr: BIT; signal DD : BIT_VECTOR(3 downto 0); begin -- REGclr <= Init or RST; RESULT8x8 <= result16; Done <= DD; M88 : Mult8x8 port map (CLK => Clock, RESET => RST, Start => Start, input1 => IN1, input2 => IN2, out_high => OUT_H, out_low => OUT_L, out_mix1 => OUT_M1, out_mix2 => OUT_M2, DONE => DD ); A8 : Adder8 port map (A=>OUT_M1, B=>OUT_M2, Cin=>Low, Cout=>OFL, Sum=>ADD_MIXout(11 downto 4)); A16 : Adder16 port map (A16=> OUT_H, B16 => OUT_L, E16 => ADD_MIXout, Cin16 => low, Cout16 => OFL, Sum16 => result16 ); end Structural; entity Mult8x8 is Port( CLK, RESET, Start : in BIT; input1 : in BIT_VECTOR (7 downto 0); input2 : in BIT_VECTOR (7 downto 0); out_high : out BIT_VECTOR (15 downto 0) := (others =>'0'); out_low : out BIT_VECTOR (15 downto 0) := (others =>'0'); out_mix1 : out BIT_VECTOR (7 downto 0) := (others =>'0'); out_mix2 : out BIT_VECTOR (7 downto 0) := (others =>'0'); DONE : out BIT_VECTOR (3 downto 0) ); end Mult8x8; entity Adder16 is Port ( A16, B16, E16 : in BIT_VECTOR (15 downto 0); Cin16 : in BIT; Cout16 : out BIT; Sum16 : out BIT_VECTOR (15 downto 0)); end Adder16;
When you want to map several entities between them in an upper entity like you're doing there, you need to first define these entities in a separate file (what I supposed you did). Then, I recommend that, in the "top level" (your entity Structure) you need to instantiate them before the begin term of your architecture with a different terminology: component. NB: This, obviously, only works if the sub entities are compiled in the same work library. This is an example of how you should change your code. Note that you're missing the component Adder8 that you need to define like the two others. use work.Mult8x8_Components.all; entity Structure is Port ( Clock, RST, Start : in BIT; IN1, IN2 : in BIT_VECTOR (7 downto 0); RESULT8x8 : out BIT_VECTOR (15 downto 0); Done : out BIT_VECTOR(3 downto 0) ); end Structure; architecture Structural of Structure is signal OUT_M1, OUT_M2: BIT_VECTOR(7 downto 0); signal OUT_H, OUT_L, ADD_MIXout, result16: BIT_VECTOR(15 downto 0); signal Zero, Init, Shift, Add, Low: BIT := '0'; signal High: BIT := '1'; signal F, OFL, REGclr: BIT; signal DD : BIT_VECTOR(3 downto 0); component Mult8x8 is Port( CLK, RESET, Start : in BIT; input1 : in BIT_VECTOR (7 downto 0); input2 : in BIT_VECTOR (7 downto 0); out_high : out BIT_VECTOR (15 downto 0) := (others =>'0'); out_low : out BIT_VECTOR (15 downto 0) := (others =>'0'); out_mix1 : out BIT_VECTOR (7 downto 0) := (others =>'0'); out_mix2 : out BIT_VECTOR (7 downto 0) := (others =>'0'); DONE : out BIT_VECTOR (3 downto 0) ); end component ; component Adder16 is Port ( A16, B16, E16 : in BIT_VECTOR (15 downto 0); Cin16 : in BIT; Cout16 : out BIT; Sum16 : out BIT_VECTOR (15 downto 0) ); end component ; begin -- REGclr <= Init or RST; RESULT8x8 <= result16; Done <= DD; M88 : Mult8x8 port map (CLK => Clock, RESET => RST, Start => Start, input1 => IN1, input2 => IN2, out_high => OUT_H, out_low => OUT_L, out_mix1 => OUT_M1, out_mix2 => OUT_M2, DONE => DD ); A8 : Adder8 port map (A=>OUT_M1, B=>OUT_M2, Cin=>Low, Cout=>OFL, Sum=>ADD_MIXout(11 downto 4)); A16 : Adder16 port map (A16=> OUT_H, B16 => OUT_L, E16 => ADD_MIXout, Cin16 => low, Cout16 => OFL, Sum16 => result16 ); end Structural; Another way to instantiate your entities without calling the component before is the following: A8: entity work.adder8 port map (OUT_M1, OUT_M2, Low, OFL, ADD_MIXout(11 downto 4)); In this case, you don't need to specify the ports, they are taken in the order defined in the entity.
How do I display the pulse width of a signal in vhdl?
I am trying to implement this code into a program that displays the pulse width of a signal onto the seven segment display on the basys2 board but when I download the code onto the board it just displays "0001" I figured out its just showing 1 from the part that does "x<=a_count_pw+1". It looks like it just adds 1 and thats it even when there is no signal being input. I also get this warning "The signal is incomplete. The signal does not drive any load pins in the design." This is supposed to be for my input signal? Here is my code. Any help is greatly appreciated thank you. Top module: main_top - Behaviral(main_top.vhd) library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; use IEEE.STD_LOGIC_UNSIGNED.all; entity main_top is port( J3_IO1 : in std_logic; mclk : in STD_LOGIC; btn : in STD_LOGIC_VECTOR(3 downto 0); a_to_g : out STD_LOGIC_VECTOR(6 downto 0); an : out STD_LOGIC_VECTOR(3 downto 0); dp : out STD_LOGIC ); end main_top; architecture Behaviral of main_top is signal a_count_rst: STD_LOGIC; signal a_count_pw: STD_LOGIC_VECTOR(15 downto 0); signal a_count_pw_reported: STD_LOGIC_VECTOR(15 downto 0); signal J3_IO1_q : STD_LOGIC; signal J3_IO1_qq : STD_LOGIC; component main port( x : in STD_LOGIC_VECTOR(15 downto 0); clk : in STD_LOGIC; clr : in STD_LOGIC; a_to_g : out STD_LOGIC_VECTOR (6 downto 0); an : out STD_LOGIC_VECTOR (3 downto 0); dp : out STD_LOGIC ); end component; signal x: STD_LOGIC_VECTOR (15 downto 0); begin process(mclk) if mclk'event and mclk='1' then -- Synchronous process, clock edge is outer "if" if a_count_rst='1' then --synchronous reset a_count_pw <= b"0000000000000000"; a_count_pw_reported <= a_count_pw_reported; else J3_IO1_q <= J3_IO1; -- First D FF stage J3_IO1_qq <= J3_IO1_q; -- Second D FF stage for edge detect if J3_IO1_qq = '0' and J3_IO1_q = '1' then -- Detect rising edge a_count_pw <= b"0000000000000000"; -- Start from 0 at rising edge elsif J3_IO1_qq = '1' and J3_IO1_q = '0' then -- Detect falling edge a_count_pw_reported <= a_count_pw; -- Capture count else x <= a_count_pw + 1; end if; end if; end if; end process; X1 : main port map (x=>x, clk=>mclk, clr=>btn(3), a_to_g=>a_to_g, an=>an, dp=>dp); end Behaviral; This is the next module for multiplexing the display. Module: X1 - main - Behaviral (main.vhd) library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.all; entity main is port( x : in STD_LOGIC_VECTOR(15 downto 0); clk : in STD_LOGIC; clr : in STD_LOGIC; a_to_g : out STD_LOGIC_VECTOR (6 downto 0); an : out STD_LOGIC_VECTOR (3 downto 0); dp : out STD_LOGIC; btn : in STD_LOGIC_VECTOR(3 downto 0); J3_IO1 : in STD_LOGIC; a_count_pw : in STD_LOGIC_VECTOR(15 downto 0) ); end main; architecture Behaviral of main is signal s : STD_LOGIC_VECTOR (1 downto 0); signal aen : STD_LOGIC_VECTOR (3 downto 0); signal clkdiv : STD_LOGIC_VECTOR (20 downto 0); signal digit : STD_LOGIC_VECTOR (3 downto 0); begin s <= clkdiv(18 downto 17); aen <= "1111"; dp <= '1'; --4 to 1 multiplex process(s, x) begin case s is when "00" => digit <= x(3 downto 0); when "01" => digit <= x(7 downto 4); when "10" => digit <= x(11 downto 8); when others => digit <= x(15 downto 12); end case; end process; process(digit) begin case digit is when X"0" => a_to_g <= "1000000"; --0 when X"1" => a_to_g <= "1111001"; --1 when X"2" => a_to_g <= "0100100"; --2 when X"3" => a_to_g <= "0110000"; --3 when X"4" => a_to_g <= "0011001"; --4 when X"5" => a_to_g <= "0010010"; --5 when X"6" => a_to_g <= "0000010"; --6 when X"7" => a_to_g <= "1011000"; --7 when X"8" => a_to_g <= "0000000"; --8 when X"9" => a_to_g <= "0010000"; --9 when X"A" => a_to_g <= "0001000"; --A when X"B" => a_to_g <= "0000011"; --b when X"C" => a_to_g <= "1000110"; --C when X"D" => a_to_g <= "0100001"; --d when X"E" => a_to_g <= "0000110"; --E when others => a_to_g <= "0001110"; --F end case; end process; --digit control process(s, aen) begin an <= "1111"; if aen(conv_integer(s)) = '1' then an(conv_integer(s)) <= '0'; end if; end process; --clock divider process(clk, clr) begin if clr ='1' then clkdiv <= (others => '0'); elsif clk'event and clk = '1' then clkdiv <= clkdiv +1; end if; end process; end Behaviral; Here is my ucf file ports.ucf NET "mclk" LOC = "B8"; NET "a_to_g<0>" LOC = "L14"; NET "a_to_g<1>" LOC = "H12"; NET "a_to_g<2>" LOC = "N14"; NET "a_to_g<3>" LOC = "N11"; NET "a_to_g<4>" LOC = "P12"; NET "a_to_g<5>" LOC = "L13"; NET "a_to_g<6>" LOC = "M12"; NET "dp" LOC = "N13"; NET "an<3>" LOC = "K14"; NET "an<2>" LOC = "M13"; NET "an<1>" LOC = "J12"; NET "an<0>" LOC = "F12"; NET "btn<3>" LOC = "A7"; NET "J3_IO1" LOC = "J3";
As it looks to me, you haven't binded some port elements. I don't see x which you use as indicator for signal width. That also makes perfect sense if you look at the error - "The signal does not drive any load pins in the design". Elements from port should all be binded to actual pins. You could consider x as a 16 bits wide parallel interface where you read input values and later use them for your cause. As it looks to me, you could just use x as a signal or even variable and send back just actual bytes that you should write to seven segment display