EmbDev.net

Forum: FPGA, VHDL & Verilog User Constraints File


von John S. (samit_basak)


Rate this post
useful
not useful
What dose it mean by User Constraints File?
I wrote the following program for seven segment display driver using 
Xilinx CoolRunner starter kit-
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY seg7 IS
PORT (D       : IN  STD_LOGIC_VECTOR (3 DOWNTO 0);
      S       : OUT STD_LOGIC_VECTOR (6 DOWNTO 0));
END seg7;
ARCHITECTURE display OF SEG7 IS
BEGIN
s <=  "1000000" WHEN d = "0000" ELSE -- H"40"
      "1111001" WHEN d = "0001" ELSE -- H"79"
      "0100100" WHEN d = "0010" ELSE -- H"24"
      "0110000" WHEN d = "0011" ELSE -- H"30"
      "0011001" WHEN d = "0100" ELSE -- H"19"
      "0010010" WHEN d = "0101" ELSE -- H"12"
      "0000010" WHEN d = "0110" ELSE -- H"02"
      "1111000" WHEN d = "0111" ELSE -- H"78"
      "0000000" WHEN d = "1000" ELSE -- H"00"
      "0010000" WHEN d = "1001" ELSE -- H"10"
      "0001000" WHEN d = "1010" ELSE -- H"08"
      "0000011" WHEN d = "1011" ELSE -- H"03"
      "1000110" WHEN d = "1100" ELSE -- H"46"
      "0100001" WHEN d = "1101" ELSE -- H"21"
      "0000110" WHEN d = "1110" ELSE -- H"06"
      "0001110";                     -- H"0E"
END display;

But what will be the User Constraints File for it?

von na sowas (Guest)


Rate this post
useful
not useful
In the User Constraints File you e.g. assign pins to your top entity 
port and in this file you specify a desired clock rate.

BTW:
1
s <=  "1000000" WHEN d = "0000" ELSE -- H"40"
2
      "1111001" WHEN d = "0001" ELSE -- H"79"
3
      "0100100" WHEN d = "0010" ELSE -- H"24"
4
      :
this you could write a little more readable:
1
s <=  x"40" WHEN d = x"0" ELSE 
2
      x"79" WHEN d = x"1" ELSE 
3
      x"24" WHEN d = x"2" ELSE 
4
      :
5
      x"06" WHEN d = x"E" ELSE 
6
      x"0E"

von John S. (samit_basak)


Rate this post
useful
not useful
Thanks...
But the problem is that after implementing this code it created a .JED 
file for the CoolRunner II but nothing was happening.Then I realized 
that I have to make an .UCF file for that project.But I really don't 
know how to make one for my program.So can u plz advice what shall I 
do??

von na sowas (Guest)


Rate this post
useful
not useful
> But I really don't know how to make one for my program.
> So can u plz advice what shall I do??
Go to the Processes and click on Assign Package Pins. Then you will be 
asked to add a ucf file to your design. And after starting the Wizzard 
(PACE) you can assign the pins simply by Drag&Drop.

von John S. (samit_basak)


Rate this post
useful
not useful
Thnx...
I would like to know how can I give an audible output?Like if sum1 has 
pressed the push button on the Xilinx CPLD starter kit,so there shud b 
an audible output...
If possible I need ur suggestion?And thank u again...

von na sowas (Guest)


Rate this post
useful
not useful
> If possible I need ur suggestion?And thank u again...
What kind of speaker do you have?

Usually thats the way:
Generate a audible frequency with a counter. Connect it to the speaker 
pins. When the button is not pressed reset the counter, so theres 
nothing to hear...
1
:
2
use ieee.numeric_std.all
3
:
4
  port ( clk : in std_logic;
5
         btn : in std_logic;
6
         spkr : out std_logic);
7
:
8
 signal counter : integer range 0 to 10_000_000/1600 := 0; -- clk-frequency = 10Mhz, speaker output = 800Hz
9
 signal intspkr : std_logic := '0';
10
:
11
 process begin
12
    wait until rising_edge(clk);
13
    if (counter<10_000_000/1600) then -- reached end of counter?
14
       counter <= counter+1;          -- no:  increment  
15
    else 
16
       counter <= 0;                  -- yes: reset counter
17
       intspkr <= not intspkr;        --      toggle output
18
    end if;
19
    if (btn='0') then  -- button not pressed:  
20
       counter <= 0;   -- reset counter
21
    end if;
22
 end process;
23
 spkr <= intspkr;
24
:

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.