B
BC
Guest
I am new to VHDL and I have a couple of boards that I am experimenting
with using Xilinx ISE 7.1
One is the Spartan-3 board from Digilent which has an XC3S200 FPGA on
it and 50MHz oscillator, the other is a board I made with a Xilinx
XC9572 84 pin CPLD on it and a 10MHz oscillator.
With either board I can successfuly create schematic based asynchronous
counters using D type flipflops to divide the clocks down. On the S3
board I can also write code such as this to create a divide by 10.
entity div10 is
Port ( clock_in : in std_logic;
clock_out : out std_logic);
end div10;
architecture Behavioral of div10 is
signal cnt: std_logic_vector(3 downto 0):="0001";
signal clktemp : std_logic:='0';
begin
process (clock_in) --sensitivity only to clock_in
begin
if (clock_in'event and clock_in = '1') then
cnt <= cnt + '1';
if (cnt = "0101") then
cnt <= "0001";
clktemp <= not clktemp;
end if;
end if;
end process;
clock_out <= clktemp;
end Behavioral;
HOWEVER, this code does not work on the CPLD board the output is close
to a divide by 2, but not completely regular. I have also tried a
schematic design for a synchronous divide by 10, however that doesnt
work in the CPLD either.
I'm sure its something obvious that I'm missing, something to do with
the clocks on the CPLD maybe???
Thanks
BC
NZ
with using Xilinx ISE 7.1
One is the Spartan-3 board from Digilent which has an XC3S200 FPGA on
it and 50MHz oscillator, the other is a board I made with a Xilinx
XC9572 84 pin CPLD on it and a 10MHz oscillator.
With either board I can successfuly create schematic based asynchronous
counters using D type flipflops to divide the clocks down. On the S3
board I can also write code such as this to create a divide by 10.
entity div10 is
Port ( clock_in : in std_logic;
clock_out : out std_logic);
end div10;
architecture Behavioral of div10 is
signal cnt: std_logic_vector(3 downto 0):="0001";
signal clktemp : std_logic:='0';
begin
process (clock_in) --sensitivity only to clock_in
begin
if (clock_in'event and clock_in = '1') then
cnt <= cnt + '1';
if (cnt = "0101") then
cnt <= "0001";
clktemp <= not clktemp;
end if;
end if;
end process;
clock_out <= clktemp;
end Behavioral;
HOWEVER, this code does not work on the CPLD board the output is close
to a divide by 2, but not completely regular. I have also tried a
schematic design for a synchronous divide by 10, however that doesnt
work in the CPLD either.
I'm sure its something obvious that I'm missing, something to do with
the clocks on the CPLD maybe???
Thanks
BC
NZ