Compare commits

..

10 Commits

Author SHA1 Message Date
Joris van Rantwijk 398dca67b6 Fix bugs in AC97 output for Atlys board.
* Fix bugs in AC97 synchronization.
* Fix bugs in AC97 reset.
* Reduce audio volume to -12 dB.
* Set correct voltage for reset button on Atlys board.
2016-04-23 11:37:42 +02:00
Joris van Rantwijk 8bd2d389ef Add Python program to test core via serial port. 2016-04-23 00:27:34 +02:00
Joris van Rantwijk e402b88b3d Minor change to atlys toplevel.
* Rename .vhd -> .vhdl
* Reset phase of audio tone.
2016-04-22 21:06:40 +02:00
Joris van Rantwijk 01c0832324 Integrate AC97 output in Atlys top-level. 2016-04-22 19:34:39 +02:00
Joris van Rantwijk 47e53fff56 Add AC97 output driver. 2016-04-22 17:20:13 +02:00
Joris van Rantwijk 9c73463282 Add top-level test design for Digilent Atlys board. 2016-04-22 09:42:48 +02:00
Joris van Rantwijk 331211f34b Fix bugs in test_sincos_serial.vhdl.
* Allow choice of core at run-time instead of synthesis-time.
* Fix mistake in serial port RX machine.
2016-04-21 22:20:32 +02:00
Joris van Rantwijk 84c92fea95 Fix analysis errors in test_sincos_serial.vhdl. 2016-04-21 20:36:11 +02:00
Joris van Rantwijk b21a696b71 Minor textual improvements in README. 2016-04-21 20:30:53 +02:00
Joris van Rantwijk ff860d4ae3 Update README after adding extra phase bit.
* Update accuracy figures based on simulation with extra phase bit.
* Update FPGA resource information based on synthesis run with extra phase bit.
2016-04-21 20:26:03 +02:00
8 changed files with 1295 additions and 107 deletions

View File

@ -1,8 +1,8 @@
Sine / cosine generator in VHDL Sine / cosine function core in VHDL
================================= ====================================
This package contains a sine / cosine generator in synthesizable VHDL code. This package contains a sine / cosine function core in synthesizable VHDL code.
The core takes a phase value as input and produces the corresponding sine The core takes a phase value as input and produces the corresponding sine
and cosine as signed integer outputs. The core is fully pipelined, accepting and cosine as signed integer outputs. The core is fully pipelined, accepting
@ -33,8 +33,8 @@ to compute the sine and cosine of an arbitrary point in the first quadrant:
in a ROM block with two read ports. in a ROM block with two read ports.
2) Compute the phase mismatch between the table point and actual 2) Compute the phase mismatch between the table point and actual
phase input in radians. This requires multiplication by Pi, phase input in radians. This requires multiplication by Pi/2,
which is implemented through repeated shifting and adding. which is implemented through shifting and adding.
3) Use the Taylor series to obtain a more accurate approximation 3) Use the Taylor series to obtain a more accurate approximation
of the answer. Depending on the required accuracy, either 1st order of the answer. Depending on the required accuracy, either 1st order
@ -106,24 +106,22 @@ Accuracy of the sine/cosine output from the cores has been determined from
a simulation of the VHDL code on all possible phase input values. a simulation of the VHDL code on all possible phase input values.
---- ----
Core variant: sincos_gen_d18_p20 sincos_gen_d24_p26
Phase input width: 20 bits 26 bits
Sin/cos output width: 18 bits 24 bits
Core variant sincos_gen_d18_p20 sincos_gen_d24_p26 Amplitude: 131071.008128 lsb 8388606.997508 lsb
Phase input width 20 bits 26 bits Offset: 0.000000 lsb 0.000000 lsb
Sin/cos output width 18 bits 24 bits Phase mismatch: 1.30e-7 rad 1.94e-9 rad
Amplitude 131071.008033 lsb 8388606.997478 lsb Peak absolute error: 0.864721 lsb 0.917662 lsb
Offset 0.000000 lsb 0.000000 lsb Root-mean-square error: 0.325144 lsb rms 0.326538 lsb rms
Phase mismatch 1.30e-7 rad 1.99e-9 rad SINAD: 109.09 dB 145.18 dB
Effective nr of bits: 17.83 bits 23.82 bits
Peak absolute error 0.966104 lsb 1.029916 lsb Spurious-free dynamic range: 135.19 dB 171.50 dB
Root-mean-square error 0.330982 lsb rms 0.332547 lsb rms
SINAD 108.94 dB 145.03 dB
Effective nr of bits 17.80 bits 23.80 bits
Spurious-free dynamic range 129.81 dB 166.18 dB
cos(x) == sin(x+pi/2) exact match exact match
sin(x) == - sin(x+pi) exact match exact match
cos(x) == sin(x+pi/2) : exact match exact match
sin(x) == - sin(x+pi) : exact match exact match
---- ----
@ -131,22 +129,21 @@ sin(x) == - sin(x+pi) exact match exact match
-------------- --------------
---- ----
FPGA type: Xilinx Spartan-6 LX45-3 Xilinx Virtex-7 485T-1
Synthesizer: Xilinx ISE 14.7 Xilinx Vivado 2014.4.1
FPGA type Xilinx Spartan-6 LX45-3 Xilinx Virtex-7 485T-1 Core variant: d18_p20 d24_p26 d18_p20 d24_p26
Synthesizer Xilinx ISE 14.7 Xilinx Vivado 2014.4.1
Core variant d18_p20 d24_p26 d18_p20 d24_p26 Flip-flops: 136 253 153 295
LUTs: 124 213 114 182
Flip-flops 134 250 151 291 RAMB18: 0 0 1 0
LUTs 118 204 115 181 RAMB36: 0 0 0 1
RAMB18 0 0 1 0 DSP48E1: 0 0 2 4
RAMB36 0 0 0 1 RAMB16BWER: 1 1
DSP48E1 0 0 2 4 RAMB8BWER: 0 1
RAMB16BWER 1 1 DSP48A1: 2 4
RAMB8BWER 0 1
DSP48A1 2 4
Clock freq 230 MHz 230 MHz 400 MHz 400 MHz
Clock freq: 230 MHz 230 MHz 400 MHz 400 MHz
---- ----
--

View File

@ -7,6 +7,22 @@
-- modify it under the terms of the GNU Lesser General Public -- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either -- License as published by the Free Software Foundation; either
-- --
--
-- Test driver for sine / cosine core, communicates via serial port.
--
-- Send 6 bytes { 0x41 0x42 phase(7:0) phase(15:8) phase(23:16) phase(31:24) }
-- to calculate sine and cosine of phase on the 18-bit / 20-bit core.
--
-- Send 6 bytes { 0x41 0x43 phase(7:0) phase(15:8) phase(23:16) phase(31:24) }
-- to calculate sine and cosine of phase on the 24-bit / 26-bit core.
--
-- In both cases, test driver replies with 8 bytes
-- { sin(7:0) sin(15:8) sin(23:16) sin(31:24)
-- cos(7:0) cos(15:8) cos(23:16) cos(31:24 }
--
-- Send 2 bytes { 0x41 0x44 } to start clock-enable modulation.
-- Send 3 bytes { 0x41 0x45 } to stop clock-enable modulation.
--
library ieee; library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_1164.all;
@ -17,12 +33,7 @@ entity test_sincos_serial is
generic ( generic (
-- Clock frequency divider from system clock to serial bitrate. -- Clock frequency divider from system clock to serial bitrate.
-- bitrate = system_clock_frequency / serial_bitrate_divider -- bitrate = system_clock_frequency / serial_bitrate_divider
serial_bitrate_divider: integer range 10 to 8192; serial_bitrate_divider: integer range 10 to 8192 );
-- Select core.
-- 1 = 18-bit sin/cos generator;
-- 2 = 24-bit sin/cos generator.
core_select: integer range 1 to 2 );
port ( port (
-- System clock, active on rising edge. -- System clock, active on rising edge.
@ -35,27 +46,33 @@ entity test_sincos_serial is
ser_rx: in std_logic; ser_rx: in std_logic;
-- Serial TX output. -- Serial TX output.
ser_tx: out std_logic ); ser_tx: out std_logic;
-- Status signals.
stat_ready: out std_logic;
stat_calc: out std_logic;
stat_clkmod: out std_logic;
stat_txser: out std_logic );
end entity; end entity;
architecture rtl of test_sincos_serial is architecture rtl of test_sincos_serial is
constant latency: integer := 3 + 3 * core_select; constant core1_latency: integer := 6;
constant core2_latency: integer := 9;
signal r_clk_en: std_logic; signal r_clk_en: std_logic;
signal r_in_phase: unsigned(31 downto 0); signal r_in_phase: unsigned(31 downto 0);
signal s_out_sin: signed(31 downto 0);
signal s_out_cos: signed(31 downto 0);
signal s_gen1_out_sin: signed(17 downto 0); signal s_gen1_out_sin: signed(17 downto 0);
signal s_gen1_out_cos: signed(17 downto 0); signal s_gen1_out_cos: signed(17 downto 0);
signal s_gen2_out_sin: signed(23 downto 0); signal s_gen2_out_sin: signed(23 downto 0);
signal s_gen2_out_cos: signed(23 downto 0); signal s_gen2_out_cos: signed(23 downto 0);
signal r_tst_start: std_logic; signal r_tst_start: std_logic;
signal r_tst_in_phase: unsigned(31 downto 0); signal r_tst_coresel: std_logic;
signal r_tst_out_sin: unsigned(31 downto 0); signal r_tst_in_phase: std_logic_vector(31 downto 0);
signal r_tst_out_cos: unsigned(31 downto 0); signal r_tst_out_sin: std_logic_vector(31 downto 0);
signal r_tst_out_cos: std_logic_vector(31 downto 0);
signal r_tst_busy: std_logic; signal r_tst_busy: std_logic;
signal r_tst_cyclecnt: unsigned(3 downto 0); signal r_tst_cyclecnt: unsigned(3 downto 0);
@ -71,7 +88,7 @@ architecture rtl of test_sincos_serial is
signal r_ser_rx_bit: std_logic; signal r_ser_rx_bit: std_logic;
signal r_ser_rx_timer: unsigned(12 downto 0); signal r_ser_rx_timer: unsigned(12 downto 0);
signal r_ser_rx_timeout: std_logic; signal r_ser_rx_timeout: std_logic;
signal r_ser_rx_state; std_logic_vector(1 downto 0); signal r_ser_rx_state: std_logic_vector(1 downto 0);
signal r_ser_rx_shift: std_logic_vector(8 downto 0); signal r_ser_rx_shift: std_logic_vector(8 downto 0);
signal r_ser_tx_strobe: std_logic; signal r_ser_tx_strobe: std_logic;
@ -86,9 +103,7 @@ architecture rtl of test_sincos_serial is
begin begin
-- Instantiate 18-bit sin/cos core. -- Instantiate 18-bit sin/cos core.
gen1: if core_select = 1 generate gen1: entity work.sincos_gen_d18_p20
gen1x: entity work.sincos_gen_d18_p20
port map ( port map (
clk => clk, clk => clk,
clk_en => r_clk_en, clk_en => r_clk_en,
@ -96,15 +111,8 @@ begin
out_sin => s_gen1_out_sin, out_sin => s_gen1_out_sin,
out_cos => s_gen1_out_cos ); out_cos => s_gen1_out_cos );
s_out_sin <= resize(s_gen1_out_sin, 32);
s_out_cos <= resize(s_gen1_out_cos, 32);
end generate;
-- Instantiate 24-bit sin/cos core. -- Instantiate 24-bit sin/cos core.
gen2: if core_select = 2 generate gen2: entity work.sincos_gen_d24_p26
gen2x: entity work.sincos_gen_d24_p26
port map ( port map (
clk => clk, clk => clk,
clk_en => r_clk_en, clk_en => r_clk_en,
@ -112,11 +120,6 @@ begin
out_sin => s_gen2_out_sin, out_sin => s_gen2_out_sin,
out_cos => s_gen2_out_cos ); out_cos => s_gen2_out_cos );
s_out_sin <= resize(s_gen2_out_sin, 32);
s_out_cos <= resize(s_gen2_out_cos, 32);
end generate;
-- Synchronous process. -- Synchronous process.
-- State machine for interface to design under test. -- State machine for interface to design under test.
process (clk) is process (clk) is
@ -128,15 +131,23 @@ begin
r_in_phase <= (others => '0'); r_in_phase <= (others => '0');
end if; end if;
if r_tst_busy = '1' and r_tst_cyclecnt = latency then if r_tst_busy = '1' and r_tst_coresel = '0' and
r_tst_cyclecnt = core1_latency then
r_tst_busy <= '0'; r_tst_busy <= '0';
r_tst_out_sin <= s_out_sin; r_tst_out_sin <= std_logic_vector(resize(s_gen1_out_sin, 32));
r_tst_out_cos <= s_out_cos; r_tst_out_cos <= std_logic_vector(resize(s_gen1_out_cos, 32));
end if;
if r_tst_busy = '1' and r_tst_coresel = '1' and
r_tst_cyclecnt = core2_latency then
r_tst_busy <= '0';
r_tst_out_sin <= std_logic_vector(resize(s_gen2_out_sin, 32));
r_tst_out_cos <= std_logic_vector(resize(s_gen2_out_cos, 32));
end if; end if;
if r_tst_start = '1' and r_tst_busy = '0' then if r_tst_start = '1' and r_tst_busy = '0' then
r_tst_busy <= '1'; r_tst_busy <= '1';
r_in_phase <= r_tst_in_phase; r_in_phase <= unsigned(r_tst_in_phase);
r_tst_cyclecnt <= (others => '0'); r_tst_cyclecnt <= (others => '0');
end if; end if;
@ -197,10 +208,14 @@ begin
if r_ctl_state = "0001" and r_ser_rx_strobe = '1' then if r_ctl_state = "0001" and r_ser_rx_strobe = '1' then
if r_ser_rx_byte = x"42" then if r_ser_rx_byte = x"42" then
r_ctl_state <= "0010"; r_ctl_state <= "0010";
r_tst_coresel <= '0';
elsif r_ser_rx_byte = x"43" then elsif r_ser_rx_byte = x"43" then
r_ctl_state <= "0010";
r_tst_coresel <= '1';
elsif r_ser_rx_byte = x"44" then
r_ctl_state <= "0000"; r_ctl_state <= "0000";
r_clkmod <= '1'; r_clkmod <= '1';
elsif r_ser_rx_byte = x"44" then elsif r_ser_rx_byte = x"45" then
r_ctl_state <= "0000"; r_ctl_state <= "0000";
r_clkmod <= '0'; r_clkmod <= '0';
else else
@ -210,22 +225,22 @@ begin
if r_ctl_state = "0010" and r_ser_rx_strobe = '1' then if r_ctl_state = "0010" and r_ser_rx_strobe = '1' then
r_ctl_state <= "0011"; r_ctl_state <= "0011";
r_tst_in_phase <= unsigned(r_ser_rx_byte) & r_tst_in_phase(31 downto 8); r_tst_in_phase <= r_ser_rx_byte & r_tst_in_phase(31 downto 8);
end if; end if;
if r_ctl_state = "0011" and r_ser_rx_strobe = '1' then if r_ctl_state = "0011" and r_ser_rx_strobe = '1' then
r_ctl_state <= "0100"; r_ctl_state <= "0100";
r_tst_in_phase <= unsigned(r_ser_rx_byte) & r_tst_in_phase(31 downto 8); r_tst_in_phase <= r_ser_rx_byte & r_tst_in_phase(31 downto 8);
end if; end if;
if r_ctl_state = "0100" and r_ser_rx_strobe = '1' then if r_ctl_state = "0100" and r_ser_rx_strobe = '1' then
r_ctl_state <= "0101"; r_ctl_state <= "0101";
r_tst_in_phase <= unsigned(r_ser_rx_byte) & r_tst_in_phase(31 downto 8); r_tst_in_phase <= r_ser_rx_byte & r_tst_in_phase(31 downto 8);
end if; end if;
if r_ctl_state = "0101" and r_ser_rx_strobe = '1' then if r_ctl_state = "0101" and r_ser_rx_strobe = '1' then
r_ctl_state <= "0110"; r_ctl_state <= "0110";
r_tst_in_phase <= unsigned(r_ser_rx_byte) & r_tst_in_phase(31 downto 8); r_tst_in_phase <= r_ser_rx_byte & r_tst_in_phase(31 downto 8);
r_tst_start <= '1'; r_tst_start <= '1';
end if; end if;
@ -235,49 +250,49 @@ begin
if r_ctl_state = "0111" and r_ser_tx_busy = '0' then if r_ctl_state = "0111" and r_ser_tx_busy = '0' then
r_ctl_state <= "1000"; r_ctl_state <= "1000";
r_ser_tx_byte <= std_logic_vector(r_tst_out_sin(7 downto 0)) r_ser_tx_byte <= r_tst_out_sin(7 downto 0);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1000" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1000" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1001"; r_ctl_state <= "1001";
r_ser_tx_byte <= std_logic_vector(r_tst_out_sin(15 downto 8)) r_ser_tx_byte <= r_tst_out_sin(15 downto 8);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1001" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1001" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1010"; r_ctl_state <= "1010";
r_ser_tx_byte <= std_logic_vector(r_tst_out_sin(23 downto 15)) r_ser_tx_byte <= r_tst_out_sin(23 downto 16);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1010" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1010" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1011"; r_ctl_state <= "1011";
r_ser_tx_byte <= std_logic_vector(r_tst_out_sin(31 downto 24)) r_ser_tx_byte <= r_tst_out_sin(31 downto 24);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1011" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1011" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1100"; r_ctl_state <= "1100";
r_ser_tx_byte <= std_logic_vector(r_tst_out_cos(7 downto 0)) r_ser_tx_byte <= r_tst_out_cos(7 downto 0);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1100" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1100" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1101"; r_ctl_state <= "1101";
r_ser_tx_byte <= std_logic_vector(r_tst_out_cos(15 downto 8)) r_ser_tx_byte <= r_tst_out_cos(15 downto 8);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1101" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1101" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "1110"; r_ctl_state <= "1110";
r_ser_tx_byte <= std_logic_vector(r_tst_out_cos(23 downto 15)) r_ser_tx_byte <= r_tst_out_cos(23 downto 16);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
if r_ctl_state = "1110" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then if r_ctl_state = "1110" and r_ser_tx_strobe = '0' and r_ser_tx_busy = '0' then
r_ctl_state <= "0000"; r_ctl_state <= "0000";
r_ser_tx_byte <= std_logic_vector(r_tst_out_cos(31 downto 24)) r_ser_tx_byte <= r_tst_out_cos(31 downto 24);
r_ser_tx_strobe <= '1'; r_ser_tx_strobe <= '1';
end if; end if;
@ -290,6 +305,25 @@ begin
end if; end if;
end process; end process;
-- Synchronous process.
-- Drive status output signals.
process (clk) is
begin
if rising_edge(clk) then
if r_ctl_state = "0000" then
stat_ready <= '1';
else
stat_ready <= '0';
end if;
stat_calc <= r_tst_busy;
stat_clkmod <= r_clkmod;
stat_txser <= r_ser_tx_busy;
end if;
end process;
-- Synchronous process. -- Synchronous process.
-- Serial port RX machine. -- Serial port RX machine.
process (clk) is process (clk) is
@ -302,9 +336,9 @@ begin
-- Deglitch filter. -- Deglitch filter.
r_ser_rx_glitch <= r_ser_rx_glitch(6 downto 0) & ser_rx; r_ser_rx_glitch <= r_ser_rx_glitch(6 downto 0) & ser_rx;
if r_ser_rx_glitch(7 downto 1) = "0000000" then if r_ser_rx_glitch(7 downto 1) = "0000000" then
r_ser_rxbit <= '0'; r_ser_rx_bit <= '0';
elsif r_ser_rx_glitch(7 downto 1) = "1111111" then elsif r_ser_rx_glitch(7 downto 1) = "1111111" then
r_ser_rxbit <= '1'; r_ser_rx_bit <= '1';
end if; end if;
-- Bit timer. -- Bit timer.
@ -323,34 +357,41 @@ begin
end if; end if;
elsif r_ser_rx_state = "01" then elsif r_ser_rx_state = "01" then
-- Wait for start of byte. -- Wait for start of byte.
r_ser_rx_shift(7 downto 0) <= (others => '0'); r_ser_rx_timer <= to_unsigned(serial_bitrate_divider / 2 - 2, r_ser_rx_timer'length);
r_ser_rx_shift(8) <= '1';
r_ser_rx_timer <= to_unsigned(serial_bitrate_divider / 2 - 2, 13);
r_ser_rx_timeout <= '0'; r_ser_rx_timeout <= '0';
if r_ser_rx_bit = '0' then if r_ser_rx_bit = '0' then
r_ser_rx_state <= "10"; r_ser_rx_state <= "10";
end if; end if;
elsif r_ser_rx_state = "10" then elsif r_ser_rx_state = "10" then
-- Check start bit.
r_ser_rx_shift(7 downto 0) <= (others => '1');
r_ser_rx_shift(8) <= '0';
if r_ser_rx_timeout = '1' then
if r_ser_rx_bit = '0' then
r_ser_rx_state <= "11";
else
r_ser_rx_state <= "00";
end if;
r_ser_rx_timer <= to_unsigned(serial_bitrate_divider - 2, r_ser_rx_timer'length);
end if;
elsif r_ser_rx_state = "11" then
-- Wait for data bit. -- Wait for data bit.
if r_ser_rx_timeout = '1' then if r_ser_rx_timeout = '1' then
r_ser_rx_shift <= r_ser_rx_bit & r_ser_rx_shift(8 downto 1); r_ser_rx_shift <= r_ser_rx_bit & r_ser_rx_shift(8 downto 1);
if r_ser_rx_shift(0) = '1' then if r_ser_rx_shift(0) = '0' then
-- Reached end of byte. -- Reached end of byte.
if r_ser_rx_bit = '1' then if r_ser_rx_bit = '1' then
-- Got valid stop bit. -- Got valid stop bit.
r_ser_rx_byte <= r_ser_rx_shift(8 downto 1);
r_ser_rx_strobe <= '1'; r_ser_rx_strobe <= '1';
r_ser_rx_state <= "01"; r_ser_rx_state <= "01";
else else
-- Got invalid stop bit. -- Got invalid stop bit.
r_ser_rx_state <= "00"; r_ser_rx_state <= "00";
end if; end if;
r_ser_rx_state <= "11";
end if; end if;
r_ser_rx_timer <= to_unsigned(serial_bitrate_divider - 2); r_ser_rx_timer <= to_unsigned(serial_bitrate_divider - 2, r_ser_rx_timer'length);
end if; end if;
else
-- Invalid state.
r_ser_rx_state <= "00";
end if; end if;
-- Synchronous reset. -- Synchronous reset.
@ -382,7 +423,7 @@ begin
if r_ser_tx_busy = '0' then if r_ser_tx_busy = '0' then
-- Wait for start of byte. -- Wait for start of byte.
r_ser_tx_timer <= to_unsigned(serial_bitrate_divider - 2, 13); r_ser_tx_timer <= to_unsigned(serial_bitrate_divider - 2, r_ser_tx_timer'length);
r_ser_tx_timeout <= '0'; r_ser_tx_timeout <= '0';
r_ser_tx_shift <= r_ser_tx_byte; r_ser_tx_shift <= r_ser_tx_byte;
r_ser_tx_bitcnt <= to_unsigned(9, 4); r_ser_tx_bitcnt <= to_unsigned(9, 4);
@ -392,13 +433,13 @@ begin
r_ser_tx_busy <= '1'; r_ser_tx_busy <= '1';
end if; end if;
elsif r_ser_tx_busy = '1' and r_ser_tx_timout = '1' then elsif r_ser_tx_busy = '1' and r_ser_tx_timeout = '1' then
-- Send next bit. -- Send next bit.
r_ser_tx_bit <= r_ser_tx_shift(0); r_ser_tx_bit <= r_ser_tx_shift(0);
r_ser_tx_shift <= "1" & r_ser_tx_shift(7 downto 1); r_ser_tx_shift <= "1" & r_ser_tx_shift(7 downto 1);
r_ser_tx_bitcnt <= r_ser_tx_bitcnt - 1; r_ser_tx_bitcnt <= r_ser_tx_bitcnt - 1;
r_ser_tx_timer <= to_unsigned(serial_bitrate_divider - 2, 13); r_ser_tx_timer <= to_unsigned(serial_bitrate_divider - 2, r_ser_tx_timer'length);
if r_ser_tx_bitcnt = 0 then if r_ser_tx_bitcnt = 0 then
-- Just completed stop bit. -- Just completed stop bit.
r_ser_tx_busy <= '0'; r_ser_tx_busy <= '0';

View File

@ -0,0 +1,235 @@
--
-- Simple core for AC97 audio output.
--
-- Sets output volume to -12 dB,
-- then plays stereo PCM data at 48 kHz sample rate.
-- Only tested with LM4550 on Digilent Atlys board.
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity ac97out is
port (
-- AC97 bit clock.
bitclk: in std_logic;
-- Asynchronous reset, active low.
resetn: in std_logic;
-- Input samples for left and right channel.
data_left: in signed(19 downto 0);
data_right: in signed(19 downto 0);
-- Data handshake.
data_valid: in std_logic;
data_ready: out std_logic;
-- AC97 interface signals.
ac97_sdi: in std_logic;
ac97_sdo: out std_logic;
ac97_sync: out std_logic );
end entity;
architecture rtl of ac97out is
-- Initialization sequence.
type init_table_type is array(0 to 7) of std_logic_vector(23 downto 0);
constant init_table: init_table_type := (
-- write 0x0000 to register 0x00: soft reset
x"000000",
-- write 0x0000 to register 0x02: set master volume to -12 dB
x"020808",
-- write 0x0000 to register 0x04: set headphone volume to -12 dB
x"040808",
-- write 0x0000 to register 0x06: set mono_out volume to -12 dB
x"060008",
-- write 0x0808 to register 0x18: set PCM out volume to 0 dB
x"180808",
-- dummy read from register 0x00
x"800000",
x"800000",
x"800000" );
-- Output registers.
signal r_ready: std_logic;
signal r_sdo: std_logic;
signal r_sync: std_logic;
-- Reset synchronization.
signal r_rstsync: std_logic_vector(7 downto 0);
-- Bit counter.
signal r_bitcnt: unsigned(7 downto 0);
signal r_lastbit: std_logic;
signal r_endsync: std_logic;
-- Initialization state machine.
signal r_initwait: unsigned(5 downto 0);
signal r_initbusy: std_logic;
signal r_initdone: std_logic;
signal r_initstep: unsigned(2 downto 0);
signal r_initword: std_logic_vector(23 downto 0);
-- Data for next frame.
signal r_datavalid: std_logic;
signal r_dataleft: std_logic_vector(19 downto 0);
signal r_dataright: std_logic_vector(19 downto 0);
-- Frame data shift register (tag + slots 1 .. 4)
signal r_sdoshift: std_logic_vector(95 downto 0);
-- AC97 bit input register
signal r_sdi: std_logic;
begin
-- Drive outputs.
data_ready <= r_ready;
ac97_sdo <= r_sdo;
ac97_sync <= r_sync;
-- Synchronous process.
-- Sample AC97_SDI on falling edge of BITCLK.
process (bitclk) is
begin
if falling_edge(bitclk) then
r_sdi <= ac97_sdi;
end if;
end process;
-- Synchronous process.
process (bitclk, resetn) is
begin
if resetn = '0' then
-- Asynchronous reset.
r_rstsync <= (others => '0');
r_ready <= '0';
-- Outputs to codec must be low during reset.
r_sdo <= '0';
r_sync <= '0';
elsif rising_edge(bitclk) then
-- Drive SYNC high for 16 cycles at start of frame.
if r_lastbit = '1' then
r_sync <= '1';
elsif r_endsync = '1' then
r_sync <= '0';
end if;
-- Push next data bit to output.
r_sdo <= r_sdoshift(r_sdoshift'high);
r_sdoshift <= r_sdoshift(r_sdoshift'high-1 downto 0) & "0";
-- Fetch data from init table.
r_initword <= init_table(to_integer(r_initstep));
-- Prepare next frame.
if r_lastbit = '1' then
-- sdoshift(95:80) = TAG
-- bit 15 = master valid bit
-- bit 14 = slot 1 valid
-- bit 13 = slot 2 valid
-- bit 12 = slot 3 valid
-- bit 11 = slot 4 valid
-- Always set frame valid.
r_sdoshift(95) <= '1';
-- Set slots 1 and 2 valid if we are initializing.
r_sdoshift(94) <= r_initbusy;
r_sdoshift(93) <= r_initbusy;
-- Set slots 3 and 4 valid if we have valid data.
r_sdoshift(92) <= r_datavalid;
r_sdoshift(91) <= r_datavalid;
-- Remaining tag bits always zero.
r_sdoshift(90 downto 80) <= (others => '0');
-- Slot 1: Register read/write command.
-- bit 19 = read (1) or write (0)
-- bit 18:12 = address
r_sdoshift(79 downto 72) <= r_initword(23 downto 16);
r_sdoshift(71 downto 60) <= (others => '0');
-- Slot 2: Register write data.
-- bit 19:4 = data
r_sdoshift(59 downto 44) <= r_initword(15 downto 0);
r_sdoshift(43 downto 40) <= (others => '0');
-- Update init pointer.
if r_initbusy = '1' then
r_initstep <= r_initstep + 1;
end if;
if r_initstep = 7 then
r_initbusy <= '0';
r_initdone <= '1';
end if;
-- Update init delay counter (wait for 1.3 ms after reset).
r_initwait <= r_initwait - 1;
if r_initwait = 0 then
r_initstep <= (others => '0');
r_initbusy <= not r_initdone;
end if;
-- Slots 3 and 4: left and right sample value.
r_sdoshift(39 downto 20) <= r_dataleft;
r_sdoshift(19 downto 0) <= r_dataright;
-- Consume sample values.
r_datavalid <= '0';
r_ready <= '1';
end if;
-- Update bit counter.
r_bitcnt <= r_bitcnt - 1;
if r_bitcnt = 1 then
r_lastbit <= '1';
else
r_lastbit <= '0';
end if;
if r_bitcnt = 241 then
r_endsync <= '1';
else
r_endsync <= '0';
end if;
-- Capture input data.
if r_ready = '1' and data_valid = '1' then
r_ready <= '0';
r_datavalid <= '1';
r_dataleft <= std_logic_vector(data_left);
r_dataright <= std_logic_vector(data_right);
end if;
-- Release synchronous reset.
r_rstsync <= "1" & r_rstsync(7 downto 1);
-- Synchronous reset.
if r_rstsync(0) = '0' then
r_ready <= '0';
r_sdo <= '0';
r_sync <= '0';
r_initbusy <= '0';
r_initdone <= '0';
r_initwait <= (others => '1');
r_initstep <= (others => '0');
r_bitcnt <= (others => '0');
r_datavalid <= '0';
end if;
end if;
end process;
end architecture;

View File

@ -0,0 +1,38 @@
# clock pin for Atlys rev C board
NET "clk" LOC = "L15" | IOSTANDARD = LVCMOS33 ;
# 100 MHz
NET "clk" TNM_NET = "clk" ;
TIMESPEC "TS_clk" = PERIOD "clk" 10 ns HIGH 50% ;
# Reset button
NET "resetn" LOC = "T15" | IOSTANDARD = LVCMOS33 ;
# LEDs
NET "led<0>" LOC = "U18" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<1>" LOC = "M14" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<2>" LOC = "N14" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<3>" LOC = "L14" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<4>" LOC = "M13" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<5>" LOC = "D4" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<6>" LOC = "P16" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
NET "led<7>" LOC = "N12" | IOSTANDARD = LVCMOS33 | SLEW = QUIETIO ;
# USB serial port J17
NET "uartrx" LOC = "A16" | IOSTANDARD = LVCMOS33 ;
NET "uarttx" LOC = "B16" | IOSTANDARD = LVCMOS33 | SLEW = SLOW ;
# Audio
NET "ac97_bitclk" LOC = "L13" | IOSTANDARD = LVCMOS33 ;
NET "ac97_sdi" LOC = "T18" | IOSTANDARD = LVCMOS33 ;
NET "ac97_sdo" LOC = "N16" | IOSTANDARD = LVCMOS33 ;
NET "ac97_sync" LOC = "U17" | IOSTANDARD = LVCMOS33 ;
NET "ac97_rst" LOC = "T17" | IOSTANDARD = LVCMOS33 ;
# Constrain bitclk to 20 MHz (actual frequency is 12.288 MHz)
NET "ac97_bitclk" PERIOD = 50 ns HIGH 50% ;
OFFSET = IN 10 ns VALID 20 ns BEFORE "ac97_bitclk" FALLING ;
OFFSET = OUT 15 ns AFTER "ac97_bitclk" RISING ;

View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<generated_project xmlns="http://www.xilinx.com/XMLSchema" xmlns:xil_pn="http://www.xilinx.com/XMLSchema">
<!-- -->
<!-- For tool use only. Do not edit. -->
<!-- -->
<!-- ProjectNavigator created generated project file. -->
<!-- For use in tracking generated file and other information -->
<!-- allowing preservation of process status. -->
<!-- -->
<!-- Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. -->
<version xmlns="http://www.xilinx.com/XMLSchema">11.1</version>
<sourceproject xmlns="http://www.xilinx.com/XMLSchema" xil_pn:fileType="FILE_XISE" xil_pn:name="test_sincos.xise"/>
<files xmlns="http://www.xilinx.com/XMLSchema">
<file xil_pn:fileType="FILE_DIRECTORY" xil_pn:name="_ngo"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/bitgen.xmsgs"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/map.xmsgs"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/ngdbuild.xmsgs"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/par.xmsgs"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/trce.xmsgs"/>
<file xil_pn:fileType="FILE_XMSGS" xil_pn:name="_xmsgs/xst.xmsgs"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_BITGEN_REPORT" xil_pn:name="top_test_sincos.bgn" xil_pn:subbranch="FPGAConfiguration"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_BIT" xil_pn:name="top_test_sincos.bit" xil_pn:subbranch="FPGAConfiguration"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NGDBUILD_LOG" xil_pn:name="top_test_sincos.bld"/>
<file xil_pn:fileType="FILE_CMD_LOG" xil_pn:name="top_test_sincos.cmd_log"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_BITGEN_DRC" xil_pn:name="top_test_sincos.drc" xil_pn:subbranch="FPGAConfiguration"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_LSO" xil_pn:name="top_test_sincos.lso"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NCD" xil_pn:name="top_test_sincos.ncd" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NGC" xil_pn:name="top_test_sincos.ngc"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NGD" xil_pn:name="top_test_sincos.ngd"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NGR" xil_pn:name="top_test_sincos.ngr"/>
<file xil_pn:fileType="FILE_PAD_MISC" xil_pn:name="top_test_sincos.pad"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_PAR_REPORT" xil_pn:name="top_test_sincos.par" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_PCF" xil_pn:name="top_test_sincos.pcf" xil_pn:subbranch="Map"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_XST_PROJECT" xil_pn:name="top_test_sincos.prj"/>
<file xil_pn:fileType="FILE_TRCE_MISC" xil_pn:name="top_test_sincos.ptwx"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_XST_STX" xil_pn:name="top_test_sincos.stx"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_XST_REPORT" xil_pn:name="top_test_sincos.syr"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_TIMING_TXT_REPORT" xil_pn:name="top_test_sincos.twr" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_TIMING_XML_REPORT" xil_pn:name="top_test_sincos.twx" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_UNROUTES" xil_pn:name="top_test_sincos.unroutes" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_BITGEN_REPORT" xil_pn:name="top_test_sincos.ut" xil_pn:subbranch="FPGAConfiguration"/>
<file xil_pn:fileType="FILE_XPI" xil_pn:name="top_test_sincos.xpi"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_XST" xil_pn:name="top_test_sincos.xst"/>
<file xil_pn:fileType="FILE_HTML" xil_pn:name="top_test_sincos_envsettings.html"/>
<file xil_pn:fileType="FILE_NCD" xil_pn:name="top_test_sincos_guide.ncd" xil_pn:origination="imported"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_MAP_REPORT" xil_pn:name="top_test_sincos_map.map" xil_pn:subbranch="Map"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_MAP_REPORT" xil_pn:name="top_test_sincos_map.mrp" xil_pn:subbranch="Map"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NCD" xil_pn:name="top_test_sincos_map.ncd" xil_pn:subbranch="Map"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_NGM" xil_pn:name="top_test_sincos_map.ngm" xil_pn:subbranch="Map"/>
<file xil_pn:fileType="FILE_XRPT" xil_pn:name="top_test_sincos_map.xrpt"/>
<file xil_pn:fileType="FILE_XRPT" xil_pn:name="top_test_sincos_ngdbuild.xrpt"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_PAD_EXCEL_REPORT" xil_pn:name="top_test_sincos_pad.csv" xil_pn:subbranch="Par"/>
<file xil_pn:branch="Implementation" xil_pn:fileType="FILE_PAD_TXT_REPORT" xil_pn:name="top_test_sincos_pad.txt" xil_pn:subbranch="Par"/>
<file xil_pn:fileType="FILE_XRPT" xil_pn:name="top_test_sincos_par.xrpt"/>
<file xil_pn:fileType="FILE_HTML" xil_pn:name="top_test_sincos_summary.html"/>
<file xil_pn:fileType="FILE_FITTER_REPORT" xil_pn:name="top_test_sincos_summary.xml"/>
<file xil_pn:fileType="FILE_WEBTALK" xil_pn:name="top_test_sincos_usage.xml"/>
<file xil_pn:fileType="FILE_XRPT" xil_pn:name="top_test_sincos_xst.xrpt"/>
<file xil_pn:fileType="FILE_HTML" xil_pn:name="usage_statistics_webtalk.html"/>
<file xil_pn:fileType="FILE_LOG" xil_pn:name="webtalk.log"/>
<file xil_pn:fileType="FILE_FITTER_REPORT" xil_pn:name="webtalk_pn.xml"/>
<file xil_pn:fileType="FILE_DIRECTORY" xil_pn:name="xlnx_auto_0_xdb"/>
<file xil_pn:fileType="FILE_DIRECTORY" xil_pn:name="xst"/>
</files>
<transforms xmlns="http://www.xilinx.com/XMLSchema">
<transform xil_pn:end_ts="1461310404" xil_pn:name="TRAN_copyInitialToXSTAbstractSynthesis" xil_pn:start_ts="1461310404">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461346674" xil_pn:name="TRAN_schematicsToHdl" xil_pn:prop_ck="-1544048785962338122" xil_pn:start_ts="1461346674">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461346674" xil_pn:name="TRAN_regenerateCores" xil_pn:prop_ck="6687268679030817511" xil_pn:start_ts="1461346674">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461310404" xil_pn:name="TRAN_SubProjectAbstractToPreProxy" xil_pn:start_ts="1461310404">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461346674" xil_pn:name="TRAN_xawsTohdl" xil_pn:prop_ck="1379793326671312440" xil_pn:start_ts="1461346674">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461310404" xil_pn:name="TRAN_SubProjectPreToStructuralProxy" xil_pn:prop_ck="8977612015756273942" xil_pn:start_ts="1461310404">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461346674" xil_pn:name="TRAN_platgen" xil_pn:prop_ck="-3262842109162067599" xil_pn:start_ts="1461346674">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461403854" xil_pn:in_ck="2072574044500593778" xil_pn:name="TRANEXT_xstsynthesize_spartan6" xil_pn:prop_ck="8668749107623387584" xil_pn:start_ts="1461403839">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="WarningsGenerated"/>
<status xil_pn:value="ReadyToRun"/>
<status xil_pn:value="OutOfDateForOutputs"/>
<status xil_pn:value="OutputChanged"/>
<outfile xil_pn:name="_xmsgs/xst.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.lso"/>
<outfile xil_pn:name="top_test_sincos.ngc"/>
<outfile xil_pn:name="top_test_sincos.ngr"/>
<outfile xil_pn:name="top_test_sincos.prj"/>
<outfile xil_pn:name="top_test_sincos.stx"/>
<outfile xil_pn:name="top_test_sincos.syr"/>
<outfile xil_pn:name="top_test_sincos.xst"/>
<outfile xil_pn:name="top_test_sincos_xst.xrpt"/>
<outfile xil_pn:name="webtalk_pn.xml"/>
<outfile xil_pn:name="xst"/>
</transform>
<transform xil_pn:end_ts="1461400807" xil_pn:in_ck="141509727442713" xil_pn:name="TRAN_compileBCD2" xil_pn:prop_ck="7075349975164966765" xil_pn:start_ts="1461400807">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
</transform>
<transform xil_pn:end_ts="1461403860" xil_pn:in_ck="-1047380743607608193" xil_pn:name="TRANEXT_ngdbuild_FPGA" xil_pn:prop_ck="392032481918333458" xil_pn:start_ts="1461403854">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="ReadyToRun"/>
<outfile xil_pn:name="_ngo"/>
<outfile xil_pn:name="_xmsgs/ngdbuild.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.bld"/>
<outfile xil_pn:name="top_test_sincos.ngd"/>
<outfile xil_pn:name="top_test_sincos_ngdbuild.xrpt"/>
</transform>
<transform xil_pn:end_ts="1461403888" xil_pn:in_ck="-1047380743607608192" xil_pn:name="TRANEXT_map_spartan6" xil_pn:prop_ck="4245753365082497697" xil_pn:start_ts="1461403860">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="WarningsGenerated"/>
<status xil_pn:value="ReadyToRun"/>
<status xil_pn:value="OutOfDateForOutputs"/>
<status xil_pn:value="OutputChanged"/>
<outfile xil_pn:name="_xmsgs/map.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.pcf"/>
<outfile xil_pn:name="top_test_sincos_map.map"/>
<outfile xil_pn:name="top_test_sincos_map.mrp"/>
<outfile xil_pn:name="top_test_sincos_map.ncd"/>
<outfile xil_pn:name="top_test_sincos_map.ngm"/>
<outfile xil_pn:name="top_test_sincos_map.xrpt"/>
<outfile xil_pn:name="top_test_sincos_summary.xml"/>
<outfile xil_pn:name="top_test_sincos_usage.xml"/>
</transform>
<transform xil_pn:end_ts="1461403915" xil_pn:in_ck="693365441136831385" xil_pn:name="TRANEXT_par_spartan6" xil_pn:prop_ck="-3829590541433901613" xil_pn:start_ts="1461403888">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="WarningsGenerated"/>
<status xil_pn:value="ReadyToRun"/>
<outfile xil_pn:name="_xmsgs/par.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.ncd"/>
<outfile xil_pn:name="top_test_sincos.pad"/>
<outfile xil_pn:name="top_test_sincos.par"/>
<outfile xil_pn:name="top_test_sincos.ptwx"/>
<outfile xil_pn:name="top_test_sincos.unroutes"/>
<outfile xil_pn:name="top_test_sincos.xpi"/>
<outfile xil_pn:name="top_test_sincos_pad.csv"/>
<outfile xil_pn:name="top_test_sincos_pad.txt"/>
<outfile xil_pn:name="top_test_sincos_par.xrpt"/>
</transform>
<transform xil_pn:end_ts="1461403932" xil_pn:in_ck="4016941542054796675" xil_pn:name="TRANEXT_bitFile_spartan6" xil_pn:prop_ck="97434230493978268" xil_pn:start_ts="1461403915">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="WarningsGenerated"/>
<status xil_pn:value="ReadyToRun"/>
<outfile xil_pn:name="_xmsgs/bitgen.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.bgn"/>
<outfile xil_pn:name="top_test_sincos.bit"/>
<outfile xil_pn:name="top_test_sincos.drc"/>
<outfile xil_pn:name="top_test_sincos.ut"/>
<outfile xil_pn:name="usage_statistics_webtalk.html"/>
<outfile xil_pn:name="webtalk.log"/>
<outfile xil_pn:name="webtalk_pn.xml"/>
</transform>
<transform xil_pn:end_ts="1461403915" xil_pn:in_ck="-1047380743607608324" xil_pn:name="TRAN_postRouteTrce" xil_pn:prop_ck="445577401284416185" xil_pn:start_ts="1461403907">
<status xil_pn:value="SuccessfullyRun"/>
<status xil_pn:value="WarningsGenerated"/>
<status xil_pn:value="ReadyToRun"/>
<outfile xil_pn:name="_xmsgs/trce.xmsgs"/>
<outfile xil_pn:name="top_test_sincos.twr"/>
<outfile xil_pn:name="top_test_sincos.twx"/>
</transform>
</transforms>
</generated_project>

View File

@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<project xmlns="http://www.xilinx.com/XMLSchema" xmlns:xil_pn="http://www.xilinx.com/XMLSchema">
<header>
<!-- ISE source project file created by Project Navigator. -->
<!-- -->
<!-- This file contains project source information including a list of -->
<!-- project source files, project and process properties. This file, -->
<!-- along with the project source files, is sufficient to open and -->
<!-- implement in ISE Project Navigator. -->
<!-- -->
<!-- Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. -->
</header>
<version xil_pn:ise_version="14.6" xil_pn:schema_version="2"/>
<files>
<file xil_pn:name="top_test_sincos.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="1"/>
<association xil_pn:name="Implementation" xil_pn:seqID="6"/>
</file>
<file xil_pn:name="atlys.ucf" xil_pn:type="FILE_UCF">
<association xil_pn:name="Implementation" xil_pn:seqID="0"/>
</file>
<file xil_pn:name="../../rtl/sincos_gen_d18_p20.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="3"/>
<association xil_pn:name="Implementation" xil_pn:seqID="3"/>
</file>
<file xil_pn:name="../../rtl/sincos_gen_d24_p26.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="4"/>
<association xil_pn:name="Implementation" xil_pn:seqID="2"/>
</file>
<file xil_pn:name="../../rtl/sincos_gen.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="5"/>
<association xil_pn:name="Implementation" xil_pn:seqID="1"/>
</file>
<file xil_pn:name="../../rtl/test_sincos_serial.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="6"/>
<association xil_pn:name="Implementation" xil_pn:seqID="5"/>
</file>
<file xil_pn:name="ac97out.vhdl" xil_pn:type="FILE_VHDL">
<association xil_pn:name="BehavioralSimulation" xil_pn:seqID="56"/>
<association xil_pn:name="Implementation" xil_pn:seqID="4"/>
</file>
</files>
<properties>
<property xil_pn:name="AES Initial Vector spartan6" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="AES Key (Hex String) spartan6" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Add I/O Buffers" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Allow Logic Optimization Across Hierarchy" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Allow SelectMAP Pins to Persist" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Allow Unexpanded Blocks" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Allow Unmatched LOC Constraints" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Allow Unmatched Timing Group Constraints" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Analysis Effort Level" xil_pn:value="Standard" xil_pn:valueState="default"/>
<property xil_pn:name="Asynchronous To Synchronous" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Auto Implementation Compile Order" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Auto Implementation Top" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Automatic BRAM Packing" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Automatically Insert glbl Module in the Netlist" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Automatically Run Generate Target PROM/ACE File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="BRAM Utilization Ratio" xil_pn:value="100" xil_pn:valueState="default"/>
<property xil_pn:name="Bring Out Global Set/Reset Net as a Port" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Bring Out Global Tristate Net as a Port" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Bus Delimiter" xil_pn:value="&lt;>" xil_pn:valueState="default"/>
<property xil_pn:name="Case" xil_pn:value="Maintain" xil_pn:valueState="default"/>
<property xil_pn:name="Case Implementation Style" xil_pn:value="None" xil_pn:valueState="default"/>
<property xil_pn:name="Change Device Speed To" xil_pn:value="-3" xil_pn:valueState="default"/>
<property xil_pn:name="Change Device Speed To Post Trace" xil_pn:value="-3" xil_pn:valueState="default"/>
<property xil_pn:name="Combinatorial Logic Optimization" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Compile EDK Simulation Library" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Compile SIMPRIM (Timing) Simulation Library" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Compile UNISIM (Functional) Simulation Library" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Compile XilinxCoreLib (CORE Generator) Simulation Library" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Compile for HDL Debugging" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Clk (Configuration Pins)" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Pin Done" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Pin M0" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Pin M1" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Pin M2" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Pin Program" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Configuration Rate spartan6" xil_pn:value="6" xil_pn:valueState="non-default"/>
<property xil_pn:name="Correlate Output to Input Design" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create ASCII Configuration File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create Binary Configuration File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create Bit File" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Create I/O Pads from Ports" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create IEEE 1532 Configuration File spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create Logic Allocation File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create Mask File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Create ReadBack Data Files" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Cross Clock Analysis" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="DSP Utilization Ratio" xil_pn:value="100" xil_pn:valueState="default"/>
<property xil_pn:name="Delay Values To Be Read from SDF" xil_pn:value="Setup Time" xil_pn:valueState="default"/>
<property xil_pn:name="Device" xil_pn:value="xc6slx45" xil_pn:valueState="non-default"/>
<property xil_pn:name="Device Family" xil_pn:value="Spartan6" xil_pn:valueState="non-default"/>
<property xil_pn:name="Device Speed Grade/Select ABS Minimum" xil_pn:value="-3" xil_pn:valueState="default"/>
<property xil_pn:name="Disable Detailed Package Model Insertion" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Do Not Escape Signal and Instance Names in Netlist" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Done (Output Events)" xil_pn:value="Default (4)" xil_pn:valueState="default"/>
<property xil_pn:name="Drive Awake Pin During Suspend/Wake Sequence spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Drive Done Pin High" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable BitStream Compression" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Cyclic Redundancy Checking (CRC) spartan6" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Debugging of Serial Mode BitStream" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable External Master Clock spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Internal Done Pipe" xil_pn:value="true" xil_pn:valueState="non-default"/>
<property xil_pn:name="Enable Message Filtering" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Multi-Pin Wake-Up Suspend Mode spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Multi-Threading" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Multi-Threading par spartan6" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Outputs (Output Events)" xil_pn:value="Default (5)" xil_pn:valueState="default"/>
<property xil_pn:name="Enable Suspend/Wake Global Set/Reset spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Encrypt Bitstream spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Encrypt Key Select spartan6" xil_pn:value="BBRAM" xil_pn:valueState="default"/>
<property xil_pn:name="Equivalent Register Removal Map" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Equivalent Register Removal XST" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Essential Bits" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Evaluation Development Board" xil_pn:value="None Specified" xil_pn:valueState="default"/>
<property xil_pn:name="Exclude Compilation of Deprecated EDK Cores" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Exclude Compilation of EDK Sub-Libraries" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Extra Cost Tables Map" xil_pn:value="0" xil_pn:valueState="default"/>
<property xil_pn:name="Extra Effort (Highest PAR level only)" xil_pn:value="None" xil_pn:valueState="default"/>
<property xil_pn:name="FPGA Start-Up Clock" xil_pn:value="CCLK" xil_pn:valueState="default"/>
<property xil_pn:name="FSM Encoding Algorithm" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="FSM Style" xil_pn:value="LUT" xil_pn:valueState="default"/>
<property xil_pn:name="Filter Files From Compile Order" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Flatten Output Netlist" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Functional Model Target Language ArchWiz" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="Functional Model Target Language Coregen" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="Functional Model Target Language Schematic" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="GTS Cycle During Suspend/Wakeup Sequence spartan6" xil_pn:value="4" xil_pn:valueState="default"/>
<property xil_pn:name="GWE Cycle During Suspend/Wakeup Sequence spartan6" xil_pn:value="5" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Architecture Only (No Entity Declaration)" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Asynchronous Delay Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Clock Region Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Constraints Interaction Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Constraints Interaction Report Post Trace" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Datasheet Section" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Datasheet Section Post Trace" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Detailed MAP Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Multiple Hierarchical Netlist Files" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Post-Place &amp; Route Power Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Post-Place &amp; Route Simulation Model" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate RTL Schematic" xil_pn:value="Yes" xil_pn:valueState="default"/>
<property xil_pn:name="Generate SAIF File for Power Optimization/Estimation Par" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Testbench File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Timegroups Section" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generate Timegroups Section Post Trace" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Generics, Parameters" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Global Optimization Goal" xil_pn:value="AllClockNets" xil_pn:valueState="default"/>
<property xil_pn:name="Global Optimization map spartan6" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Global Set/Reset Port Name" xil_pn:value="GSR_PORT" xil_pn:valueState="default"/>
<property xil_pn:name="Global Tristate Port Name" xil_pn:value="GTS_PORT" xil_pn:valueState="default"/>
<property xil_pn:name="Hierarchy Separator" xil_pn:value="/" xil_pn:valueState="default"/>
<property xil_pn:name="ISim UUT Instance Name" xil_pn:value="UUT" xil_pn:valueState="default"/>
<property xil_pn:name="Ignore User Timing Constraints Map" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Ignore User Timing Constraints Par" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Implementation Top" xil_pn:value="Architecture|top_test_sincos|rtl" xil_pn:valueState="non-default"/>
<property xil_pn:name="Implementation Top File" xil_pn:value="top_test_sincos.vhdl" xil_pn:valueState="non-default"/>
<property xil_pn:name="Implementation Top Instance Path" xil_pn:value="/top_test_sincos" xil_pn:valueState="non-default"/>
<property xil_pn:name="Include 'uselib Directive in Verilog File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Include SIMPRIM Models in Verilog File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Include UNISIM Models in Verilog File" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Include sdf_annotate task in Verilog File" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Incremental Compilation" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Insert Buffers to Prevent Pulse Swallowing" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Instantiation Template Target Language Xps" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="JTAG Pin TCK" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="JTAG Pin TDI" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="JTAG Pin TDO" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="JTAG Pin TMS" xil_pn:value="Pull Up" xil_pn:valueState="default"/>
<property xil_pn:name="Keep Hierarchy" xil_pn:value="No" xil_pn:valueState="default"/>
<property xil_pn:name="LUT Combining Map" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="LUT Combining Xst" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Language" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="Last Applied Goal" xil_pn:value="Balanced" xil_pn:valueState="default"/>
<property xil_pn:name="Last Applied Strategy" xil_pn:value="Xilinx Default (unlocked)" xil_pn:valueState="default"/>
<property xil_pn:name="Last Unlock Status" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Launch SDK after Export" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Library for Verilog Sources" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Load glbl" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Manual Implementation Compile Order" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Map Slice Logic into Unused Block RAMs" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Mask Pins for Multi-Pin Wake-Up Suspend Mode spartan6" xil_pn:value="0x00" xil_pn:valueState="default"/>
<property xil_pn:name="Max Fanout" xil_pn:value="100000" xil_pn:valueState="default"/>
<property xil_pn:name="Maximum Compression" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Maximum Number of Lines in Report" xil_pn:value="1000" xil_pn:valueState="default"/>
<property xil_pn:name="Maximum Signal Name Length" xil_pn:value="20" xil_pn:valueState="default"/>
<property xil_pn:name="Move First Flip-Flop Stage" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Move Last Flip-Flop Stage" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: Insert IPROG CMD in the Bitfile spartan6" xil_pn:value="Enable" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: Next Configuration Mode spartan6" xil_pn:value="001" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: Starting Address for Golden Configuration spartan6" xil_pn:value="0x00000000" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: Starting Address for Next Configuration spartan6" xil_pn:value="0x00000000" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: Use New Mode for Next Configuration spartan6" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="MultiBoot: User-Defined Register for Failsafe Scheme spartan6" xil_pn:value="0x0000" xil_pn:valueState="default"/>
<property xil_pn:name="Netlist Hierarchy" xil_pn:value="As Optimized" xil_pn:valueState="default"/>
<property xil_pn:name="Netlist Translation Type" xil_pn:value="Timestamp" xil_pn:valueState="default"/>
<property xil_pn:name="Number of Clock Buffers" xil_pn:value="16" xil_pn:valueState="default"/>
<property xil_pn:name="Number of Paths in Error/Verbose Report" xil_pn:value="3" xil_pn:valueState="default"/>
<property xil_pn:name="Number of Paths in Error/Verbose Report Post Trace" xil_pn:value="3" xil_pn:valueState="default"/>
<property xil_pn:name="Optimization Effort spartan6" xil_pn:value="Normal" xil_pn:valueState="default"/>
<property xil_pn:name="Optimization Goal" xil_pn:value="Speed" xil_pn:valueState="default"/>
<property xil_pn:name="Optimize Instantiated Primitives" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Other Bitgen Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Bitgen Command Line Options spartan6" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Compiler Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Compiler Options Map" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Compiler Options Par" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Compiler Options Translate" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Compxlib Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Map Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other NETGEN Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Ngdbuild Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Place &amp; Route Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Simulator Commands Behavioral" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Simulator Commands Post-Map" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Simulator Commands Post-Route" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other Simulator Commands Post-Translate" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other XPWR Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Other XST Command Line Options" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Output Extended Identifiers" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Output File Name" xil_pn:value="top_test_sincos" xil_pn:valueState="default"/>
<property xil_pn:name="Overwrite Compiled Libraries" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Pack I/O Registers into IOBs" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Pack I/O Registers/Latches into IOBs" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Package" xil_pn:value="csg324" xil_pn:valueState="non-default"/>
<property xil_pn:name="Perform Advanced Analysis" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Perform Advanced Analysis Post Trace" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Perform Timing-Driven Packing and Placement" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Place &amp; Route Effort Level (Overall)" xil_pn:value="High" xil_pn:valueState="default"/>
<property xil_pn:name="Place And Route Mode" xil_pn:value="Normal Place and Route" xil_pn:valueState="default"/>
<property xil_pn:name="Place MultiBoot Settings into Bitstream spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Placer Effort Level Map" xil_pn:value="High" xil_pn:valueState="default"/>
<property xil_pn:name="Placer Extra Effort Map" xil_pn:value="None" xil_pn:valueState="default"/>
<property xil_pn:name="Port to be used" xil_pn:value="Auto - default" xil_pn:valueState="default"/>
<property xil_pn:name="Post Map Simulation Model Name" xil_pn:value="top_test_sincos_map.vhd" xil_pn:valueState="default"/>
<property xil_pn:name="Post Place &amp; Route Simulation Model Name" xil_pn:value="top_test_sincos_timesim.vhd" xil_pn:valueState="default"/>
<property xil_pn:name="Post Synthesis Simulation Model Name" xil_pn:value="top_test_sincos_synthesis.vhd" xil_pn:valueState="default"/>
<property xil_pn:name="Post Translate Simulation Model Name" xil_pn:value="top_test_sincos_translate.vhd" xil_pn:valueState="default"/>
<property xil_pn:name="Power Reduction Map spartan6" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Power Reduction Par" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Power Reduction Xst" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Preferred Language" xil_pn:value="VHDL" xil_pn:valueState="non-default"/>
<property xil_pn:name="Produce Verbose Report" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Project Description" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Project Generator" xil_pn:value="ProjNav" xil_pn:valueState="default"/>
<property xil_pn:name="Property Specification in Project File" xil_pn:value="Store all values" xil_pn:valueState="default"/>
<property xil_pn:name="RAM Extraction" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="RAM Style" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="ROM Extraction" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="ROM Style" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Read Cores" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Reduce Control Sets" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Regenerate Core" xil_pn:value="Under Current Project Setting" xil_pn:valueState="default"/>
<property xil_pn:name="Register Balancing" xil_pn:value="No" xil_pn:valueState="default"/>
<property xil_pn:name="Register Duplication Map" xil_pn:value="Off" xil_pn:valueState="default"/>
<property xil_pn:name="Register Duplication Xst" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Register Ordering spartan6" xil_pn:value="4" xil_pn:valueState="default"/>
<property xil_pn:name="Release Write Enable (Output Events)" xil_pn:value="Default (6)" xil_pn:valueState="default"/>
<property xil_pn:name="Rename Design Instance in Testbench File to" xil_pn:value="UUT" xil_pn:valueState="default"/>
<property xil_pn:name="Rename Top Level Architecture To" xil_pn:value="Structure" xil_pn:valueState="default"/>
<property xil_pn:name="Rename Top Level Entity to" xil_pn:value="top_test_sincos" xil_pn:valueState="default"/>
<property xil_pn:name="Rename Top Level Module To" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Report Fastest Path(s) in Each Constraint" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Report Fastest Path(s) in Each Constraint Post Trace" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Report Paths by Endpoint" xil_pn:value="3" xil_pn:valueState="default"/>
<property xil_pn:name="Report Paths by Endpoint Post Trace" xil_pn:value="3" xil_pn:valueState="default"/>
<property xil_pn:name="Report Type" xil_pn:value="Verbose Report" xil_pn:valueState="default"/>
<property xil_pn:name="Report Type Post Trace" xil_pn:value="Verbose Report" xil_pn:valueState="default"/>
<property xil_pn:name="Report Unconstrained Paths" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Report Unconstrained Paths Post Trace" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Reset On Configuration Pulse Width" xil_pn:value="100" xil_pn:valueState="default"/>
<property xil_pn:name="Resource Sharing" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Retain Hierarchy" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Retry Configuration if CRC Error Occurs spartan6" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Revision Select" xil_pn:value="00" xil_pn:valueState="default"/>
<property xil_pn:name="Revision Select Tristate" xil_pn:value="Disable" xil_pn:valueState="default"/>
<property xil_pn:name="Run Design Rules Checker (DRC)" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Run for Specified Time" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Run for Specified Time Map" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Run for Specified Time Par" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Run for Specified Time Translate" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Safe Implementation" xil_pn:value="No" xil_pn:valueState="default"/>
<property xil_pn:name="Security" xil_pn:value="Enable Readback and Reconfiguration" xil_pn:valueState="default"/>
<property xil_pn:name="Selected Simulation Root Source Node Behavioral" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Selected Simulation Root Source Node Post-Map" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Selected Simulation Root Source Node Post-Route" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Selected Simulation Root Source Node Post-Translate" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Selected Simulation Source Node" xil_pn:value="UUT" xil_pn:valueState="default"/>
<property xil_pn:name="Set SPI Configuration Bus Width spartan6" xil_pn:value="1" xil_pn:valueState="default"/>
<property xil_pn:name="Setup External Master Clock Division spartan6" xil_pn:value="1" xil_pn:valueState="default"/>
<property xil_pn:name="Shift Register Extraction" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Shift Register Minimum Size spartan6" xil_pn:value="2" xil_pn:valueState="default"/>
<property xil_pn:name="Show All Models" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Simulation Model Target" xil_pn:value="VHDL" xil_pn:valueState="default"/>
<property xil_pn:name="Simulation Run Time ISim" xil_pn:value="1000 ns" xil_pn:valueState="default"/>
<property xil_pn:name="Simulation Run Time Map" xil_pn:value="1000 ns" xil_pn:valueState="default"/>
<property xil_pn:name="Simulation Run Time Par" xil_pn:value="1000 ns" xil_pn:valueState="default"/>
<property xil_pn:name="Simulation Run Time Translate" xil_pn:value="1000 ns" xil_pn:valueState="default"/>
<property xil_pn:name="Simulator" xil_pn:value="ISim (VHDL/Verilog)" xil_pn:valueState="default"/>
<property xil_pn:name="Slice Utilization Ratio" xil_pn:value="100" xil_pn:valueState="default"/>
<property xil_pn:name="Specify 'define Macro Name and Value" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Specify Top Level Instance Names Behavioral" xil_pn:value="Default" xil_pn:valueState="default"/>
<property xil_pn:name="Specify Top Level Instance Names Post-Map" xil_pn:value="Default" xil_pn:valueState="default"/>
<property xil_pn:name="Specify Top Level Instance Names Post-Route" xil_pn:value="Default" xil_pn:valueState="default"/>
<property xil_pn:name="Specify Top Level Instance Names Post-Translate" xil_pn:value="Default" xil_pn:valueState="default"/>
<property xil_pn:name="Speed Grade" xil_pn:value="-3" xil_pn:valueState="default"/>
<property xil_pn:name="Starting Placer Cost Table (1-100) Map spartan6" xil_pn:value="1" xil_pn:valueState="default"/>
<property xil_pn:name="Synthesis Tool" xil_pn:value="XST (VHDL/Verilog)" xil_pn:valueState="default"/>
<property xil_pn:name="Target Simulator" xil_pn:value="Please Specify" xil_pn:valueState="default"/>
<property xil_pn:name="Timing Mode Map" xil_pn:value="Performance Evaluation" xil_pn:valueState="default"/>
<property xil_pn:name="Timing Mode Par" xil_pn:value="Performance Evaluation" xil_pn:valueState="default"/>
<property xil_pn:name="Top-Level Module Name in Output Netlist" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Top-Level Source Type" xil_pn:value="HDL" xil_pn:valueState="default"/>
<property xil_pn:name="Trim Unconnected Signals" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Tristate On Configuration Pulse Width" xil_pn:value="0" xil_pn:valueState="default"/>
<property xil_pn:name="Unused IOB Pins" xil_pn:value="Pull Down" xil_pn:valueState="default"/>
<property xil_pn:name="Use 64-bit PlanAhead on 64-bit Systems" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Use Clock Enable" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Project File Behavioral" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Project File Post-Map" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Project File Post-Route" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Project File Post-Translate" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Simulation Command File Behavioral" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Simulation Command File Map" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Simulation Command File Par" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Simulation Command File Translate" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Waveform Configuration File Behav" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Waveform Configuration File Map" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Waveform Configuration File Par" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Custom Waveform Configuration File Translate" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use DSP Block spartan6" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Use LOC Constraints" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="Use RLOC Constraints" xil_pn:value="Yes" xil_pn:valueState="default"/>
<property xil_pn:name="Use Smart Guide" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Use Synchronous Reset" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Use Synchronous Set" xil_pn:value="Auto" xil_pn:valueState="default"/>
<property xil_pn:name="Use Synthesis Constraints File" xil_pn:value="true" xil_pn:valueState="default"/>
<property xil_pn:name="User Browsed Strategy Files" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="UserID Code (8 Digit Hexadecimal)" xil_pn:value="0xFFFFFFFF" xil_pn:valueState="default"/>
<property xil_pn:name="VCCAUX Voltage Level spartan6" xil_pn:value="2.5V" xil_pn:valueState="default"/>
<property xil_pn:name="VHDL Source Analysis Standard" xil_pn:value="VHDL-93" xil_pn:valueState="default"/>
<property xil_pn:name="Value Range Check" xil_pn:value="false" xil_pn:valueState="default"/>
<property xil_pn:name="Verilog Macros" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="Wait for DCM and PLL Lock (Output Events) spartan6" xil_pn:value="Default (NoWait)" xil_pn:valueState="default"/>
<property xil_pn:name="Wakeup Clock spartan6" xil_pn:value="Startup Clock" xil_pn:valueState="default"/>
<property xil_pn:name="Watchdog Timer Value spartan6" xil_pn:value="0xFFFF" xil_pn:valueState="default"/>
<property xil_pn:name="Working Directory" xil_pn:value="." xil_pn:valueState="non-default"/>
<property xil_pn:name="Write Timing Constraints" xil_pn:value="false" xil_pn:valueState="default"/>
<!-- -->
<!-- The following properties are for internal use only. These should not be modified.-->
<!-- -->
<property xil_pn:name="PROP_BehavioralSimTop" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_DesignName" xil_pn:value="test_sincos" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_DevFamilyPMName" xil_pn:value="spartan6" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_FPGAConfiguration" xil_pn:value="FPGAConfiguration" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_PostMapSimTop" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_PostParSimTop" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_PostSynthSimTop" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_PostXlateSimTop" xil_pn:value="" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_PreSynthesis" xil_pn:value="PreSynthesis" xil_pn:valueState="default"/>
<property xil_pn:name="PROP_intProjectCreationTimestamp" xil_pn:value="2016-04-22T09:32:27" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWbtProjectID" xil_pn:value="C74D62BE7C3BCC31C4F4E8997CE0C58D" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWorkingDirLocWRTProjDir" xil_pn:value="Same" xil_pn:valueState="non-default"/>
<property xil_pn:name="PROP_intWorkingDirUsed" xil_pn:value="No" xil_pn:valueState="non-default"/>
</properties>
<bindings/>
<libraries/>
<autoManagedFiles>
<!-- The following files are identified by `include statements in verilog -->
<!-- source files and are automatically managed by Project Navigator. -->
<!-- -->
<!-- Do not hand-edit this section, as it will be overwritten when the -->
<!-- project is analyzed based on files automatically identified as -->
<!-- include files. -->
</autoManagedFiles>
</project>

View File

@ -0,0 +1,171 @@
--
-- Test sine / cosine function core on Digilent Atlys board.
--
--
-- Serial port protocol (via USB):
--
-- * Baud rate 115200
--
-- * Send 6 bytes
-- { 0x41 0x42 phase(7:0) phase(15:8) phase(23:16) phase(31:24) }
-- to calculate sine and cosine of phase on the 18-bit / 20-bit core.
-- Board answers with 8 bytes
-- { sin(7:0) sin(15:8) sin(23:16) sin(31:24)
-- cos(7:0) cos(15:8) cos(23:16) cos(31:24 }
--
-- * Send 6 bytes
-- { 0x41 0x43 phase(7:0) phase(15:8) phase(23:16) phase(31:24) }
-- to calculate sine and cosine of phase on the 24-bit / 26-bit core.
-- Board answers with 8 bytes
-- { sin(7:0) sin(15:8) sin(23:16) sin(31:24)
-- cos(7:0) cos(15:8) cos(23:16) cos(31:24 }
--
-- * Send 2 bytes { 0x41 0x44 } to start clock-enable modulation.
--
-- * Send 3 bytes { 0x41 0x45 } to stop clock-enable modulation.
--
-- Status LEDs:
-- LED 0 = Ready (waiting for command)
-- LED 1 = Calculating
-- LED 2 = Clock-enable modulation active
-- LED 3 = Transmitting
--
-- AC97 audio:
-- 999.985 Hz sine wave on output
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity top_test_sincos is
port (
-- 100 MHz system clock
clk: in std_logic;
-- Reset button
resetn: in std_logic;
-- Status LEDs
led: out std_logic_vector(7 downto 0);
-- Uart
uartrx: in std_logic;
uarttx: out std_logic;
-- AC97 audio
ac97_bitclk: in std_logic;
ac97_sdi: in std_logic;
ac97_sdo: out std_logic;
ac97_sync: out std_logic;
ac97_rst: out std_logic );
end entity;
architecture rtl of top_test_sincos is
-- Frequency is 21845 / 2**20 * 48000 Hz = 999.985 Hz
constant tone_freq: integer := 21845;
signal r_rstgen: std_logic_vector(7 downto 0) := "00000000";
signal r_reset: std_logic;
signal r_ac97_rstcnt: unsigned(7 downto 0);
signal r_ac97_rst: std_logic;
signal r_ac97_phase: unsigned(19 downto 0);
signal s_ac97_sine: signed(17 downto 0);
signal s_ac97_dataleft: signed(19 downto 0);
signal s_ac97_dataright: signed(19 downto 0);
signal s_ac97_ready: std_logic;
begin
-- Instantiate test design with serial interface.
u0: entity work.test_sincos_serial
generic map (
serial_bitrate_divider => 868 )
port map (
clk => clk,
rst => r_reset,
ser_rx => uartrx,
ser_tx => uarttx,
stat_ready => led(0),
stat_calc => led(1),
stat_clkmod => led(2),
stat_txser => led(3) );
-- Instantiate sine generator for AC97 output.
u1: entity work.sincos_gen_d18_p20
port map (
clk => ac97_bitclk,
clk_en => '1',
in_phase => r_ac97_phase,
out_sin => s_ac97_sine,
out_cos => open );
-- Instantiate AC97 output
u2: entity work.ac97out
port map (
bitclk => ac97_bitclk,
resetn => r_ac97_rst,
data_left => s_ac97_dataleft,
data_right => s_ac97_dataright,
data_valid => '1',
data_ready => s_ac97_ready,
ac97_sdi => ac97_sdi,
ac97_sdo => ac97_sdo,
ac97_sync => ac97_sync );
-- Pad 18-bit signed samples to 20-bit.
s_ac97_dataleft <= s_ac97_sine & "00";
s_ac97_dataright <= s_ac97_sine & "00";
-- Drive unused LEDs.
led(7 downto 4) <= "0000";
-- Drive AC97 reset pin.
ac97_rst <= r_ac97_rst;
-- Reset synchronizer.
process (clk) is
begin
if rising_edge(clk) then
if resetn = '0' then
r_rstgen <= (others => '0');
r_reset <= '1';
else
r_rstgen <= "1" & r_rstgen(7 downto 1);
r_reset <= not r_rstgen(0);
end if;
end if;
end process;
-- Reset generator for AC97 codec.
process (clk) is
begin
if rising_edge(clk) then
if r_reset = '1' then
r_ac97_rstcnt <= (others => '1');
r_ac97_rst <= '0';
else
r_ac97_rstcnt <= r_ac97_rstcnt - 1;
if r_ac97_rstcnt = 0 then
r_ac97_rst <= '1';
end if;
end if;
end if;
end process;
-- Synchronous process in AC97 bitclock domain.
process (ac97_bitclk) is
begin
if rising_edge(ac97_bitclk) then
if s_ac97_ready = '1' then
r_ac97_phase <= r_ac97_phase + tone_freq;
end if;
end if;
end process;
end architecture;

131
tools/test_sincos_serial.py Normal file
View File

@ -0,0 +1,131 @@
#!/usr/bin/python
"""
Test sine/cosine core via serial port.
Sends a series of commands to the test driver via the serial port
and verifies answers.
Usage:
python test_sincos_serial.py /dev/ttyUSB0
"""
from __future__ import print_function
import sys
import numpy
import serial
import struct
def testPhase(dev, coresel, databits, phasebits, phase):
print("\r phase=%-10d" % phase, end='')
sys.stdout.flush()
dev.write(struct.pack("<BBI", 0x41, 0x42 + coresel, phase))
reply = dev.read(8)
if len(reply) != 8:
print()
print("ERROR: got %d bytes from serial port while expecting 8" %
len(reply))
return
(vsin, vcos) = struct.unpack("<ii", reply)
ampl = (1 << (databits - 1)) - 1
theta = 2 * numpy.pi * phase / 2.0**phasebits
refsin = ampl * numpy.sin(theta)
refcos = ampl * numpy.cos(theta)
if abs(vsin - refsin) > 1.5 or abs(vcos - refcos) > 1.5:
print()
print("phase=%d sin=%d cos=%d refsin=%.2f refcos=%.2f" %
(phase, vsin, vcos, refsin, refcos))
print("ERROR: wrong answer")
def testCore(dev, clkmod, coresel, databits, phasebits):
if clkmod:
# Start clock-enable modulation.
dev.write("AD")
else:
# Stop clock-enable modulation.
dev.write("AE")
print("test least significant phase bits")
for p in range(64):
phase = p
testPhase(dev, coresel, databits, phasebits, phase)
print()
print("test most significant phase bits")
for p in range(64):
phase = p << (phasebits - 6)
testPhase(dev, coresel, databits, phasebits, phase)
print()
print("test pseudorandom phase values")
phase = 0
for i in range(5000):
phase = (phase + 123457) & ((1 << phasebits) - 1)
testPhase(dev, coresel, databits, phasebits, phase)
print()
def main():
if len(sys.argv) != 2:
print(__doc__, file=sys.stderr)
print("ERROR: Invalid/missing command line arguments", file=sys.stderr)
sys.exit(1)
devname = sys.argv[1]
# Open serial port.
print("opening serial port", devname)
dev = serial.Serial(port=devname,
baudrate=115200,
bytesize=8,
parity='N',
stopbits=1,
timeout=1)
# Flush input.
print("flush serial port buffer")
dev.flushInput()
dev.flushOutput()
dev.read(1000)
# Write series of Z to force test driver to idle state.
dev.write("ZZZZZZZZ")
print()
print('Test 18-bit data, 20-bit phase core')
testCore(dev, 0, 0, 18, 20)
print()
print('Test 24-bit data, 26-bit phase core')
testCore(dev, 0, 1, 24, 26)
print()
print('Test 18-bit data, 20-bit phase core with clock-enable modulation')
testCore(dev, 1, 0, 18, 20)
print()
print('Test 24-bit data, 26-bit phase core with clock-enable modulation')
testCore(dev, 1, 1, 24, 26)
print()
# Close serial port.
dev.close()
print("done")
if __name__ == '__main__':
main()