From 468275ed05978ca2525e8f6a0395abe221f43ff3 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Mon, 30 Apr 2018 09:08:47 +0200 Subject: [PATCH] Add display driver --- .gitignore | 1 + README.MD | 4 + display/avr/.gitignore | 2 + display/avr/Makefile | 20 + display/avr/main.c | 73 + display/fpga/.gitignore | 9 + display/fpga/.project | 45 + display/fpga/bench/bench_top.vhd | 120 + display/fpga/design/lmg6202.vhd | 189 ++ display/fpga/design/spi_if.vhd | 165 ++ display/fpga/design/top.vhd | 170 ++ display/fpga/diamond/lmg6202.ldf | 29 + display/fpga/diamond/lmg6202.lpf | 33 + display/fpga/diamond/lmg62021.sty | 205 ++ display/fpga/generics/ram.vhd | 74 + display/fpga/generics/synchronizer.vhd | 33 + display/fpga/gtkwave/bench_top.gtkw | 77 + display/fpga/ip/gram0/._Real_._Math_.vhd | 2574 ++++++++++++++++++++++ display/fpga/ip/gram0/generate_core.tcl | 100 + display/fpga/ip/gram0/generate_ngd.tcl | 74 + display/fpga/ip/gram0/gram0.cst | 3 + display/fpga/ip/gram0/gram0.edn | 2420 ++++++++++++++++++++ display/fpga/ip/gram0/gram0.ipx | 10 + display/fpga/ip/gram0/gram0.jhd | 87 + display/fpga/ip/gram0/gram0.lpc | 56 + display/fpga/ip/gram0/gram0.naf | 70 + display/fpga/ip/gram0/gram0.sort | 1 + display/fpga/ip/gram0/gram0.srp | 35 + display/fpga/ip/gram0/gram0.sym | Bin 0 -> 586 bytes display/fpga/ip/gram0/gram0.vhd | 943 ++++++++ display/fpga/ip/gram0/gram0_generate.log | 49 + display/fpga/ip/gram0/gram0_tmpl.vhd | 23 + display/fpga/ip/gram0/msg_file.log | 34 + display/fpga/ip/gram0/tb_gram0_tmpl.vhd | 178 ++ display/fpga/ip/pll0/._Real_._Math_.vhd | 2574 ++++++++++++++++++++++ display/fpga/ip/pll0/generate_core.tcl | 100 + display/fpga/ip/pll0/generate_ngd.tcl | 115 + display/fpga/ip/pll0/msg_file.log | 29 + display/fpga/ip/pll0/pll0.cst | 3 + display/fpga/ip/pll0/pll0.edn | 300 +++ display/fpga/ip/pll0/pll0.jhd | 5 + display/fpga/ip/pll0/pll0.lpc | 87 + display/fpga/ip/pll0/pll0.naf | 3 + display/fpga/ip/pll0/pll0.sort | 1 + display/fpga/ip/pll0/pll0.srp | 26 + display/fpga/ip/pll0/pll0.sym | Bin 0 -> 182 bytes display/fpga/ip/pll0/pll0.vhd | 154 ++ display/fpga/ip/pll0/pll0_generate.log | 44 + display/fpga/ip/pll0/pll0_tmpl.vhd | 13 + display/fpga/sim_ip/gram0.vhd | 45 + display/fpga/sim_ip/pll0.vhd | 24 + display/kernel-driver/.gitignore | 6 + display/kernel-driver/Makefile | 14 + display/kernel-driver/lmg6202ulyt.c | 364 +++ display/kernel-driver/lmg6202ulyt.pro | 9 + display/tools/.gitignore | 3 + display/tools/mkimage.py | 38 + display/tools/mkraw.py | 20 + display/userspace-driver/.gitignore | 2 + display/userspace-driver/loop.sh | 9 + display/userspace-driver/main.c | 176 ++ 61 files changed, 12070 insertions(+) create mode 100644 .gitignore create mode 100644 README.MD create mode 100644 display/avr/.gitignore create mode 100644 display/avr/Makefile create mode 100644 display/avr/main.c create mode 100644 display/fpga/.gitignore create mode 100644 display/fpga/.project create mode 100644 display/fpga/bench/bench_top.vhd create mode 100644 display/fpga/design/lmg6202.vhd create mode 100644 display/fpga/design/spi_if.vhd create mode 100644 display/fpga/design/top.vhd create mode 100644 display/fpga/diamond/lmg6202.ldf create mode 100644 display/fpga/diamond/lmg6202.lpf create mode 100644 display/fpga/diamond/lmg62021.sty create mode 100644 display/fpga/generics/ram.vhd create mode 100644 display/fpga/generics/synchronizer.vhd create mode 100644 display/fpga/gtkwave/bench_top.gtkw create mode 100644 display/fpga/ip/gram0/._Real_._Math_.vhd create mode 100644 display/fpga/ip/gram0/generate_core.tcl create mode 100644 display/fpga/ip/gram0/generate_ngd.tcl create mode 100644 display/fpga/ip/gram0/gram0.cst create mode 100644 display/fpga/ip/gram0/gram0.edn create mode 100644 display/fpga/ip/gram0/gram0.ipx create mode 100644 display/fpga/ip/gram0/gram0.jhd create mode 100644 display/fpga/ip/gram0/gram0.lpc create mode 100644 display/fpga/ip/gram0/gram0.naf create mode 100644 display/fpga/ip/gram0/gram0.sort create mode 100644 display/fpga/ip/gram0/gram0.srp create mode 100644 display/fpga/ip/gram0/gram0.sym create mode 100644 display/fpga/ip/gram0/gram0.vhd create mode 100644 display/fpga/ip/gram0/gram0_generate.log create mode 100644 display/fpga/ip/gram0/gram0_tmpl.vhd create mode 100644 display/fpga/ip/gram0/msg_file.log create mode 100644 display/fpga/ip/gram0/tb_gram0_tmpl.vhd create mode 100644 display/fpga/ip/pll0/._Real_._Math_.vhd create mode 100644 display/fpga/ip/pll0/generate_core.tcl create mode 100644 display/fpga/ip/pll0/generate_ngd.tcl create mode 100644 display/fpga/ip/pll0/msg_file.log create mode 100644 display/fpga/ip/pll0/pll0.cst create mode 100644 display/fpga/ip/pll0/pll0.edn create mode 100644 display/fpga/ip/pll0/pll0.jhd create mode 100644 display/fpga/ip/pll0/pll0.lpc create mode 100644 display/fpga/ip/pll0/pll0.naf create mode 100644 display/fpga/ip/pll0/pll0.sort create mode 100644 display/fpga/ip/pll0/pll0.srp create mode 100644 display/fpga/ip/pll0/pll0.sym create mode 100644 display/fpga/ip/pll0/pll0.vhd create mode 100644 display/fpga/ip/pll0/pll0_generate.log create mode 100644 display/fpga/ip/pll0/pll0_tmpl.vhd create mode 100644 display/fpga/sim_ip/gram0.vhd create mode 100644 display/fpga/sim_ip/pll0.vhd create mode 100644 display/kernel-driver/.gitignore create mode 100644 display/kernel-driver/Makefile create mode 100644 display/kernel-driver/lmg6202ulyt.c create mode 100644 display/kernel-driver/lmg6202ulyt.pro create mode 100644 display/tools/.gitignore create mode 100755 display/tools/mkimage.py create mode 100755 display/tools/mkraw.py create mode 100644 display/userspace-driver/.gitignore create mode 100755 display/userspace-driver/loop.sh create mode 100755 display/userspace-driver/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e695ec --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +doc diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..b8ab1d8 --- /dev/null +++ b/README.MD @@ -0,0 +1,4 @@ +# Brother LW-35 Modernization +Drivers, firmware and tools used in my LW-35 electronic typewriter modernization. + +Documentation coming soon-ish. diff --git a/display/avr/.gitignore b/display/avr/.gitignore new file mode 100644 index 0000000..f2fa7a1 --- /dev/null +++ b/display/avr/.gitignore @@ -0,0 +1,2 @@ +*.hex +*.o diff --git a/display/avr/Makefile b/display/avr/Makefile new file mode 100644 index 0000000..25b9768 --- /dev/null +++ b/display/avr/Makefile @@ -0,0 +1,20 @@ +MCU=atmega328p +CFLAGS=-g -Wall -mcall-prologues -mmcu=$(MCU) -Os -DF_CPU=16000000 +LDFLAGS=-Wl,-gc-sections -Wl,-relax +CC=avr-gcc +TARGET=main +OBJECT_FILES=main.o + +all: $(TARGET).hex + +clean: + rm -f *.o *.hex *.obj *.hex + +%.hex: %.obj + avr-objcopy -R .eeprom -O ihex $< $@ + +%.obj: $(OBJECT_FILES) + $(CC) $(CFLAGS) $(OBJECT_FILES) $(LDFLAGS) -o $@ + +program: $(TARGET).hex + avrdude -p $(MCU) -P /dev/ttyUSB1 -c arduino -b 57600 -U flash:w:$(TARGET).hex diff --git a/display/avr/main.c b/display/avr/main.c new file mode 100644 index 0000000..f7c7778 --- /dev/null +++ b/display/avr/main.c @@ -0,0 +1,73 @@ +#include +#include +#include + +#define LMG6202_DATA_PORT PORTD +#define LMG6202_CONTROL_PORT PORTD + +#define LMG6202_PIN_CP (1 << 4) +#define LMG6202_PIN_LD (1 << 5) +#define LMG6202_PIN_DR (1 << 6) +#define LMG6202_PIN_DF (1 << 7) + +int main() +{ + int i; + int col = 0; + uint16_t it = 0; + + UCSR0B = 0x00; + DDRD = 0xff; + PORTD = 0xff; + + _delay_ms(500); + + while (1) { + // VSYNC pulse + if (col == 1) { + LMG6202_CONTROL_PORT |= LMG6202_PIN_DR; + LMG6202_CONTROL_PORT ^= LMG6202_PIN_DF; +// _delay_us(1); + } else { + LMG6202_CONTROL_PORT &= ~LMG6202_PIN_DR; + } + + // Latch data + LMG6202_CONTROL_PORT |= LMG6202_PIN_LD; + asm("nop");asm("nop");asm("nop"); + LMG6202_CONTROL_PORT &= ~LMG6202_PIN_LD; + + //LMG6202_CONTROL_PORT ^= LMG6202_PIN_DF; + _delay_us(1); + + for (i = 0; i < 120; ++i) { + LMG6202_CONTROL_PORT |= LMG6202_PIN_CP; + + if (it > 2500 && i > 60) { + //if (i == 0) { + LMG6202_DATA_PORT |= 15; + //} + } else { + LMG6202_DATA_PORT &= ~(15); + } + + //asm("nop"); + LMG6202_CONTROL_PORT &= ~LMG6202_PIN_CP; + asm("nop"); + } + + LMG6202_DATA_PORT &= ~(15); +// LMG6202_CONTROL_PORT &= ~LMG6202_PIN_DR; + + if (col == 127) { + col = 0; + } else { + col++; + } + if (it==5000) { + it = 0; + } else { + it++; + } + } +} diff --git a/display/fpga/.gitignore b/display/fpga/.gitignore new file mode 100644 index 0000000..877b444 --- /dev/null +++ b/display/fpga/.gitignore @@ -0,0 +1,9 @@ +.settings +diamond/impl1/ +*_tcr.dir +*.html +*.xml +*.ccl +*.ini +.recovery +*.log diff --git a/display/fpga/.project b/display/fpga/.project new file mode 100644 index 0000000..c12194b --- /dev/null +++ b/display/fpga/.project @@ -0,0 +1,45 @@ + + + lmg6202 + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + com.sigasi.hdt.vhdl.ui.vhdlNature + org.eclipse.xtext.ui.shared.xtextNature + + + + Common Libraries + 2 + virtual:/virtual + + + Common Libraries/DRAG_REUSABLE_LIBRARIES_HERE.txt + 1 + sigasiresource:/vhdl/readme.txt + + + Common Libraries/IEEE + 2 + sigasiresource:/vhdl/93/IEEE + + + Common Libraries/IEEE Synopsys + 2 + sigasiresource:/vhdl/93/IEEE%20Synopsys + + + Common Libraries/STD + 2 + sigasiresource:/vhdl/93/STD + + + diff --git a/display/fpga/bench/bench_top.vhd b/display/fpga/bench/bench_top.vhd new file mode 100644 index 0000000..97544c6 --- /dev/null +++ b/display/fpga/bench/bench_top.vhd @@ -0,0 +1,120 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library design; +use design.all; + +entity bench_top is +end entity bench_top; + +architecture RTL of bench_top is + signal clk : std_logic; + signal rst_hw : std_logic; + + signal lcd_data : std_logic_vector(3 downto 0); + signal lcd_clp : std_logic; + signal lcd_load : std_logic; + signal lcd_frp : std_logic; + signal lcd_frmb : std_logic; + + signal spi_cs_n : std_logic; + signal spi_sck : std_logic; + signal spi_mosi : std_logic; + signal spi_miso : std_logic; + +begin + top_inst : entity design.top + port map( + spi_cs_n => spi_cs_n, + spi_sck => spi_sck, + spi_mosi => spi_mosi, + spi_miso => spi_miso, + clk_hw => clk, + rst_hw => rst_hw, + lcd_data => lcd_data, + lcd_clp => lcd_clp, + lcd_load => lcd_load, + lcd_frp => lcd_frp, + lcd_frmb => lcd_frmb + ); + + clock_driver : process + constant period : time := (1 sec / 24000000); + begin + clk <= '0'; + wait for period / 2; + clk <= '1'; + wait for period / 2; + end process clock_driver; + + test : process is + begin + rst_hw <= '0'; + wait for 100 ns; + rst_hw <= '1'; + wait; + end process test; + + spitest : process is + constant CPOL : std_logic := '0'; + constant DEL : time := 400 ns; + + procedure send_byte(data : std_logic_vector(7 downto 0)) is + + begin + for i in 7 downto 0 loop + spi_sck <= CPOL; + wait for DEL; + spi_mosi <= data(i); + spi_sck <= not CPOL; + wait for DEL; + end loop; + end procedure send_byte; + + begin + spi_cs_n <= '1'; + spi_sck <= '0'; + spi_mosi <= CPOL; + + wait until rst_hw = '1'; + wait until rising_edge(clk); + wait until rising_edge(clk); + wait until rising_edge(clk); + wait until rising_edge(clk); + wait until rising_edge(clk); + spi_cs_n <= '0'; + wait for 400 ns; + send_byte(x"00"); + send_byte(x"00"); + send_byte(x"00"); + + send_byte(x"AB"); + send_byte(x"CD"); + send_byte(x"55"); + send_byte(x"AA"); + send_byte(x"81"); + + send_byte(x"2A"); + send_byte(x"AB"); + send_byte(x"BC"); + send_byte(x"CF"); + + send_byte(x"AB"); + send_byte(x"CD"); + send_byte(x"55"); + send_byte(x"AA"); + send_byte(x"81"); + + send_byte(x"2A"); + send_byte(x"AB"); + send_byte(x"BC"); + send_byte(x"CF"); + + spi_cs_n <= '1'; + + wait; + end process spitest; + + +end architecture RTL; diff --git a/display/fpga/design/lmg6202.vhd b/display/fpga/design/lmg6202.vhd new file mode 100644 index 0000000..2b8adb6 --- /dev/null +++ b/display/fpga/design/lmg6202.vhd @@ -0,0 +1,189 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library ip; +use ip.all; + +entity lmg6202 is + generic( + F_CLK : natural; + LCD_F_CLP : natural := 2_000_000 -- Max 2.5 MHz atm (because fo t_lc) + ); + port( + -- System signals + clk : in std_logic; + rst : in std_logic; -- + + -- Interface signals + addr_in : in std_logic_vector(12 downto 0); + data_in : in std_logic_vector(8 downto 0); + data_we : in std_logic; + data_out : out std_logic_vector(8 downto 0); + vsync_out : out std_logic; -- Strobed when resetting to the top left + vsync_in : in std_logic; -- Reset renderer to the top left corner + + -- LCD hardware signals + lcd_data : out std_logic_vector(3 downto 0); + lcd_clp : out std_logic; + lcd_load : out std_logic; + lcd_frp : out std_logic; + lcd_frmb : out std_logic + ); +end entity lmg6202; + +architecture RTL of lmg6202 is + constant DISPLAY_WIDTH_PX : natural := 480; + constant DISPLAY_HEIGHT_PX : natural := 128; + + constant DISPLAY_WIDTH : natural := DISPLAY_WIDTH_PX / 4; + constant DISPLAY_HEIGHT : natural := DISPLAY_HEIGHT_PX; + + -- CLP Gen + constant CLP_CNT_MAX : integer := F_CLK / LCD_F_CLP / 2 - 1; + signal clp_cnt : integer range 0 to CLP_CNT_MAX; + signal clp_falling : std_logic; + + signal row : integer range 0 to DISPLAY_HEIGHT - 1; + signal col : integer range 0 to DISPLAY_WIDTH - 1; + + signal renderer_addr : unsigned(12 downto 0); + signal renderer_data : std_logic_vector(8 downto 0); + signal additional_nibble : std_logic_vector(3 downto 0); + signal cached_nibble : std_logic_vector(3 downto 0); + signal clp_rising : std_logic; + signal step_cnt : unsigned(3 downto 0); + +begin + gram0_inst : entity ip.gram0 + port map( + DataInA => data_in, + DataInB => (others => '0'), + AddressA => addr_in, + AddressB => std_logic_vector(renderer_addr), + ClockA => clk, + ClockB => clk, + ClockEnA => '1', + ClockEnB => '1', + WrA => data_we, + WrB => '0', + ResetA => rst, + ResetB => rst, + QA => data_out, + QB => renderer_data + ); + + renderer : process(clk, rst) is + procedure reset_renderer is + + begin + row <= 0; + col <= 0; + renderer_addr <= (others => '0'); + step_cnt <= (others => '0'); + vsync_out <= '1'; + end procedure reset_renderer; + + begin + if (rst = '1') then + additional_nibble <= (others => '0'); + cached_nibble <= (others => '0'); + lcd_load <= '0'; + lcd_frp <= '0'; + lcd_frmb <= '0'; + lcd_data <= (others => '0'); + reset_renderer; + + elsif (rising_edge(clk)) then + vsync_out <= '0'; + + if (clp_falling = '1') then + if (col = DISPLAY_WIDTH - 1) then + col <= 0; + lcd_load <= '1'; + + if (row = 0) then + lcd_frp <= '1'; + lcd_frmb <= not lcd_frmb; + else + lcd_frp <= '0'; + end if; + + if (row = DISPLAY_HEIGHT - 1) then + reset_renderer; + else + row <= row + 1; + end if; + else + col <= col + 1; + end if; + end if; + + if (clp_rising = '1') then + lcd_load <= '0'; + + step_cnt <= step_cnt + 1; + if (step_cnt = 8) then + step_cnt <= (others => '0'); + lcd_data <= additional_nibble; + + elsif (step_cnt(0) = '0') then + renderer_addr <= renderer_addr + 1; + + lcd_data <= renderer_data(8 downto 5); + cached_nibble <= renderer_data(4 downto 1); + additional_nibble <= additional_nibble(2 downto 0) & renderer_data(0); + + else + lcd_data <= cached_nibble; + end if; + + -- DEBUG BEGIN + -- lcd_data <= (others => '0'); + -- if (col = 0) then + -- lcd_data <= x"8"; + -- end if; + -- if (col = DISPLAY_WIDTH - 1) then + -- lcd_data <= x"1"; + -- end if; + -- if (row = 0 or row = DISPLAY_HEIGHT - 1) then + -- lcd_data <= (others => '1'); + -- end if; + -- DEBUG END + end if; + + if (vsync_in = '1') then + reset_renderer; + end if; + end if; + end process renderer; + + cpgen : process(clk, rst) is + begin + if (rst = '1') then + clp_cnt <= CLP_CNT_MAX; + lcd_clp <= '0'; + clp_falling <= '0'; + clp_rising <= '0'; + + elsif (rising_edge(clk)) then + clp_falling <= '0'; + clp_rising <= '0'; + + if (clp_cnt = 0) then + lcd_clp <= not lcd_clp; + clp_cnt <= CLP_CNT_MAX; + else + if (clp_cnt = 1) then + if (lcd_clp = '1') then + clp_falling <= '1'; + else + clp_rising <= '1'; + end if; + end if; + clp_cnt <= clp_cnt - 1; + end if; + end if; + end process cpgen; + +end architecture RTL; diff --git a/display/fpga/design/spi_if.vhd b/display/fpga/design/spi_if.vhd new file mode 100644 index 0000000..35e171c --- /dev/null +++ b/display/fpga/design/spi_if.vhd @@ -0,0 +1,165 @@ +-- FIXME: synchronizer + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity spi_if is + port( + clk : in std_logic; + rst : in std_logic; -- + + -- Local memory IF + addr : out std_logic_vector(12 downto 0); + data_in : in std_logic_vector(8 downto 0); + data_we : out std_logic; + data_out : out std_logic_vector(8 downto 0); -- + + -- Other control signals + vsync_rq : out std_logic; -- + + -- SPI IF + spi_cs_n : in std_logic; -- SPI chip select, active low + spi_sck : in std_logic; -- SPI clock + spi_mosi : in std_logic; -- SPI data input + spi_miso : inout std_logic -- SPI data output + ); +end entity spi_if; + +architecture RTL of spi_if is + signal spi_sck_last : std_logic; + signal sr_in : std_logic_vector(3 downto 0); + signal sr_out : std_logic_vector(3 downto 0); + signal bit_cnt : unsigned(1 downto 0); + + signal rx_stb : std_logic; + + type state_t is (IDLE, ADDRESS, DATA, FLUSH, LOCK); + signal state : state_t; + signal word_cnt : unsigned(3 downto 0); + + signal cache_nor : std_logic_vector(2 * 4 * 4 - 1 downto 0); + signal cache_extra : std_logic_vector(4 - 1 downto 0); + +begin + spi_receiver : process(clk, rst) is + begin + if (rst = '1') then + spi_miso <= 'Z'; + bit_cnt <= (others => '0'); + sr_in <= (others => '0'); + rx_stb <= '0'; + spi_sck_last <= '0'; + + elsif (rising_edge(clk)) then + rx_stb <= '0'; + spi_sck_last <= spi_sck; + + if (spi_cs_n = '0') then + if (spi_sck = '1' and spi_sck_last = '0') then -- rising edge of SPI clock, write + sr_in <= sr_in(sr_in'high - 1 downto 0) & spi_mosi; + bit_cnt <= bit_cnt + 1; + if (bit_cnt = 3) then + rx_stb <= '1'; + end if; + elsif (spi_sck = '0' and spi_sck_last = '1') then -- falling edge of SPI clock, read + + end if; + + else + spi_miso <= 'Z'; + bit_cnt <= (others => '0'); + sr_in <= (others => '0'); + end if; + + end if; + end process spi_receiver; + + proc : process(clk, rst) is + begin + if (rst = '1') then + addr <= (others => '0'); + data_we <= '0'; + word_cnt <= (others => '0'); + cache_nor <= (others => '0'); + cache_extra <= (others => '0'); + vsync_rq <= '0'; + state <= IDLE; + + elsif (rising_edge(clk)) then + data_we <= '0'; + vsync_rq <= '0'; + + if (spi_cs_n = '0') then + + case state is + when IDLE => + if (rx_stb = '1') then + word_cnt <= word_cnt + 1; + if (word_cnt = 1) then + if (sr_in = x"0") then -- Start at addr + state <= ADDRESS; + word_cnt <= (others => '0'); + addr <= (others => '0'); + elsif (sr_in = x"1") then -- Continue + state <= DATA; + word_cnt <= (others => '0'); + else + state <= LOCK; + end if; + end if; + end if; + + when ADDRESS => + if (rx_stb = '1') then + addr <= addr(addr'high - 4 downto 0) & sr_in; + word_cnt <= word_cnt + 1; + if (word_cnt = 3) then + state <= DATA; + word_cnt <= (others => '0'); + end if; + end if; + + when DATA => + if (data_we = '1') then -- If we came from FLUSH + addr <= std_logic_vector(unsigned(addr) + 1); + end if; + if (rx_stb = '1') then + word_cnt <= word_cnt + 1; + if (word_cnt = 8) then + cache_extra <= sr_in; + state <= FLUSH; + word_cnt <= (others => '0'); + data_we <= '1'; + + else + cache_nor <= cache_nor(cache_nor'high - 4 downto 0) & sr_in; + end if; + end if; + + when FLUSH => + addr <= std_logic_vector(unsigned(addr) + 1); + cache_nor <= cache_nor(cache_nor'high - 8 downto 0) & x"00"; + cache_extra <= cache_extra(cache_extra'high - 1 downto 0) & '0'; + data_we <= '1'; + word_cnt <= word_cnt + 1; + if (word_cnt = 2) then + state <= DATA; + word_cnt <= (others => '0'); + end if; + + when LOCK => + vsync_rq <= '1'; + null; + end case; + else + state <= IDLE; + --addr <= (others => '0'); + data_we <= '0'; + word_cnt <= (others => '0'); + end if; + end if; + end process proc; + data_out <= cache_nor(cache_nor'high downto cache_nor'high - 7) & cache_extra(cache_extra'high); + +end architecture RTL; diff --git a/display/fpga/design/top.vhd b/display/fpga/design/top.vhd new file mode 100644 index 0000000..79fc0f4 --- /dev/null +++ b/display/fpga/design/top.vhd @@ -0,0 +1,170 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library generics; +library ip; + +entity top is + port( + -- System ports + clk_hw : in std_logic; -- System clock @ F_CLK + rst_hw : in std_logic; -- Asynchronous, active low reset + + -- SPI IF + spi_cs_n : in std_logic; -- SPI chip select, active low + spi_sck : in std_logic; -- SPI clock + spi_mosi : in std_logic; -- SPI data input + spi_miso : inout std_logic; -- SPI data output + + -- LEDs + led_red : out std_logic; + led_green : out std_logic; + -- LCD connection + lcd_data : out std_logic_vector(3 downto 0); + lcd_clp : out std_logic; + lcd_load : out std_logic; + lcd_frp : out std_logic; + lcd_frmb : out std_logic + ); +end entity top; + +architecture RTL of top is + constant F_CLK : natural := 96_000_000; + + signal clk : std_logic; + signal rst : std_logic; + signal pll_lock : std_logic; + + signal addr_in : std_logic_vector(12 downto 0); + signal data_in : std_logic_vector(8 downto 0); + signal data_we : std_logic; + signal data_out : std_logic_vector(8 downto 0); + signal vsync : std_logic; + signal vsync_rq : std_logic; + + signal spi_cs_n_sync : std_logic; + signal spi_sck_sync : std_logic; + + +begin + pll0_inst : entity ip.pll0 + port map( + CLKI => clk_hw, + CLKOP => clk, + LOCK => pll_lock + ); + + rst_sync : process(clk, rst_hw, pll_lock) is + variable tmp : std_logic; + + begin + if (rst_hw = '0' or pll_lock = '0') then + rst <= '1'; + tmp := '1'; + + elsif rising_edge(clk) then + rst <= tmp; + tmp := '0'; + end if; + end process rst_sync; + + lmg6202_inst : entity work.lmg6202 + generic map( + F_CLK => F_CLK + ) + port map( + clk => clk, + rst => rst, + addr_in => addr_in, + data_in => data_in, + data_we => data_we, + data_out => data_out, + vsync_out => vsync, + vsync_in => vsync_rq, + lcd_data => lcd_data, + lcd_clp => lcd_clp, + lcd_load => lcd_load, + lcd_frp => lcd_frp, + lcd_frmb => lcd_frmb + ); + + spi_if_inst : entity work.spi_if + port map( + clk => clk, + rst => rst, + addr => addr_in, + data_in => data_out, + data_we => data_we, + data_out => data_in, + vsync_rq => vsync_rq, + spi_cs_n => spi_cs_n_sync, + spi_sck => spi_sck_sync, + spi_mosi => spi_mosi, + spi_miso => spi_miso + ); + + synchronizer0_inst : entity generics.synchronizer + generic map( + INIT => '1' + ) + port map( + clk => clk, + rst => rst, + din => spi_cs_n, + dout => spi_cs_n_sync + ); + + synchronizer1_inst : entity generics.synchronizer + generic map( + INIT => '0' + ) + port map( + clk => clk, + rst => rst, + din => spi_sck, + dout => spi_sck_sync + ); + + debug : process(clk, rst) is + constant CMAX : integer := F_CLK / 32; + variable cnt : integer range 0 to CMAX; + variable cnt2 : integer range 0 to CMAX; + + begin + if rst = '1' then + led_red <= '1'; + led_green <= '1'; + + cnt := CMAX; + cnt2 := CMAX; + + elsif (rising_edge(clk)) then + if (cnt > 0) then + cnt := cnt - 1; + end if; + if (cnt2 > 0) then + cnt2 := cnt2 - 1; + end if; + + if (data_we = '1') then -- green + cnt := CMAX; + end if; + if (vsync_rq = '1') then -- red + cnt2 := CMAX; + end if; + + if (cnt = 0) then + led_green <= '1'; + else + led_green <= '0'; + end if; + if (cnt2 = 0) then + led_red <= '1'; + else + led_red <= '0'; + end if; + end if; + end process debug; + +end architecture RTL; diff --git a/display/fpga/diamond/lmg6202.ldf b/display/fpga/diamond/lmg6202.ldf new file mode 100644 index 0000000..85925d5 --- /dev/null +++ b/display/fpga/diamond/lmg6202.ldf @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/display/fpga/diamond/lmg6202.lpf b/display/fpga/diamond/lmg6202.lpf new file mode 100644 index 0000000..07d4f13 --- /dev/null +++ b/display/fpga/diamond/lmg6202.lpf @@ -0,0 +1,33 @@ +BLOCK RESETPATHS ; +BLOCK ASYNCPATHS ; +LOCATE COMP "clk_hw" SITE "28" ; +LOCATE COMP "rst_hw" SITE "23" ; +IOBUF PORT "rst_hw" PULLMODE=UP IO_TYPE=LVCMOS33 ; +LOCATE COMP "lcd_data[0]" SITE "14" ; +LOCATE COMP "lcd_data[1]" SITE "13" ; +LOCATE COMP "lcd_clp" SITE "10" ; +LOCATE COMP "lcd_load" SITE "9" ; +LOCATE COMP "lcd_frp" SITE "8" ; +LOCATE COMP "lcd_frmb" SITE "5" ; +IOBUF ALLPORTS IO_TYPE=LVCMOS33 ; +IOBUF PORT "clk_hw" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_clp" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_data[0]" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_data[1]" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_data[2]" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_data[3]" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_frmb" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_frp" IO_TYPE=LVCMOS33 ; +IOBUF PORT "lcd_load" IO_TYPE=LVCMOS33 ; +LOCATE COMP "lcd_data[2]" SITE "12" ; +LOCATE COMP "lcd_data[3]" SITE "11" ; +FREQUENCY NET "clk_hw_c" 12.000000 MHz ; +IOBUF PORT "spi_cs_n" IO_TYPE=LVCMOS33 PULLMODE=UP ; +IOBUF PORT "spi_sck" IO_TYPE=LVCMOS33 PULLMODE=DOWN ; +IOBUF PORT "spi_miso" IO_TYPE=LVCMOS33 ; +LOCATE COMP "spi_cs_n" SITE "27" ; +LOCATE COMP "spi_mosi" SITE "17" ; +LOCATE COMP "spi_sck" SITE "16" ; +LOCATE COMP "spi_miso" SITE "25" ; +LOCATE COMP "led_green" SITE "21" ; +LOCATE COMP "led_red" SITE "20" ; diff --git a/display/fpga/diamond/lmg62021.sty b/display/fpga/diamond/lmg62021.sty new file mode 100644 index 0000000..7cb17bd --- /dev/null +++ b/display/fpga/diamond/lmg62021.sty @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/display/fpga/generics/ram.vhd b/display/fpga/generics/ram.vhd new file mode 100644 index 0000000..c61d247 --- /dev/null +++ b/display/fpga/generics/ram.vhd @@ -0,0 +1,74 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity ram is + generic( + WIDTH : natural := 9; + DEPTH : natural := 10 + ); + port( + clk : in std_logic; + rst : in std_logic; -- + + a_addr_in : in std_logic_vector(DEPTH - 1 downto 0); + a_data_in : in std_logic_vector(WIDTH - 1 downto 0); + a_data_out : out std_logic_vector(WIDTH - 1 downto 0); + a_we : in std_logic; -- + + b_addr_in : in std_logic_vector(DEPTH - 1 downto 0); + b_data_out : out std_logic_vector(WIDTH - 1 downto 0) + ); +end entity ram; + +architecture RTL of ram is + type memory_t is array (0 to 2**DEPTH - 1) of std_logic_vector(WIDTH - 1 downto 0); + signal memory : memory_t; + +begin + mem_p : process(clk, rst) is + begin + if (rst = '1') then + a_data_out <= (others => '0'); + b_data_out <= (others => '0'); + +-- memory(0) <= "111100001"; +-- memory(1) <= "100101001"; +-- memory(2) <= "000000000"; +-- memory(3) <= "101010100"; +-- +-- memory(4) <= "111111111"; +-- memory(5) <= "000000000"; +-- memory(6) <= "000000000"; +-- memory(7) <= "000000000"; +---- +---- memory(0) <= "111111111"; +---- memory(1) <= "111111111"; +---- memory(2) <= "111111111"; +---- memory(3) <= "111111111"; +---- memory(4) <= "111111111"; +---- memory(5) <= "111111111"; +---- memory(6) <= "111111111"; +---- memory(7) <= "111111111"; +-- +-- memory(0) <= "101010101"; +-- memory(1) <= "101010100"; +-- memory(2) <= "101010101"; +-- memory(3) <= "101010100"; +-- +-- memory(4) <= "101010101"; +-- memory(5) <= "101010100"; +-- memory(6) <= "101010101"; +-- memory(7) <= "101010100"; + + elsif (rising_edge(clk)) then + a_data_out <= memory(to_integer(unsigned(a_addr_in))); + b_data_out <= memory(to_integer(unsigned(b_addr_in))); + + if (a_we = '1') then + memory(to_integer(unsigned(a_addr_in))) <= a_data_in; + end if; + end if; + end process mem_p; + +end architecture RTL; diff --git a/display/fpga/generics/synchronizer.vhd b/display/fpga/generics/synchronizer.vhd new file mode 100644 index 0000000..2fb3330 --- /dev/null +++ b/display/fpga/generics/synchronizer.vhd @@ -0,0 +1,33 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity synchronizer is + generic( + INIT : std_logic := '0' + ); + port( + clk : in std_logic; + rst : in std_logic; + din : in std_logic; + dout : out std_logic + ); +end entity synchronizer; + +architecture RTL of synchronizer is + signal tmp : std_logic_vector(1 downto 0); + +begin + sync_p : process(clk, rst) is + begin + if (rst = '1') then + tmp <= (others => INIT); + dout <= INIT; + + elsif (rising_edge(clk)) then + tmp <= tmp(0) & din; + dout <= tmp(1); + end if; + end process sync_p; + +end architecture RTL; diff --git a/display/fpga/gtkwave/bench_top.gtkw b/display/fpga/gtkwave/bench_top.gtkw new file mode 100644 index 0000000..837df48 --- /dev/null +++ b/display/fpga/gtkwave/bench_top.gtkw @@ -0,0 +1,77 @@ +[*] +[*] GTKWave Analyzer v3.3.89 (w)1999-2018 BSI +[*] Tue Apr 24 15:18:59 2018 +[*] +[dumpfile] "/tmp/SigasiCompileCache8922493919830884349/lmg6202/mentor/bench_top.ghw" +[dumpfile_mtime] "Tue Apr 24 15:18:24 2018" +[dumpfile_size] 343957 +[savefile] "/home/markus/projects/workspaceSigasi/lmg6202/gtkwave/bench_top.gtkw" +[timestart] 10940000000 +[size] 1920 1043 +[pos] -1 -1 +*-33.419907 48604165889 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 +[treeopen] top. +[treeopen] top.bench_top. +[treeopen] top.bench_top.top_inst. +[treeopen] top.bench_top.top_inst.lmg6202_inst. +[treeopen] top.bench_top.top_inst.lmg6202_inst.gram0_inst. +[treeopen] top.bench_top.top_inst.lmg6202_inst.gram0_inst.ram_inst. +[treeopen] top.bench_top.top_inst.spi_if_inst. +[sst_width] 233 +[signals_width] 262 +[sst_expanded] 1 +[sst_vpaned_height] 309 +@28 +top.bench_top.top_inst.lmg6202_inst.lcd_clp +top.bench_top.top_inst.lmg6202_inst.lcd_load +top.bench_top.top_inst.lmg6202_inst.lcd_frp +top.bench_top.top_inst.lmg6202_inst.lcd_frmb +@22 +#{top.bench_top.top_inst.lmg6202_inst.lcd_data[3:0]} top.bench_top.top_inst.lmg6202_inst.lcd_data[3] top.bench_top.top_inst.lmg6202_inst.lcd_data[2] top.bench_top.top_inst.lmg6202_inst.lcd_data[1] top.bench_top.top_inst.lmg6202_inst.lcd_data[0] +#{top.bench_top.top_inst.lmg6202_inst.additional_nibble[3:0]} top.bench_top.top_inst.lmg6202_inst.additional_nibble[3] top.bench_top.top_inst.lmg6202_inst.additional_nibble[2] top.bench_top.top_inst.lmg6202_inst.additional_nibble[1] top.bench_top.top_inst.lmg6202_inst.additional_nibble[0] +#{top.bench_top.top_inst.lmg6202_inst.renderer_data[8:0]} top.bench_top.top_inst.lmg6202_inst.renderer_data[8] top.bench_top.top_inst.lmg6202_inst.renderer_data[7] top.bench_top.top_inst.lmg6202_inst.renderer_data[6] top.bench_top.top_inst.lmg6202_inst.renderer_data[5] top.bench_top.top_inst.lmg6202_inst.renderer_data[4] top.bench_top.top_inst.lmg6202_inst.renderer_data[3] top.bench_top.top_inst.lmg6202_inst.renderer_data[2] top.bench_top.top_inst.lmg6202_inst.renderer_data[1] top.bench_top.top_inst.lmg6202_inst.renderer_data[0] +#{top.bench_top.top_inst.lmg6202_inst.renderer_addr[12:0]} top.bench_top.top_inst.lmg6202_inst.renderer_addr[12] top.bench_top.top_inst.lmg6202_inst.renderer_addr[11] top.bench_top.top_inst.lmg6202_inst.renderer_addr[10] top.bench_top.top_inst.lmg6202_inst.renderer_addr[9] top.bench_top.top_inst.lmg6202_inst.renderer_addr[8] top.bench_top.top_inst.lmg6202_inst.renderer_addr[7] top.bench_top.top_inst.lmg6202_inst.renderer_addr[6] top.bench_top.top_inst.lmg6202_inst.renderer_addr[5] top.bench_top.top_inst.lmg6202_inst.renderer_addr[4] top.bench_top.top_inst.lmg6202_inst.renderer_addr[3] top.bench_top.top_inst.lmg6202_inst.renderer_addr[2] top.bench_top.top_inst.lmg6202_inst.renderer_addr[1] top.bench_top.top_inst.lmg6202_inst.renderer_addr[0] +#{top.bench_top.top_inst.lmg6202_inst.data_out[3:0]} top.bench_top.top_inst.lmg6202_inst.data_out[3] top.bench_top.top_inst.lmg6202_inst.data_out[2] top.bench_top.top_inst.lmg6202_inst.data_out[1] top.bench_top.top_inst.lmg6202_inst.data_out[0] +#{top.bench_top.top_inst.lmg6202_inst.data_in[3:0]} top.bench_top.top_inst.lmg6202_inst.data_in[3] top.bench_top.top_inst.lmg6202_inst.data_in[2] top.bench_top.top_inst.lmg6202_inst.data_in[1] top.bench_top.top_inst.lmg6202_inst.data_in[0] +#{top.bench_top.top_inst.lmg6202_inst.addr_in[12:0]} top.bench_top.top_inst.lmg6202_inst.addr_in[12] top.bench_top.top_inst.lmg6202_inst.addr_in[11] top.bench_top.top_inst.lmg6202_inst.addr_in[10] top.bench_top.top_inst.lmg6202_inst.addr_in[9] top.bench_top.top_inst.lmg6202_inst.addr_in[8] top.bench_top.top_inst.lmg6202_inst.addr_in[7] top.bench_top.top_inst.lmg6202_inst.addr_in[6] top.bench_top.top_inst.lmg6202_inst.addr_in[5] top.bench_top.top_inst.lmg6202_inst.addr_in[4] top.bench_top.top_inst.lmg6202_inst.addr_in[3] top.bench_top.top_inst.lmg6202_inst.addr_in[2] top.bench_top.top_inst.lmg6202_inst.addr_in[1] top.bench_top.top_inst.lmg6202_inst.addr_in[0] +@28 +top.bench_top.top_inst.lmg6202_inst.clp_rising +@420 +top.bench_top.top_inst.lmg6202_inst.col +top.bench_top.top_inst.lmg6202_inst.row +@28 +top.bench_top.top_inst.lmg6202_inst.clp_falling +@420 +top.bench_top.top_inst.lmg6202_inst.clp_cnt +@28 +top.bench_top.top_inst.lmg6202_inst.data_we +top.bench_top.top_inst.lmg6202_inst.rst +top.bench_top.top_inst.lmg6202_inst.clk +@200 +- +@420 +top.bench_top.top_inst.spi_if_inst.state +@28 +top.bench_top.top_inst.spi_if_inst.spi_sck_last +top.bench_top.top_inst.spi_if_inst.spi_miso +top.bench_top.top_inst.spi_if_inst.spi_mosi +top.bench_top.top_inst.spi_if_inst.spi_sck +top.bench_top.top_inst.spi_if_inst.spi_cs_n +top.bench_top.top_inst.spi_if_inst.vsync_rq +top.bench_top.top_inst.spi_if_inst.data_we +top.bench_top.top_inst.spi_if_inst.rst +top.bench_top.top_inst.spi_if_inst.clk +@22 +#{top.bench_top.top_inst.spi_if_inst.addr[12:0]} top.bench_top.top_inst.spi_if_inst.addr[12] top.bench_top.top_inst.spi_if_inst.addr[11] top.bench_top.top_inst.spi_if_inst.addr[10] top.bench_top.top_inst.spi_if_inst.addr[9] top.bench_top.top_inst.spi_if_inst.addr[8] top.bench_top.top_inst.spi_if_inst.addr[7] top.bench_top.top_inst.spi_if_inst.addr[6] top.bench_top.top_inst.spi_if_inst.addr[5] top.bench_top.top_inst.spi_if_inst.addr[4] top.bench_top.top_inst.spi_if_inst.addr[3] top.bench_top.top_inst.spi_if_inst.addr[2] top.bench_top.top_inst.spi_if_inst.addr[1] top.bench_top.top_inst.spi_if_inst.addr[0] +#{top.bench_top.top_inst.spi_if_inst.sr_in[3:0]} top.bench_top.top_inst.spi_if_inst.sr_in[3] top.bench_top.top_inst.spi_if_inst.sr_in[2] top.bench_top.top_inst.spi_if_inst.sr_in[1] top.bench_top.top_inst.spi_if_inst.sr_in[0] +@28 +top.bench_top.top_inst.spi_if_inst.rx_stb +@22 +#{top.bench_top.top_inst.spi_if_inst.word_cnt[3:0]} top.bench_top.top_inst.spi_if_inst.word_cnt[3] top.bench_top.top_inst.spi_if_inst.word_cnt[2] top.bench_top.top_inst.spi_if_inst.word_cnt[1] top.bench_top.top_inst.spi_if_inst.word_cnt[0] +#{top.bench_top.top_inst.spi_if_inst.data_out[8:0]} top.bench_top.top_inst.spi_if_inst.data_out[8] top.bench_top.top_inst.spi_if_inst.data_out[7] top.bench_top.top_inst.spi_if_inst.data_out[6] top.bench_top.top_inst.spi_if_inst.data_out[5] top.bench_top.top_inst.spi_if_inst.data_out[4] top.bench_top.top_inst.spi_if_inst.data_out[3] top.bench_top.top_inst.spi_if_inst.data_out[2] top.bench_top.top_inst.spi_if_inst.data_out[1] top.bench_top.top_inst.spi_if_inst.data_out[0] +#{top.bench_top.top_inst.spi_if_inst.cache_extra[3:0]} top.bench_top.top_inst.spi_if_inst.cache_extra[3] top.bench_top.top_inst.spi_if_inst.cache_extra[2] top.bench_top.top_inst.spi_if_inst.cache_extra[1] top.bench_top.top_inst.spi_if_inst.cache_extra[0] +#{top.bench_top.top_inst.spi_if_inst.cache_nor[31:0]} top.bench_top.top_inst.spi_if_inst.cache_nor[31] top.bench_top.top_inst.spi_if_inst.cache_nor[30] top.bench_top.top_inst.spi_if_inst.cache_nor[29] top.bench_top.top_inst.spi_if_inst.cache_nor[28] top.bench_top.top_inst.spi_if_inst.cache_nor[27] top.bench_top.top_inst.spi_if_inst.cache_nor[26] top.bench_top.top_inst.spi_if_inst.cache_nor[25] top.bench_top.top_inst.spi_if_inst.cache_nor[24] top.bench_top.top_inst.spi_if_inst.cache_nor[23] top.bench_top.top_inst.spi_if_inst.cache_nor[22] top.bench_top.top_inst.spi_if_inst.cache_nor[21] top.bench_top.top_inst.spi_if_inst.cache_nor[20] top.bench_top.top_inst.spi_if_inst.cache_nor[19] top.bench_top.top_inst.spi_if_inst.cache_nor[18] top.bench_top.top_inst.spi_if_inst.cache_nor[17] top.bench_top.top_inst.spi_if_inst.cache_nor[16] top.bench_top.top_inst.spi_if_inst.cache_nor[15] top.bench_top.top_inst.spi_if_inst.cache_nor[14] top.bench_top.top_inst.spi_if_inst.cache_nor[13] top.bench_top.top_inst.spi_if_inst.cache_nor[12] top.bench_top.top_inst.spi_if_inst.cache_nor[11] top.bench_top.top_inst.spi_if_inst.cache_nor[10] top.bench_top.top_inst.spi_if_inst.cache_nor[9] top.bench_top.top_inst.spi_if_inst.cache_nor[8] top.bench_top.top_inst.spi_if_inst.cache_nor[7] top.bench_top.top_inst.spi_if_inst.cache_nor[6] top.bench_top.top_inst.spi_if_inst.cache_nor[5] top.bench_top.top_inst.spi_if_inst.cache_nor[4] top.bench_top.top_inst.spi_if_inst.cache_nor[3] top.bench_top.top_inst.spi_if_inst.cache_nor[2] top.bench_top.top_inst.spi_if_inst.cache_nor[1] top.bench_top.top_inst.spi_if_inst.cache_nor[0] +@23 +#{top.bench_top.top_inst.spi_if_inst.data_out[8:0]} top.bench_top.top_inst.spi_if_inst.data_out[8] top.bench_top.top_inst.spi_if_inst.data_out[7] top.bench_top.top_inst.spi_if_inst.data_out[6] top.bench_top.top_inst.spi_if_inst.data_out[5] top.bench_top.top_inst.spi_if_inst.data_out[4] top.bench_top.top_inst.spi_if_inst.data_out[3] top.bench_top.top_inst.spi_if_inst.data_out[2] top.bench_top.top_inst.spi_if_inst.data_out[1] top.bench_top.top_inst.spi_if_inst.data_out[0] +[pattern_trace] 1 +[pattern_trace] 0 diff --git a/display/fpga/ip/gram0/._Real_._Math_.vhd b/display/fpga/ip/gram0/._Real_._Math_.vhd new file mode 100644 index 0000000..ad185b2 --- /dev/null +++ b/display/fpga/ip/gram0/._Real_._Math_.vhd @@ -0,0 +1,2574 @@ + + +------------------------------------------------------------------------ +-- +-- Copyright 1996 by IEEE. All rights reserved. +-- +-- This source file is an essential part of IEEE Std 1076.2-1996, IEEE Standard +-- VHDL Mathematical Packages. This source file may not be copied, sold, or +-- included with software that is sold without written permission from the IEEE +-- Standards Department. This source file may be used to implement this standard +-- and may be distributed in compiled form in any manner so long as the +-- compiled form does not allow direct decompilation of the original source file. +-- This source file may be copied for individual use between licensed users. +-- This source file is provided on an AS IS basis. The IEEE disclaims ANY +-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY +-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source +-- file shall indemnify and hold IEEE harmless from any damages or liability +-- arising out of the use thereof. +-- +-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996, +-- MATH_REAL) +-- +-- Library: This package shall be compiled into a library +-- symbolically named IEEE. +-- +-- Developers: IEEE DASC VHDL Mathematical Packages Working Group +-- +-- Purpose: This package defines a standard for designers to use in +-- describing VHDL models that make use of common REAL constants +-- and common REAL elementary mathematical functions. +-- +-- Limitation: The values generated by the functions in this package may +-- vary from platform to platform, and the precision of results +-- is only guaranteed to be the minimum required by IEEE Std 1076- +-- 1993. +-- +-- Notes: +-- No declarations or definitions shall be included in, or +-- excluded from, this package. +-- The "package declaration" defines the types, subtypes, and +-- declarations of MATH_REAL. +-- The standard mathematical definition and conventional meaning +-- of the mathematical functions that are part of this standard +-- represent the formal semantics of the implementation of the +-- MATH_REAL package declaration. The purpose of the MATH_REAL +-- package body is to provide a guideline for implementations to +-- verify their implementation of MATH_REAL. Tool developers may +-- choose to implement the package body in the most efficient +-- manner available to them. +-- +-- ----------------------------------------------------------------------------- +-- Version : 1.5 +-- Date : 24 July 1996 +-- ----------------------------------------------------------------------------- + +package MATH_REAL is + constant CopyRightNotice: STRING + := "Copyright 1996 IEEE. All rights reserved."; + + -- + -- Constant Definitions + -- + constant MATH_E : REAL := 2.71828_18284_59045_23536; + -- Value of e + constant MATH_1_OVER_E : REAL := 0.36787_94411_71442_32160; + -- Value of 1/e + constant MATH_PI : REAL := 3.14159_26535_89793_23846; + -- Value of pi + constant MATH_2_PI : REAL := 6.28318_53071_79586_47693; + -- Value of 2*pi + constant MATH_1_OVER_PI : REAL := 0.31830_98861_83790_67154; + -- Value of 1/pi + constant MATH_PI_OVER_2 : REAL := 1.57079_63267_94896_61923; + -- Value of pi/2 + constant MATH_PI_OVER_3 : REAL := 1.04719_75511_96597_74615; + -- Value of pi/3 + constant MATH_PI_OVER_4 : REAL := 0.78539_81633_97448_30962; + -- Value of pi/4 + constant MATH_3_PI_OVER_2 : REAL := 4.71238_89803_84689_85769; + -- Value 3*pi/2 + constant MATH_LOG_OF_2 : REAL := 0.69314_71805_59945_30942; + -- Natural log of 2 + constant MATH_LOG_OF_10 : REAL := 2.30258_50929_94045_68402; + -- Natural log of 10 + constant MATH_LOG2_OF_E : REAL := 1.44269_50408_88963_4074; + -- Log base 2 of e + constant MATH_LOG10_OF_E: REAL := 0.43429_44819_03251_82765; + -- Log base 10 of e + constant MATH_SQRT_2: REAL := 1.41421_35623_73095_04880; + -- square root of 2 + constant MATH_1_OVER_SQRT_2: REAL := 0.70710_67811_86547_52440; + -- square root of 1/2 + constant MATH_SQRT_PI: REAL := 1.77245_38509_05516_02730; + -- square root of pi + constant MATH_DEG_TO_RAD: REAL := 0.01745_32925_19943_29577; + -- Conversion factor from degree to radian + constant MATH_RAD_TO_DEG: REAL := 57.29577_95130_82320_87680; + -- Conversion factor from radian to degree + + -- + -- Function Declarations + -- + function SIGN (X: in REAL ) return REAL; + -- Purpose: + -- Returns 1.0 if X > 0.0; 0.0 if X = 0.0; -1.0 if X < 0.0 + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIGN(X)) <= 1.0 + -- Notes: + -- None + + function CEIL (X : in REAL ) return REAL; + -- Purpose: + -- Returns smallest INTEGER value (as REAL) not less than X + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CEIL(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function FLOOR (X : in REAL ) return REAL; + -- Purpose: + -- Returns largest INTEGER value (as REAL) not greater than X + -- Special values: + -- FLOOR(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- FLOOR(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function ROUND (X : in REAL ) return REAL; + -- Purpose: + -- Rounds X to the nearest integer value (as real). If X is + -- halfway between two integers, rounding is away from 0.0 + -- Special values: + -- ROUND(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ROUND(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function TRUNC (X : in REAL ) return REAL; + -- Purpose: + -- Truncates X towards 0.0 and returns truncated value + -- Special values: + -- TRUNC(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- TRUNC(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function "MOD" (X, Y: in REAL ) return REAL; + -- Purpose: + -- Returns floating point modulus of X/Y, with the same sign as + -- Y, and absolute value less than the absolute value of Y, and + -- for some INTEGER value N the result satisfies the relation + -- X = Y*N + MOD(X,Y) + -- Special values: + -- None + -- Domain: + -- X in REAL; Y in REAL and Y /= 0.0 + -- Error conditions: + -- Error if Y = 0.0 + -- Range: + -- ABS(MOD(X,Y)) < ABS(Y) + -- Notes: + -- None + + function REALMAX (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically larger of X and Y + -- Special values: + -- REALMAX(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMAX(X,Y) is mathematically unbounded + -- Notes: + -- None + + function REALMIN (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically smaller of X and Y + -- Special values: + -- REALMIN(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMIN(X,Y) is mathematically unbounded + -- Notes: + -- None + + procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE; variable X:out REAL); + -- Purpose: + -- Returns, in X, a pseudo-random number with uniform + -- distribution in the open interval (0.0, 1.0). + -- Special values: + -- None + -- Domain: + -- 1 <= SEED1 <= 2147483562; 1 <= SEED2 <= 2147483398 + -- Error conditions: + -- Error if SEED1 or SEED2 outside of valid domain + -- Range: + -- 0.0 < X < 1.0 + -- Notes: + -- a) The semantics for this function are described by the + -- algorithm published by Pierre L'Ecuyer in "Communications + -- of the ACM," vol. 31, no. 6, June 1988, pp. 742-774. + -- The algorithm is based on the combination of two + -- multiplicative linear congruential generators for 32-bit + -- platforms. + -- + -- b) Before the first call to UNIFORM, the seed values + -- (SEED1, SEED2) have to be initialized to values in the range + -- [1, 2147483562] and [1, 2147483398] respectively. The + -- seed values are modified after each call to UNIFORM. + -- + -- c) This random number generator is portable for 32-bit + -- computers, and it has a period of ~2.30584*(10**18) for each + -- set of seed values. + -- + -- d) For information on spectral tests for the algorithm, refer + -- to the L'Ecuyer article. + + function SQRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns square root of X + -- Special values: + -- SQRT(0.0) = 0.0 + -- SQRT(1.0) = 1.0 + -- Domain: + -- X >= 0.0 + -- Error conditions: + -- Error if X < 0.0 + -- Range: + -- SQRT(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of SQRT is + -- approximately given by: + -- SQRT(X) <= SQRT(REAL'HIGH) + + function CBRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns cube root of X + -- Special values: + -- CBRT(0.0) = 0.0 + -- CBRT(1.0) = 1.0 + -- CBRT(-1.0) = -1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CBRT(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of CBRT is approximately given by: + -- ABS(CBRT(X)) <= CBRT(REAL'HIGH) + + function "**" (X : in INTEGER; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0 + -- 0**Y = 0.0; Y > 0.0 + -- X**1.0 = REAL(X); X >= 0 + -- 1**Y = 1.0 + -- Domain: + -- X > 0 + -- X = 0 for Y > 0.0 + -- X < 0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0 and Y /= 0.0 + -- Error if X = 0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function "**" (X : in REAL; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0.0 + -- 0.0**Y = 0.0; Y > 0.0 + -- X**1.0 = X; X >= 0.0 + -- 1.0**Y = 1.0 + -- Domain: + -- X > 0.0 + -- X = 0.0 for Y > 0.0 + -- X < 0.0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0.0 and Y /= 0.0 + -- Error if X = 0.0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function EXP (X : in REAL ) return REAL; + -- Purpose: + -- Returns e**X; where e = MATH_E + -- Special values: + -- EXP(0.0) = 1.0 + -- EXP(1.0) = MATH_E + -- EXP(-1.0) = MATH_1_OVER_E + -- EXP(X) = 0.0 for X <= -LOG(REAL'HIGH) + -- Domain: + -- X in REAL such that EXP(X) <= REAL'HIGH + -- Error conditions: + -- Error if X > LOG(REAL'HIGH) + -- Range: + -- EXP(X) >= 0.0 + -- Notes: + -- a) The usable domain of EXP is approximately given by: + -- X <= LOG(REAL'HIGH) + + function LOG (X : in REAL ) return REAL; + -- Purpose: + -- Returns natural logarithm of X + -- Special values: + -- LOG(1.0) = 0.0 + -- LOG(MATH_E) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG is approximately given by: + -- LOG(0+) <= LOG(X) <= LOG(REAL'HIGH) + + function LOG2 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 2 of X + -- Special values: + -- LOG2(1.0) = 0.0 + -- LOG2(2.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG2(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG2 is approximately given by: + -- LOG2(0+) <= LOG2(X) <= LOG2(REAL'HIGH) + + function LOG10 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 10 of X + -- Special values: + -- LOG10(1.0) = 0.0 + -- LOG10(10.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG10(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG10 is approximately given by: + -- LOG10(0+) <= LOG10(X) <= LOG10(REAL'HIGH) + + function LOG (X: in REAL; BASE: in REAL) return REAL; + -- Purpose: + -- Returns logarithm base BASE of X + -- Special values: + -- LOG(1.0, BASE) = 0.0 + -- LOG(BASE, BASE) = 1.0 + -- Domain: + -- X > 0.0 + -- BASE > 0.0 + -- BASE /= 1.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Error if BASE <= 0.0 + -- Error if BASE = 1.0 + -- Range: + -- LOG(X, BASE) is mathematically unbounded + -- Notes: + -- a) When BASE > 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(0+, BASE) <= LOG(X, BASE) <= LOG(REAL'HIGH, BASE) + -- b) When 0.0 < BASE < 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(REAL'HIGH, BASE) <= LOG(X, BASE) <= LOG(0+, BASE) + + function SIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns sine of X; X in radians + -- Special values: + -- SIN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- SIN(X) = 1.0 for X = (4*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- SIN(X) = -1.0 for X = (4*k+3)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIN(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function COS ( X : in REAL ) return REAL; + -- Purpose: + -- Returns cosine of X; X in radians + -- Special values: + -- COS(X) = 0.0 for X = (2*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- COS(X) = 1.0 for X = (2*k)*MATH_PI, where k is an INTEGER + -- COS(X) = -1.0 for X = (2*k+1)*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(COS(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function TAN (X : in REAL ) return REAL; + -- Purpose: + -- Returns tangent of X; X in radians + -- Special values: + -- TAN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL and + -- X /= (2*k+1)*MATH_PI_OVER_2, where k is an INTEGER + -- Error conditions: + -- Error if X = ((2*k+1) * MATH_PI_OVER_2), where k is an + -- INTEGER + -- Range: + -- TAN(X) is mathematically unbounded + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function ARCSIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse sine of X + -- Special values: + -- ARCSIN(0.0) = 0.0 + -- ARCSIN(1.0) = MATH_PI_OVER_2 + -- ARCSIN(-1.0) = -MATH_PI_OVER_2 + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- ABS(ARCSIN(X) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCCOS (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse cosine of X + -- Special values: + -- ARCCOS(1.0) = 0.0 + -- ARCCOS(0.0) = MATH_PI_OVER_2 + -- ARCCOS(-1.0) = MATH_PI + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- 0.0 <= ARCCOS(X) <= MATH_PI + -- Notes: + -- None + + function ARCTAN (Y : in REAL) return REAL; + -- Purpose: + -- Returns the value of the angle in radians of the point + -- (1.0, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0) = 0.0 + -- Domain: + -- Y in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(ARCTAN(Y)) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCTAN (Y : in REAL; X : in REAL) return REAL; + -- Purpose: + -- Returns the principal value of the angle in radians of + -- the point (X, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0, X) = 0.0 if X > 0.0 + -- ARCTAN(0.0, X) = MATH_PI if X < 0.0 + -- ARCTAN(Y, 0.0) = MATH_PI_OVER_2 if Y > 0.0 + -- ARCTAN(Y, 0.0) = -MATH_PI_OVER_2 if Y < 0.0 + -- Domain: + -- Y in REAL + -- X in REAL, X /= 0.0 when Y = 0.0 + -- Error conditions: + -- Error if X = 0.0 and Y = 0.0 + -- Range: + -- -MATH_PI < ARCTAN(Y,X) <= MATH_PI + -- Notes: + -- None + + function SINH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic sine of X + -- Special values: + -- SINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- SINH(X) is mathematically unbounded + -- Notes: + -- a) The usable domain of SINH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + + function COSH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic cosine of X + -- Special values: + -- COSH(0.0) = 1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- COSH(X) >= 1.0 + -- Notes: + -- a) The usable domain of COSH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + function TANH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic tangent of X + -- Special values: + -- TANH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(TANH(X)) <= 1.0 + -- Notes: + -- None + + function ARCSINH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic sine of X + -- Special values: + -- ARCSINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ARCSINH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCSINH is approximately given by: + -- ABS(ARCSINH(X)) <= LOG(REAL'HIGH) + + function ARCCOSH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic cosine of X + -- Special values: + -- ARCCOSH(1.0) = 0.0 + -- Domain: + -- X >= 1.0 + -- Error conditions: + -- Error if X < 1.0 + -- Range: + -- ARCCOSH(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of ARCCOSH is + -- approximately given by: ARCCOSH(X) <= LOG(REAL'HIGH) + + function ARCTANH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic tangent of X + -- Special values: + -- ARCTANH(0.0) = 0.0 + -- Domain: + -- ABS(X) < 1.0 + -- Error conditions: + -- Error if ABS(X) >= 1.0 + -- Range: + -- ARCTANH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCTANH is approximately given by: + -- ABS(ARCTANH(X)) < LOG(REAL'HIGH) + +end MATH_REAL; + + + +------------------------------------------------------------------------ +-- +-- Copyright 1996 by IEEE. All rights reserved. + +-- This source file is an informative part of IEEE Std 1076.2-1996, IEEE Standard +-- VHDL Mathematical Packages. This source file may not be copied, sold, or +-- included with software that is sold without written permission from the IEEE +-- Standards Department. This source file may be used to implement this standard +-- and may be distributed in compiled form in any manner so long as the +-- compiled form does not allow direct decompilation of the original source file. +-- This source file may be copied for individual use between licensed users. +-- This source file is provided on an AS IS basis. The IEEE disclaims ANY +-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY +-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source +-- file shall indemnify and hold IEEE harmless from any damages or liability +-- arising out of the use thereof. + +-- +-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996, +-- MATH_REAL) +-- +-- Library: This package shall be compiled into a library +-- symbolically named IEEE. +-- +-- Developers: IEEE DASC VHDL Mathematical Packages Working Group +-- +-- Purpose: This package body is a nonnormative implementation of the +-- functionality defined in the MATH_REAL package declaration. +-- +-- Limitation: The values generated by the functions in this package may +-- vary from platform to platform, and the precision of results +-- is only guaranteed to be the minimum required by IEEE Std 1076 +-- -1993. +-- +-- Notes: +-- The "package declaration" defines the types, subtypes, and +-- declarations of MATH_REAL. +-- The standard mathematical definition and conventional meaning +-- of the mathematical functions that are part of this standard +-- represent the formal semantics of the implementation of the +-- MATH_REAL package declaration. The purpose of the MATH_REAL +-- package body is to clarify such semantics and provide a +-- guideline for implementations to verify their implementation +-- of MATH_REAL. Tool developers may choose to implement +-- the package body in the most efficient manner available to them. +-- +-- ----------------------------------------------------------------------------- +-- Version : 1.5 +-- Date : 24 July 1996 +-- ----------------------------------------------------------------------------- + +package body MATH_REAL is + + -- + -- Local Constants for Use in the Package Body Only + -- + constant MATH_E_P2 : REAL := 7.38905_60989_30650; -- e**2 + constant MATH_E_P10 : REAL := 22026.46579_48067_17; -- e**10 + constant MATH_EIGHT_PI : REAL := 25.13274_12287_18345_90770_115; --8*pi + constant MAX_ITER: INTEGER := 27; -- Maximum precision factor for cordic + constant MAX_COUNT: INTEGER := 150; -- Maximum count for number of tries + constant BASE_EPS: REAL := 0.00001; -- Factor for convergence criteria + constant KC : REAL := 6.0725293500888142e-01; -- Constant for cordic + + -- + -- Local Type Declarations for Cordic Operations + -- + type REAL_VECTOR is array (NATURAL range <>) of REAL; + type NATURAL_VECTOR is array (NATURAL range <>) of NATURAL; + subtype REAL_VECTOR_N is REAL_VECTOR (0 to MAX_ITER); + subtype REAL_ARR_2 is REAL_VECTOR (0 to 1); + subtype REAL_ARR_3 is REAL_VECTOR (0 to 2); + subtype QUADRANT is INTEGER range 0 to 3; + type CORDIC_MODE_TYPE is (ROTATION, VECTORING); + + -- + -- Auxiliary Functions for Cordic Algorithms + -- + function POWER_OF_2_SERIES (D : in NATURAL_VECTOR; INITIAL_VALUE : in REAL; + NUMBER_OF_VALUES : in NATURAL) return REAL_VECTOR is + -- Description: + -- Returns power of two for a vector of values + -- Notes: + -- None + -- + variable V : REAL_VECTOR (0 to NUMBER_OF_VALUES); + variable TEMP : REAL := INITIAL_VALUE; + variable FLAG : BOOLEAN := TRUE; + begin + for I in 0 to NUMBER_OF_VALUES loop + V(I) := TEMP; + for P in D'RANGE loop + if I = D(P) then + FLAG := FALSE; + exit; + end if; + end loop; + if FLAG then + TEMP := TEMP/2.0; + end if; + FLAG := TRUE; + end loop; + return V; + end POWER_OF_2_SERIES; + + + constant TWO_AT_MINUS : REAL_VECTOR := POWER_OF_2_SERIES( + NATURAL_VECTOR'(100, 90),1.0, + MAX_ITER); + + constant EPSILON : REAL_VECTOR_N := ( + 7.8539816339744827e-01, + 4.6364760900080606e-01, + 2.4497866312686413e-01, + 1.2435499454676144e-01, + 6.2418809995957351e-02, + 3.1239833430268277e-02, + 1.5623728620476830e-02, + 7.8123410601011116e-03, + 3.9062301319669717e-03, + 1.9531225164788189e-03, + 9.7656218955931937e-04, + 4.8828121119489829e-04, + 2.4414062014936175e-04, + 1.2207031189367021e-04, + 6.1035156174208768e-05, + 3.0517578115526093e-05, + 1.5258789061315760e-05, + 7.6293945311019699e-06, + 3.8146972656064960e-06, + 1.9073486328101870e-06, + 9.5367431640596080e-07, + 4.7683715820308876e-07, + 2.3841857910155801e-07, + 1.1920928955078067e-07, + 5.9604644775390553e-08, + 2.9802322387695303e-08, + 1.4901161193847654e-08, + 7.4505805969238281e-09 + ); + + function CORDIC ( X0 : in REAL; + Y0 : in REAL; + Z0 : in REAL; + N : in NATURAL; -- Precision factor + CORDIC_MODE : in CORDIC_MODE_TYPE -- Rotation (Z -> 0) + -- or vectoring (Y -> 0) + ) return REAL_ARR_3 is + -- Description: + -- Compute cordic values + -- Notes: + -- None + variable X : REAL := X0; + variable Y : REAL := Y0; + variable Z : REAL := Z0; + variable X_TEMP : REAL; + begin + if CORDIC_MODE = ROTATION then + for K in 0 to N loop + X_TEMP := X; + if ( Z >= 0.0) then + X := X - Y * TWO_AT_MINUS(K); + Y := Y + X_TEMP * TWO_AT_MINUS(K); + Z := Z - EPSILON(K); + else + X := X + Y * TWO_AT_MINUS(K); + Y := Y - X_TEMP * TWO_AT_MINUS(K); + Z := Z + EPSILON(K); + end if; + end loop; + else + for K in 0 to N loop + X_TEMP := X; + if ( Y < 0.0) then + X := X - Y * TWO_AT_MINUS(K); + Y := Y + X_TEMP * TWO_AT_MINUS(K); + Z := Z - EPSILON(K); + else + X := X + Y * TWO_AT_MINUS(K); + Y := Y - X_TEMP * TWO_AT_MINUS(K); + Z := Z + EPSILON(K); + end if; + end loop; + end if; + return REAL_ARR_3'(X, Y, Z); + end CORDIC; + + -- + -- Bodies for Global Mathematical Functions Start Here + -- + function SIGN (X: in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- None + begin + if ( X > 0.0 ) then + return 1.0; + elsif ( X < 0.0 ) then + return -1.0; + else + return 0.0; + end if; + end SIGN; + + function CEIL (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) No conversion to an INTEGER type is expected, so truncate + -- cannot overflow for large arguments + -- b) The domain supported by this function is X <= LARGE + -- c) Returns X if ABS(X) >= LARGE + + constant LARGE: REAL := REAL(INTEGER'HIGH); + variable RD: REAL; + + begin + if ABS(X) >= LARGE then + return X; + end if; + + RD := REAL ( INTEGER(X)); + if RD = X then + return X; + end if; + + if X > 0.0 then + if RD >= X then + return RD; + else + return RD + 1.0; + end if; + elsif X = 0.0 then + return 0.0; + else + if RD <= X then + return RD + 1.0; + else + return RD; + end if; + end if; + end CEIL; + + function FLOOR (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) No conversion to an INTEGER type is expected, so truncate + -- cannot overflow for large arguments + -- b) The domain supported by this function is ABS(X) <= LARGE + -- c) Returns X if ABS(X) >= LARGE + + constant LARGE: REAL := REAL(INTEGER'HIGH); + variable RD: REAL; + + begin + if ABS( X ) >= LARGE then + return X; + end if; + + RD := REAL ( INTEGER(X)); + if RD = X then + return X; + end if; + + if X > 0.0 then + if RD <= X then + return RD; + else + return RD - 1.0; + end if; + elsif X = 0.0 then + return 0.0; + else + if RD >= X then + return RD - 1.0; + else + return RD; + end if; + end if; + end FLOOR; + + function ROUND (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 if X = 0.0 + -- b) Returns FLOOR(X + 0.5) if X > 0 + -- c) Returns CEIL(X - 0.5) if X < 0 + + begin + if X > 0.0 then + return FLOOR(X + 0.5); + elsif X < 0.0 then + return CEIL( X - 0.5); + else + return 0.0; + end if; + end ROUND; + + function TRUNC (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 if X = 0.0 + -- b) Returns FLOOR(X) if X > 0 + -- c) Returns CEIL(X) if X < 0 + + begin + if X > 0.0 then + return FLOOR(X); + elsif X < 0.0 then + return CEIL( X); + else + return 0.0; + end if; + end TRUNC; + + + + + function "MOD" (X, Y: in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + + variable XNEGATIVE : BOOLEAN := X < 0.0; + variable YNEGATIVE : BOOLEAN := Y < 0.0; + variable VALUE : REAL; + begin + -- Check validity of input arguments + if (Y = 0.0) then + assert FALSE + report "MOD(X, 0.0) is undefined" + severity ERROR; + return 0.0; + end if; + + -- Compute value + if ( XNEGATIVE ) then + if ( YNEGATIVE ) then + VALUE := X + (FLOOR(ABS(X)/ABS(Y)))*ABS(Y); + else + VALUE := X + (CEIL(ABS(X)/ABS(Y)))*ABS(Y); + end if; + else + if ( YNEGATIVE ) then + VALUE := X - (CEIL(ABS(X)/ABS(Y)))*ABS(Y); + else + VALUE := X - (FLOOR(ABS(X)/ABS(Y)))*ABS(Y); + end if; + end if; + + return VALUE; + end "MOD"; + + + function REALMAX (X, Y : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) REALMAX(X,Y) = X when X = Y + -- + begin + if X >= Y then + return X; + else + return Y; + end if; + end REALMAX; + + function REALMIN (X, Y : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) REALMIN(X,Y) = X when X = Y + -- + begin + if X <= Y then + return X; + else + return Y; + end if; + end REALMIN; + + + procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE;variable X:out REAL) + is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + -- + variable Z, K: INTEGER; + variable TSEED1 : INTEGER := INTEGER'(SEED1); + variable TSEED2 : INTEGER := INTEGER'(SEED2); + begin + -- Check validity of arguments + if SEED1 > 2147483562 then + assert FALSE + report "SEED1 > 2147483562 in UNIFORM" + severity ERROR; + X := 0.0; + return; + end if; + + if SEED2 > 2147483398 then + assert FALSE + report "SEED2 > 2147483398 in UNIFORM" + severity ERROR; + X := 0.0; + return; + end if; + + -- Compute new seed values and pseudo-random number + K := TSEED1/53668; + TSEED1 := 40014 * (TSEED1 - K * 53668) - K * 12211; + + if TSEED1 < 0 then + TSEED1 := TSEED1 + 2147483563; + end if; + + K := TSEED2/52774; + TSEED2 := 40692 * (TSEED2 - K * 52774) - K * 3791; + + if TSEED2 < 0 then + TSEED2 := TSEED2 + 2147483399; + end if; + + Z := TSEED1 - TSEED2; + if Z < 1 then + Z := Z + 2147483562; + end if; + + -- Get output values + SEED1 := POSITIVE'(TSEED1); + SEED2 := POSITIVE'(TSEED2); + X := REAL(Z)*4.656613e-10; + end UNIFORM; + + + + function SQRT (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Uses the Newton-Raphson approximation: + -- F(n+1) = 0.5*[F(n) + x/F(n)] + -- b) Returns 0.0 on error + -- + + constant EPS : REAL := BASE_EPS*BASE_EPS; -- Convergence factor + + variable INIVAL: REAL; + variable OLDVAL : REAL ; + variable NEWVAL : REAL ; + variable COUNT : INTEGER := 1; + + begin + -- Check validity of argument + if ( X < 0.0 ) then + assert FALSE + report "X < 0.0 in SQRT(X)" + severity ERROR; + return 0.0; + end if; + + -- Get the square root for special cases + if X = 0.0 then + return 0.0; + else + if ( X = 1.0 ) then + return 1.0; + end if; + end if; + + -- Get the square root for general cases + INIVAL := EXP(LOG(X)*(0.5)); -- Mathematically correct but imprecise + OLDVAL := INIVAL; + NEWVAL := (X/OLDVAL + OLDVAL)*0.5; + + -- Check for relative and absolute error and max count + while ( ( (ABS((NEWVAL -OLDVAL)/NEWVAL) > EPS) OR + (ABS(NEWVAL - OLDVAL) > EPS) ) AND + (COUNT < MAX_COUNT) ) loop + OLDVAL := NEWVAL; + NEWVAL := (X/OLDVAL + OLDVAL)*0.5; + COUNT := COUNT + 1; + end loop; + return NEWVAL; + end SQRT; + + function CBRT (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Uses the Newton-Raphson approximation: + -- F(n+1) = (1/3)*[2*F(n) + x/F(n)**2]; + -- + constant EPS : REAL := BASE_EPS*BASE_EPS; + + variable INIVAL: REAL; + variable XLOCAL : REAL := X; + variable NEGATIVE : BOOLEAN := X < 0.0; + variable OLDVAL : REAL ; + variable NEWVAL : REAL ; + variable COUNT : INTEGER := 1; + + begin + + -- Compute root for special cases + if X = 0.0 then + return 0.0; + elsif ( X = 1.0 ) then + return 1.0; + else + if X = -1.0 then + return -1.0; + end if; + end if; + + -- Compute root for general cases + if NEGATIVE then + XLOCAL := -X; + end if; + + INIVAL := EXP(LOG(XLOCAL)/(3.0)); -- Mathematically correct but + -- imprecise + OLDVAL := INIVAL; + NEWVAL := (XLOCAL/(OLDVAL*OLDVAL) + 2.0*OLDVAL)/3.0; + + -- Check for relative and absolute errors and max count + while ( ( (ABS((NEWVAL -OLDVAL)/NEWVAL) > EPS ) OR + (ABS(NEWVAL - OLDVAL) > EPS ) ) AND + ( COUNT < MAX_COUNT ) ) loop + OLDVAL := NEWVAL; + NEWVAL :=(XLOCAL/(OLDVAL*OLDVAL) + 2.0*OLDVAL)/3.0; + COUNT := COUNT + 1; + end loop; + + if NEGATIVE then + NEWVAL := -NEWVAL; + end if; + + return NEWVAL; + end CBRT; + + function "**" (X : in INTEGER; Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error condition + + begin + -- Check validity of argument + if ( ( X < 0 ) and ( Y /= 0.0 ) ) then + assert FALSE + report "X < 0 and Y /= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + if ( ( X = 0 ) and ( Y <= 0.0 ) ) then + assert FALSE + report "X = 0 and Y <= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + -- Get value for special cases + if ( X = 0 and Y > 0.0 ) then + return 0.0; + end if; + + if ( X = 1 ) then + return 1.0; + end if; + + if ( Y = 0.0 and X /= 0 ) then + return 1.0; + end if; + + if ( Y = 1.0) then + return (REAL(X)); + end if; + + -- Get value for general case + return EXP (Y * LOG (REAL(X))); + end "**"; + + function "**" (X : in REAL; Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error condition + + begin + -- Check validity of argument + if ( ( X < 0.0 ) and ( Y /= 0.0 ) ) then + assert FALSE + report "X < 0.0 and Y /= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + if ( ( X = 0.0 ) and ( Y <= 0.0 ) ) then + assert FALSE + report "X = 0.0 and Y <= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + -- Get value for special cases + if ( X = 0.0 and Y > 0.0 ) then + return 0.0; + end if; + + if ( X = 1.0 ) then + return 1.0; + end if; + + if ( Y = 0.0 and X /= 0.0 ) then + return 1.0; + end if; + + if ( Y = 1.0) then + return (X); + end if; + + -- Get value for general case + return EXP (Y * LOG (X)); + end "**"; + + function EXP (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) This function computes the exponential using the following + -- series: + -- exp(x) = 1 + x + x**2/2! + x**3/3! + ... ; |x| < 1.0 + -- and reduces argument X to take advantage of exp(x+y) = + -- exp(x)*exp(y) + -- + -- b) This implementation limits X to be less than LOG(REAL'HIGH) + -- to avoid overflow. Returns REAL'HIGH when X reaches that + -- limit + -- + constant EPS : REAL := BASE_EPS*BASE_EPS*BASE_EPS;-- Precision criteria + + variable RECIPROCAL: BOOLEAN := X < 0.0;-- Check sign of argument + variable XLOCAL : REAL := ABS(X); -- Use positive value + variable OLDVAL: REAL ; + variable COUNT: INTEGER ; + variable NEWVAL: REAL ; + variable LAST_TERM: REAL ; + variable FACTOR : REAL := 1.0; + + begin + -- Compute value for special cases + if X = 0.0 then + return 1.0; + end if; + + if XLOCAL = 1.0 then + if RECIPROCAL then + return MATH_1_OVER_E; + else + return MATH_E; + end if; + end if; + + if XLOCAL = 2.0 then + if RECIPROCAL then + return 1.0/MATH_E_P2; + else + return MATH_E_P2; + end if; + end if; + + if XLOCAL = 10.0 then + if RECIPROCAL then + return 1.0/MATH_E_P10; + else + return MATH_E_P10; + end if; + end if; + + if XLOCAL > LOG(REAL'HIGH) then + if RECIPROCAL then + return 0.0; + else + assert FALSE + report "X > LOG(REAL'HIGH) in EXP(X)" + severity NOTE; + return REAL'HIGH; + end if; + end if; + + -- Reduce argument to ABS(X) < 1.0 + while XLOCAL > 10.0 loop + XLOCAL := XLOCAL - 10.0; + FACTOR := FACTOR*MATH_E_P10; + end loop; + + while XLOCAL > 1.0 loop + XLOCAL := XLOCAL - 1.0; + FACTOR := FACTOR*MATH_E; + end loop; + + -- Compute value for case 0 < XLOCAL < 1 + OLDVAL := 1.0; + LAST_TERM := XLOCAL; + NEWVAL:= OLDVAL + LAST_TERM; + COUNT := 2; + + -- Check for relative and absolute errors and max count + while ( ( (ABS((NEWVAL - OLDVAL)/NEWVAL) > EPS) OR + (ABS(NEWVAL - OLDVAL) > EPS) ) AND + (COUNT < MAX_COUNT ) ) loop + OLDVAL := NEWVAL; + LAST_TERM := LAST_TERM*(XLOCAL / (REAL(COUNT))); + NEWVAL := OLDVAL + LAST_TERM; + COUNT := COUNT + 1; + end loop; + + -- Compute final value using exp(x+y) = exp(x)*exp(y) + NEWVAL := NEWVAL*FACTOR; + + if RECIPROCAL then + NEWVAL := 1.0/NEWVAL; + end if; + + return NEWVAL; + end EXP; + + + -- + -- Auxiliary Functions to Compute LOG + -- + function ILOGB(X: in REAL) return INTEGER IS + -- Description: + -- Returns n such that -1 <= ABS(X)/2^n < 2 + -- Notes: + -- None + + variable N: INTEGER := 0; + variable Y: REAL := ABS(X); + + begin + if(Y = 1.0 or Y = 0.0) then + return 0; + end if; + + if( Y > 1.0) then + while Y >= 2.0 loop + Y := Y/2.0; + N := N+1; + end loop; + return N; + end if; + + -- O < Y < 1 + while Y < 1.0 loop + Y := Y*2.0; + N := N -1; + end loop; + return N; + end ILOGB; + + function LDEXP(X: in REAL; N: in INTEGER) RETURN REAL IS + -- Description: + -- Returns X*2^n + -- Notes: + -- None + begin + return X*(2.0 ** N); + end LDEXP; + + function LOG (X : in REAL ) return REAL IS + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- + -- Notes: + -- a) Returns REAL'LOW on error + -- + -- Copyright (c) 1992 Regents of the University of California. + -- All rights reserved. + -- + -- Redistribution and use in source and binary forms, with or without + -- modification, are permitted provided that the following conditions + -- are met: + -- 1. Redistributions of source code must retain the above copyright + -- notice, this list of conditions and the following disclaimer. + -- 2. Redistributions in binary form must reproduce the above copyright + -- notice, this list of conditions and the following disclaimer in the + -- documentation and/or other materials provided with the distribution. + -- 3. All advertising materials mentioning features or use of this + -- software must display the following acknowledgement: + -- This product includes software developed by the University of + -- California, Berkeley and its contributors. + -- 4. Neither the name of the University nor the names of its + -- contributors may be used to endorse or promote products derived + -- from this software without specific prior written permission. + -- + -- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' + -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR + -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + -- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + -- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + -- DAMAGE. + -- + -- NOTE: This VHDL version was generated using the C version of the + -- original function by the IEEE VHDL Mathematical Package + -- Working Group (CS/JT) + + constant N: INTEGER := 128; + + -- Table of log(Fj) = logF_head[j] + logF_tail[j], for Fj = 1+j/128. + -- Used for generation of extend precision logarithms. + -- The constant 35184372088832 is 2^45, so the divide is exact. + -- It ensures correct reading of logF_head, even for inaccurate + -- decimal-to-binary conversion routines. (Everybody gets the + -- right answer for INTEGERs less than 2^53.) + -- Values for LOG(F) were generated using error < 10^-57 absolute + -- with the bc -l package. + + type REAL_VECTOR is array (NATURAL range <>) of REAL; + + constant A1:REAL := 0.08333333333333178827; + constant A2:REAL := 0.01250000000377174923; + constant A3:REAL := 0.002232139987919447809; + constant A4:REAL := 0.0004348877777076145742; + + constant LOGF_HEAD: REAL_VECTOR(0 TO N) := ( + 0.0, + 0.007782140442060381246, + 0.015504186535963526694, + 0.023167059281547608406, + 0.030771658666765233647, + 0.038318864302141264488, + 0.045809536031242714670, + 0.053244514518837604555, + 0.060624621816486978786, + 0.067950661908525944454, + 0.075223421237524235039, + 0.082443669210988446138, + 0.089612158689760690322, + 0.096729626458454731618, + 0.103796793681567578460, + 0.110814366340264314203, + 0.117783035656430001836, + 0.124703478501032805070, + 0.131576357788617315236, + 0.138402322859292326029, + 0.145182009844575077295, + 0.151916042025732167530, + 0.158605030176659056451, + 0.165249572895390883786, + 0.171850256926518341060, + 0.178407657472689606947, + 0.184922338493834104156, + 0.191394852999565046047, + 0.197825743329758552135, + 0.204215541428766300668, + 0.210564769107350002741, + 0.216873938300523150246, + 0.223143551314024080056, + 0.229374101064877322642, + 0.235566071312860003672, + 0.241719936886966024758, + 0.247836163904594286577, + 0.253915209980732470285, + 0.259957524436686071567, + 0.265963548496984003577, + 0.271933715484010463114, + 0.277868451003087102435, + 0.283768173130738432519, + 0.289633292582948342896, + 0.295464212893421063199, + 0.301261330578199704177, + 0.307025035294827830512, + 0.312755710004239517729, + 0.318453731118097493890, + 0.324119468654316733591, + 0.329753286372579168528, + 0.335355541920762334484, + 0.340926586970454081892, + 0.346466767346100823488, + 0.351976423156884266063, + 0.357455888922231679316, + 0.362905493689140712376, + 0.368325561158599157352, + 0.373716409793814818840, + 0.379078352934811846353, + 0.384411698910298582632, + 0.389716751140440464951, + 0.394993808240542421117, + 0.400243164127459749579, + 0.405465108107819105498, + 0.410659924985338875558, + 0.415827895143593195825, + 0.420969294644237379543, + 0.426084395310681429691, + 0.431173464818130014464, + 0.436236766774527495726, + 0.441274560805140936281, + 0.446287102628048160113, + 0.451274644139630254358, + 0.456237433481874177232, + 0.461175715122408291790, + 0.466089729924533457960, + 0.470979715219073113985, + 0.475845904869856894947, + 0.480688529345570714212, + 0.485507815781602403149, + 0.490303988045525329653, + 0.495077266798034543171, + 0.499827869556611403822, + 0.504556010751912253908, + 0.509261901790523552335, + 0.513945751101346104405, + 0.518607764208354637958, + 0.523248143765158602036, + 0.527867089620485785417, + 0.532464798869114019908, + 0.537041465897345915436, + 0.541597282432121573947, + 0.546132437597407260909, + 0.550647117952394182793, + 0.555141507540611200965, + 0.559615787935399566777, + 0.564070138285387656651, + 0.568504735352689749561, + 0.572919753562018740922, + 0.577315365035246941260, + 0.581691739635061821900, + 0.586049045003164792433, + 0.590387446602107957005, + 0.594707107746216934174, + 0.599008189645246602594, + 0.603290851438941899687, + 0.607555250224322662688, + 0.611801541106615331955, + 0.616029877215623855590, + 0.620240409751204424537, + 0.624433288012369303032, + 0.628608659422752680256, + 0.632766669570628437213, + 0.636907462236194987781, + 0.641031179420679109171, + 0.645137961373620782978, + 0.649227946625615004450, + 0.653301272011958644725, + 0.657358072709030238911, + 0.661398482245203922502, + 0.665422632544505177065, + 0.669430653942981734871, + 0.673422675212350441142, + 0.677398823590920073911, + 0.681359224807238206267, + 0.685304003098281100392, + 0.689233281238557538017, + 0.693147180560117703862); + + constant LOGF_TAIL: REAL_VECTOR(0 TO N) := ( + 0.0, + -0.00000000000000543229938420049, + 0.00000000000000172745674997061, + -0.00000000000001323017818229233, + -0.00000000000001154527628289872, + -0.00000000000000466529469958300, + 0.00000000000005148849572685810, + -0.00000000000002532168943117445, + -0.00000000000005213620639136504, + -0.00000000000001819506003016881, + 0.00000000000006329065958724544, + 0.00000000000008614512936087814, + -0.00000000000007355770219435028, + 0.00000000000009638067658552277, + 0.00000000000007598636597194141, + 0.00000000000002579999128306990, + -0.00000000000004654729747598444, + -0.00000000000007556920687451336, + 0.00000000000010195735223708472, + -0.00000000000017319034406422306, + -0.00000000000007718001336828098, + 0.00000000000010980754099855238, + -0.00000000000002047235780046195, + -0.00000000000008372091099235912, + 0.00000000000014088127937111135, + 0.00000000000012869017157588257, + 0.00000000000017788850778198106, + 0.00000000000006440856150696891, + 0.00000000000016132822667240822, + -0.00000000000007540916511956188, + -0.00000000000000036507188831790, + 0.00000000000009120937249914984, + 0.00000000000018567570959796010, + -0.00000000000003149265065191483, + -0.00000000000009309459495196889, + 0.00000000000017914338601329117, + -0.00000000000001302979717330866, + 0.00000000000023097385217586939, + 0.00000000000023999540484211737, + 0.00000000000015393776174455408, + -0.00000000000036870428315837678, + 0.00000000000036920375082080089, + -0.00000000000009383417223663699, + 0.00000000000009433398189512690, + 0.00000000000041481318704258568, + -0.00000000000003792316480209314, + 0.00000000000008403156304792424, + -0.00000000000034262934348285429, + 0.00000000000043712191957429145, + -0.00000000000010475750058776541, + -0.00000000000011118671389559323, + 0.00000000000037549577257259853, + 0.00000000000013912841212197565, + 0.00000000000010775743037572640, + 0.00000000000029391859187648000, + -0.00000000000042790509060060774, + 0.00000000000022774076114039555, + 0.00000000000010849569622967912, + -0.00000000000023073801945705758, + 0.00000000000015761203773969435, + 0.00000000000003345710269544082, + -0.00000000000041525158063436123, + 0.00000000000032655698896907146, + -0.00000000000044704265010452446, + 0.00000000000034527647952039772, + -0.00000000000007048962392109746, + 0.00000000000011776978751369214, + -0.00000000000010774341461609578, + 0.00000000000021863343293215910, + 0.00000000000024132639491333131, + 0.00000000000039057462209830700, + -0.00000000000026570679203560751, + 0.00000000000037135141919592021, + -0.00000000000017166921336082431, + -0.00000000000028658285157914353, + -0.00000000000023812542263446809, + 0.00000000000006576659768580062, + -0.00000000000028210143846181267, + 0.00000000000010701931762114254, + 0.00000000000018119346366441110, + 0.00000000000009840465278232627, + -0.00000000000033149150282752542, + -0.00000000000018302857356041668, + -0.00000000000016207400156744949, + 0.00000000000048303314949553201, + -0.00000000000071560553172382115, + 0.00000000000088821239518571855, + -0.00000000000030900580513238244, + -0.00000000000061076551972851496, + 0.00000000000035659969663347830, + 0.00000000000035782396591276383, + -0.00000000000046226087001544578, + 0.00000000000062279762917225156, + 0.00000000000072838947272065741, + 0.00000000000026809646615211673, + -0.00000000000010960825046059278, + 0.00000000000002311949383800537, + -0.00000000000058469058005299247, + -0.00000000000002103748251144494, + -0.00000000000023323182945587408, + -0.00000000000042333694288141916, + -0.00000000000043933937969737844, + 0.00000000000041341647073835565, + 0.00000000000006841763641591466, + 0.00000000000047585534004430641, + 0.00000000000083679678674757695, + -0.00000000000085763734646658640, + 0.00000000000021913281229340092, + -0.00000000000062242842536431148, + -0.00000000000010983594325438430, + 0.00000000000065310431377633651, + -0.00000000000047580199021710769, + -0.00000000000037854251265457040, + 0.00000000000040939233218678664, + 0.00000000000087424383914858291, + 0.00000000000025218188456842882, + -0.00000000000003608131360422557, + -0.00000000000050518555924280902, + 0.00000000000078699403323355317, + -0.00000000000067020876961949060, + 0.00000000000016108575753932458, + 0.00000000000058527188436251509, + -0.00000000000035246757297904791, + -0.00000000000018372084495629058, + 0.00000000000088606689813494916, + 0.00000000000066486268071468700, + 0.00000000000063831615170646519, + 0.00000000000025144230728376072, + -0.00000000000017239444525614834); + + variable M, J:INTEGER; + variable F1, F2, G, Q, U, U2, V: REAL; + variable ZERO: REAL := 0.0;--Made variable so no constant folding occurs + variable ONE: REAL := 1.0; --Made variable so no constant folding occurs + + -- double logb(), ldexp(); + + variable U1:REAL; + + begin + + -- Check validity of argument + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = MATH_E ) then + return 1.0; + end if; + + -- Argument reduction: 1 <= g < 2; x/2^m = g; + -- y = F*(1 + f/F) for |f| <= 2^-8 + + M := ILOGB(X); + G := LDEXP(X, -M); + J := INTEGER(REAL(N)*(G-1.0)); -- C code adds 0.5 for rounding + F1 := (1.0/REAL(N)) * REAL(J) + 1.0; --F1*128 is an INTEGER in [128,512] + F2 := G - F1; + + -- Approximate expansion for log(1+f2/F1) ~= u + q + G := 1.0/(2.0*F1+F2); + U := 2.0*F2*G; + V := U*U; + Q := U*V*(A1 + V*(A2 + V*(A3 + V*A4))); + + -- Case 1: u1 = u rounded to 2^-43 absolute. Since u < 2^-8, + -- u1 has at most 35 bits, and F1*u1 is exact, as F1 has < 8 bits. + -- It also adds exactly to |m*log2_hi + log_F_head[j] | < 750. + -- + if ( J /= 0 or M /= 0) then + U1 := U + 513.0; + U1 := U1 - 513.0; + + -- Case 2: |1-x| < 1/256. The m- and j- dependent terms are zero + -- u1 = u to 24 bits. + -- + else + U1 := U; + --TRUNC(U1); --In c this is u1 = (double) (float) (u1) + end if; + + U2 := (2.0*(F2 - F1*U1) - U1*F2) * G; + -- u1 + u2 = 2f/(2F+f) to extra precision. + + -- log(x) = log(2^m*F1*(1+f2/F1)) = + -- (m*log2_hi+LOGF_HEAD(j)+u1) + (m*log2_lo+LOGF_TAIL(j)+q); + -- (exact) + (tiny) + + U1 := U1 + REAL(M)*LOGF_HEAD(N) + LOGF_HEAD(J); -- Exact + U2 := (U2 + LOGF_TAIL(J)) + Q; -- Tiny + U2 := U2 + LOGF_TAIL(N)*REAL(M); + return (U1 + U2); + end LOG; + + + function LOG2 (X: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG2(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = 2.0 ) then + return 1.0; + end if; + + -- Compute value for general case + return ( MATH_LOG2_OF_E*LOG(X) ); + end LOG2; + + + function LOG10 (X: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG10(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = 10.0 ) then + return 1.0; + end if; + + -- Compute value for general case + return ( MATH_LOG10_OF_E*LOG(X) ); + end LOG10; + + + function LOG (X: in REAL; BASE: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG(X, BASE)" + severity ERROR; + return(REAL'LOW); + end if; + + if ( BASE <= 0.0 or BASE = 1.0 ) then + assert FALSE + report "BASE <= 0.0 or BASE = 1.0 in LOG(X, BASE)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = BASE ) then + return 1.0; + end if; + + -- Compute value for general case + return ( LOG(X)/LOG(BASE)); + end LOG; + + + function SIN (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) SIN(-X) = -SIN(X) + -- b) SIN(X) = X if ABS(X) < EPS + -- c) SIN(X) = X - X**3/3! if EPS < ABS(X) < BASE_EPS + -- d) SIN(MATH_PI_OVER_2 - X) = COS(X) + -- e) COS(X) = 1.0 - 0.5*X**2 if ABS(X) < EPS + -- f) COS(X) = 1.0 - 0.5*X**2 + (X**4)/4! if + -- EPS< ABS(X) MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in SIN(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_2_PI or XLOCAL = MATH_PI then + return 0.0; + end if; + + if XLOCAL = MATH_PI_OVER_2 then + if NEGATIVE then + return -1.0; + else + return 1.0; + end if; + end if; + + if XLOCAL = MATH_3_PI_OVER_2 then + if NEGATIVE then + return 1.0; + else + return -1.0; + end if; + end if; + + if XLOCAL < EPS then + if NEGATIVE then + return -XLOCAL; + else + return XLOCAL; + end if; + else + if XLOCAL < BASE_EPS then + TEMP := XLOCAL - (XLOCAL*XLOCAL*XLOCAL)/6.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := MATH_PI - XLOCAL; + if ABS(TEMP) < EPS then + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + else + if ABS(TEMP) < BASE_EPS then + TEMP := TEMP - (TEMP*TEMP*TEMP)/6.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := MATH_2_PI - XLOCAL; + if ABS(TEMP) < EPS then + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + else + if ABS(TEMP) < BASE_EPS then + TEMP := TEMP - (TEMP*TEMP*TEMP)/6.0; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + end if; + end if; + + TEMP := ABS(MATH_PI_OVER_2 - XLOCAL); + if TEMP < EPS then + TEMP := 1.0 - TEMP*TEMP*0.5; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + else + if TEMP < BASE_EPS then + TEMP := 1.0 -TEMP*TEMP*0.5 + TEMP*TEMP*TEMP*TEMP/24.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := ABS(MATH_3_PI_OVER_2 - XLOCAL); + if TEMP < EPS then + TEMP := 1.0 - TEMP*TEMP*0.5; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + else + if TEMP < BASE_EPS then + TEMP := 1.0 -TEMP*TEMP*0.5 + TEMP*TEMP*TEMP*TEMP/24.0; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + end if; + end if; + + -- Compute value for general cases + if ((XLOCAL < MATH_PI_OVER_2 ) and (XLOCAL > 0.0)) then + VALUE:= CORDIC( KC, 0.0, x, 27, ROTATION)(1); + end if; + + N := INTEGER ( FLOOR(XLOCAL/MATH_PI_OVER_2)); + case QUADRANT( N mod 4) is + when 0 => + VALUE := CORDIC( KC, 0.0, XLOCAL, 27, ROTATION)(1); + when 1 => + VALUE := CORDIC( KC, 0.0, XLOCAL - MATH_PI_OVER_2, 27, + ROTATION)(0); + when 2 => + VALUE := -CORDIC( KC, 0.0, XLOCAL - MATH_PI, 27, ROTATION)(1); + when 3 => + VALUE := -CORDIC( KC, 0.0, XLOCAL - MATH_3_PI_OVER_2, 27, + ROTATION)(0); + end case; + + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end SIN; + + + function COS (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) COS(-X) = COS(X) + -- b) COS(X) = SIN(MATH_PI_OVER_2 - X) + -- c) COS(MATH_PI + X) = -COS(X) + -- d) COS(X) = 1.0 - X*X/2.0 if ABS(X) < EPS + -- e) COS(X) = 1.0 - 0.5*X**2 + (X**4)/4! if + -- EPS< ABS(X) MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in COS(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_2_PI then + return 1.0; + end if; + + if XLOCAL = MATH_PI then + return -1.0; + end if; + + if XLOCAL = MATH_PI_OVER_2 or XLOCAL = MATH_3_PI_OVER_2 then + return 0.0; + end if; + + TEMP := ABS(XLOCAL); + if ( TEMP < EPS) then + return (1.0 - 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (1.0 -0.5*TEMP*TEMP + TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + TEMP := ABS(XLOCAL -MATH_2_PI); + if ( TEMP < EPS) then + return (1.0 - 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (1.0 -0.5*TEMP*TEMP + TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + TEMP := ABS (XLOCAL - MATH_PI); + if TEMP < EPS then + return (-1.0 + 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (-1.0 +0.5*TEMP*TEMP - TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + -- Compute value for general cases + return SIN(MATH_PI_OVER_2 - XLOCAL); + end COS; + + function TAN (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) TAN(0.0) = 0.0 + -- b) TAN(-X) = -TAN(X) + -- c) Returns REAL'LOW on error if X < 0.0 + -- d) Returns REAL'HIGH on error if X > 0.0 + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X) ; + variable VALUE: REAL; + variable TEMP : REAL; + + begin + -- Make 0.0 <= XLOCAL <= MATH_2_PI + if XLOCAL > MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in TAN(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Check validity of argument + if XLOCAL = MATH_PI_OVER_2 then + assert FALSE + report "X is a multiple of MATH_PI_OVER_2 in TAN(X)" + severity ERROR; + if NEGATIVE then + return(REAL'LOW); + else + return(REAL'HIGH); + end if; + end if; + + if XLOCAL = MATH_3_PI_OVER_2 then + assert FALSE + report "X is a multiple of MATH_3_PI_OVER_2 in TAN(X)" + severity ERROR; + if NEGATIVE then + return(REAL'HIGH); + else + return(REAL'LOW); + end if; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_PI then + return 0.0; + end if; + + -- Compute value for general cases + VALUE := SIN(XLOCAL)/COS(XLOCAL); + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end TAN; + + function ARCSIN (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCSIN(-X) = -ARCSIN(X) + -- b) Returns X on error + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable VALUE : REAL; + + begin + -- Check validity of arguments + if XLOCAL > 1.0 then + assert FALSE + report "ABS(X) > 1.0 in ARCSIN(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + elsif XLOCAL = 1.0 then + if NEGATIVE then + return -MATH_PI_OVER_2; + else + return MATH_PI_OVER_2; + end if; + end if; + + -- Compute value for general cases + if XLOCAL < 0.9 then + VALUE := ARCTAN(XLOCAL/(SQRT(1.0 - XLOCAL*XLOCAL))); + else + VALUE := MATH_PI_OVER_2 - ARCTAN(SQRT(1.0 - XLOCAL*XLOCAL)/XLOCAL); + end if; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCSIN; + + function ARCCOS (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCCOS(-X) = MATH_PI - ARCCOS(X) + -- b) Returns X on error + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable VALUE : REAL; + + begin + -- Check validity of argument + if XLOCAL > 1.0 then + assert FALSE + report "ABS(X) > 1.0 in ARCCOS(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 1.0 then + return 0.0; + elsif X = 0.0 then + return MATH_PI_OVER_2; + elsif X = -1.0 then + return MATH_PI; + end if; + + -- Compute value for general cases + if XLOCAL > 0.9 then + VALUE := ARCTAN(SQRT(1.0 - XLOCAL*XLOCAL)/XLOCAL); + else + VALUE := MATH_PI_OVER_2 - ARCTAN(XLOCAL/SQRT(1.0 - XLOCAL*XLOCAL)); + end if; + + + if NEGATIVE then + VALUE := MATH_PI - VALUE; + end if; + + return VALUE; + end ARCCOS; + + + function ARCTAN (Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCTAN(-Y) = -ARCTAN(Y) + -- b) ARCTAN(Y) = -ARCTAN(1.0/Y) + MATH_PI_OVER_2 for |Y| > 1.0 + -- c) ARCTAN(Y) = Y for |Y| < EPS + + constant EPS : REAL := BASE_EPS*BASE_EPS*BASE_EPS; + + variable NEGATIVE : BOOLEAN := Y < 0.0; + variable RECIPROCAL : BOOLEAN; + variable YLOCAL : REAL := ABS(Y); + variable VALUE : REAL; + + begin + -- Make argument |Y| <=1.0 + if YLOCAL > 1.0 then + YLOCAL := 1.0/YLOCAL; + RECIPROCAL := TRUE; + else + RECIPROCAL := FALSE; + end if; + + -- Compute value for special cases + if YLOCAL = 0.0 then + if RECIPROCAL then + if NEGATIVE then + return (-MATH_PI_OVER_2); + else + return (MATH_PI_OVER_2); + end if; + else + return 0.0; + end if; + end if; + + if YLOCAL < EPS then + if NEGATIVE then + if RECIPROCAL then + return (-MATH_PI_OVER_2 + YLOCAL); + else + return -YLOCAL; + end if; + else + if RECIPROCAL then + return (MATH_PI_OVER_2 - YLOCAL); + else + return YLOCAL; + end if; + end if; + end if; + + -- Compute value for general cases + VALUE := CORDIC( 1.0, YLOCAL, 0.0, 27, VECTORING )(2); + + if RECIPROCAL then + VALUE := MATH_PI_OVER_2 - VALUE; + end if; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCTAN; + + + function ARCTAN (Y : in REAL; X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + + variable YLOCAL : REAL; + variable VALUE : REAL; + begin + + -- Check validity of arguments + if (Y = 0.0 and X = 0.0 ) then + assert FALSE report + "ARCTAN(0.0, 0.0) is undetermined" + severity ERROR; + return 0.0; + end if; + + -- Compute value for special cases + if Y = 0.0 then + if X > 0.0 then + return 0.0; + else + return MATH_PI; + end if; + end if; + + if X = 0.0 then + if Y > 0.0 then + return MATH_PI_OVER_2; + else + return -MATH_PI_OVER_2; + end if; + end if; + + + -- Compute value for general cases + YLOCAL := ABS(Y/X); + + VALUE := ARCTAN(YLOCAL); + + if X < 0.0 then + VALUE := MATH_PI - VALUE; + end if; + + if Y < 0.0 then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCTAN; + + + function SINH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) - EXP(-X))/2.0 + -- b) SINH(-X) = SINH(X) + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP - 1.0/TEMP)*0.5; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end SINH; + + function COSH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) + EXP(-X))/2.0 + -- b) COSH(-X) = COSH(X) + + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 1.0; + end if; + + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP + 1.0/TEMP)*0.5; + + return VALUE; + end COSH; + + function TANH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) - EXP(-X))/(EXP(X) + EXP(-X)) + -- b) TANH(-X) = -TANH(X) + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP - 1.0/TEMP)/(TEMP + 1.0/TEMP); + + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end TANH; + + function ARCSINH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns LOG( X + SQRT( X*X + 1.0)) + + begin + -- Compute value for special cases + if X = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + return ( LOG( X + SQRT( X*X + 1.0)) ); + end ARCSINH; + + + + function ARCCOSH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns LOG( X + SQRT( X*X - 1.0)); X >= 1.0 + -- b) Returns X on error + + begin + -- Check validity of arguments + if X < 1.0 then + assert FALSE + report "X < 1.0 in ARCCOSH(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 1.0 then + return 0.0; + end if; + + -- Compute value for general cases + return ( LOG( X + SQRT( X*X - 1.0))); + end ARCCOSH; + + function ARCTANH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (LOG( (1.0 + X)/(1.0 - X)))/2.0 ; | X | < 1.0 + -- b) Returns X on error + begin + -- Check validity of arguments + if ABS(X) >= 1.0 then + assert FALSE + report "ABS(X) >= 1.0 in ARCTANH(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + return( 0.5*LOG( (1.0+X)/(1.0-X) ) ); + end ARCTANH; + +end MATH_REAL; diff --git a/display/fpga/ip/gram0/generate_core.tcl b/display/fpga/ip/gram0/generate_core.tcl new file mode 100644 index 0000000..7928aca --- /dev/null +++ b/display/fpga/ip/gram0/generate_core.tcl @@ -0,0 +1,100 @@ +#!/usr/local/bin/wish + +proc GetPlatform {} { + global tcl_platform + + set cpu $tcl_platform(machine) + + switch $cpu { + intel - + i*86* { + set cpu ix86 + } + x86_64 { + if {$tcl_platform(wordSize) == 4} { + set cpu ix86 + } + } + } + + switch $tcl_platform(platform) { + windows { + if {$cpu == "amd64"} { + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 + } + if {$cpu == "x86_64"} { + return "nt64" + } else { + return "nt" + } + } + unix { + if {$tcl_platform(os) == "Linux"} { + if {$cpu == "x86_64"} { + return "lin64" + } else { + return "lin" + } + } else { + return "sol" + } + } + } + return "nt" +} + +proc GetCmdLine {lpcfile} { + global Para + + if [catch {open $lpcfile r} fileid] { + puts "Cannot open $para_file file!" + exit -1 + } + + seek $fileid 0 start + set default_match 0 + while {[gets $fileid line] >= 0} { + if {[string first "\[Command\]" $line] == 0} { + set default_match 1 + continue + } + if {[string first "\[" $line] == 0} { + set default_match 0 + } + if {$default_match == 1} { + if [regexp {([^=]*)=(.*)} $line match parameter value] { + if [regexp {([ |\t]*;)} $parameter match] {continue} + if [regexp {(.*)[ |\t]*;} $value match temp] { + set Para($parameter) $temp + } else { + set Para($parameter) $value + } + } + } + } + set default_match 0 + close $fileid + + return $Para(cmd_line) +} + +set platformpath [GetPlatform] +set Para(sbp_path) [file dirname [info script]] +set Para(install_dir) $env(TOOLRTF) +set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]" + +set scuba "$Para(FPGAPath)/scuba" +set modulename "gram0" +set lang "vhdl" +set lpcfile "$Para(sbp_path)/$modulename.lpc" +set arch "xo2c00" +set cmd_line [GetCmdLine $lpcfile] +set fdcfile "$Para(sbp_path)/$modulename.fdc" +if {[file exists $fdcfile] == 0} { + append scuba " " $cmd_line +} else { + append scuba " " $cmd_line " " -fdc " " \"$fdcfile\" +} +set Para(result) [catch {eval exec "$scuba"} msg] +#puts $msg diff --git a/display/fpga/ip/gram0/generate_ngd.tcl b/display/fpga/ip/gram0/generate_ngd.tcl new file mode 100644 index 0000000..d9e338e --- /dev/null +++ b/display/fpga/ip/gram0/generate_ngd.tcl @@ -0,0 +1,74 @@ +#!/usr/local/bin/wish + +proc GetPlatform {} { + global tcl_platform + + set cpu $tcl_platform(machine) + + switch $cpu { + intel - + i*86* { + set cpu ix86 + } + x86_64 { + if {$tcl_platform(wordSize) == 4} { + set cpu ix86 + } + } + } + + switch $tcl_platform(platform) { + windows { + if {$cpu == "amd64"} { + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 + } + if {$cpu == "x86_64"} { + return "nt64" + } else { + return "nt" + } + } + unix { + if {$tcl_platform(os) == "Linux"} { + if {$cpu == "x86_64"} { + return "lin64" + } else { + return "lin" + } + } else { + return "sol" + } + } + } + return "nt" +} + +set platformpath [GetPlatform] +set Para(sbp_path) [file dirname [info script]] +set Para(install_dir) $env(TOOLRTF) +set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]" +set Para(bin_dir) "[file join $Para(install_dir) bin $platformpath]" + +set Para(ModuleName) "gram0" +set Para(Module) "RAM_DP_TRUE" +set Para(libname) machxo2 +set Para(arch_name) xo2c00 +set Para(PartType) "LCMXO2-1200HC" + +set Para(tech_syn) machxo2 +set Para(tech_cae) machxo2 +set Para(Package) "QFN32" +set Para(SpeedGrade) "5" +set Para(FMax) "100" +set fdcfile "$Para(sbp_path)/$Para(ModuleName).fdc" + +#edif2ngd +set edif2ngd "$Para(FPGAPath)/edif2ngd" +set Para(result) [catch {eval exec $edif2ngd -l $Para(libname) -d $Para(PartType) -nopropwarn $Para(ModuleName).edn $Para(ModuleName).ngo} msg] +#puts $msg + +#ngdbuild +set ngdbuild "$Para(FPGAPath)/ngdbuild" +set Para(result) [catch {eval exec $ngdbuild -addiobuf -dt -a $Para(arch_name) $Para(ModuleName).ngo $Para(ModuleName).ngd} msg] +#puts $msg diff --git a/display/fpga/ip/gram0/gram0.cst b/display/fpga/ip/gram0/gram0.cst new file mode 100644 index 0000000..17db7cd --- /dev/null +++ b/display/fpga/ip/gram0/gram0.cst @@ -0,0 +1,3 @@ +Date=04/22/2018 +Time=17:34:06 + diff --git a/display/fpga/ip/gram0/gram0.edn b/display/fpga/ip/gram0/gram0.edn new file mode 100644 index 0000000..d08f2bf --- /dev/null +++ b/display/fpga/ip/gram0/gram0.edn @@ -0,0 +1,2420 @@ +(edif gram0 + (edifVersion 2 0 0) + (edifLevel 0) + (keywordMap (keywordLevel 0)) + (status + (written + (timestamp 2018 4 22 17 34 6) + (program "SCUBA" (version "Diamond (64-bit) 3.10.0.111.2")))) + (comment "/usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n gram0 -lang vhdl -synth synplify -bus_exp 7 -bb -arch xo2c00 -type bram -wp 11 -rp 1010 -data_width 9 -rdata_width 9 -num_rows 7000 -outdataA REGISTERED -outdataB REGISTERED -cascade -1 -resetmode SYNC -sync_reset -memfile /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem -memformat bin -writemodeA NORMAL -writemodeB NORMAL ") + (library ORCLIB + (edifLevel 0) + (technology + (numberDefinition)) + (cell AND2 + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port A + (direction INPUT)) + (port B + (direction INPUT)) + (port Z + (direction OUTPUT))))) + (cell FD1P3DX + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port D + (direction INPUT)) + (port SP + (direction INPUT)) + (port CK + (direction INPUT)) + (port CD + (direction INPUT)) + (port Q + (direction OUTPUT))))) + (cell INV + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port A + (direction INPUT)) + (port Z + (direction OUTPUT))))) + (cell MUX81 + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port D0 + (direction INPUT)) + (port D1 + (direction INPUT)) + (port D2 + (direction INPUT)) + (port D3 + (direction INPUT)) + (port D4 + (direction INPUT)) + (port D5 + (direction INPUT)) + (port D6 + (direction INPUT)) + (port D7 + (direction INPUT)) + (port SD1 + (direction INPUT)) + (port SD2 + (direction INPUT)) + (port SD3 + (direction INPUT)) + (port Z + (direction OUTPUT))))) + (cell VHI + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port Z + (direction OUTPUT))))) + (cell VLO + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port Z + (direction OUTPUT))))) + (cell DP8KC + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port DIA8 + (direction INPUT)) + (port DIA7 + (direction INPUT)) + (port DIA6 + (direction INPUT)) + (port DIA5 + (direction INPUT)) + (port DIA4 + (direction INPUT)) + (port DIA3 + (direction INPUT)) + (port DIA2 + (direction INPUT)) + (port DIA1 + (direction INPUT)) + (port DIA0 + (direction INPUT)) + (port ADA12 + (direction INPUT)) + (port ADA11 + (direction INPUT)) + (port ADA10 + (direction INPUT)) + (port ADA9 + (direction INPUT)) + (port ADA8 + (direction INPUT)) + (port ADA7 + (direction INPUT)) + (port ADA6 + (direction INPUT)) + (port ADA5 + (direction INPUT)) + (port ADA4 + (direction INPUT)) + (port ADA3 + (direction INPUT)) + (port ADA2 + (direction INPUT)) + (port ADA1 + (direction INPUT)) + (port ADA0 + (direction INPUT)) + (port CEA + (direction INPUT)) + (port OCEA + (direction INPUT)) + (port CLKA + (direction INPUT)) + (port WEA + (direction INPUT)) + (port CSA2 + (direction INPUT)) + (port CSA1 + (direction INPUT)) + (port CSA0 + (direction INPUT)) + (port RSTA + (direction INPUT)) + (port DIB8 + (direction INPUT)) + (port DIB7 + (direction INPUT)) + (port DIB6 + (direction INPUT)) + (port DIB5 + (direction INPUT)) + (port DIB4 + (direction INPUT)) + (port DIB3 + (direction INPUT)) + (port DIB2 + (direction INPUT)) + (port DIB1 + (direction INPUT)) + (port DIB0 + (direction INPUT)) + (port ADB12 + (direction INPUT)) + (port ADB11 + (direction INPUT)) + (port ADB10 + (direction INPUT)) + (port ADB9 + (direction INPUT)) + (port ADB8 + (direction INPUT)) + (port ADB7 + (direction INPUT)) + (port ADB6 + (direction INPUT)) + (port ADB5 + (direction INPUT)) + (port ADB4 + (direction INPUT)) + (port ADB3 + (direction INPUT)) + (port ADB2 + (direction INPUT)) + (port ADB1 + (direction INPUT)) + (port ADB0 + (direction INPUT)) + (port CEB + (direction INPUT)) + (port OCEB + (direction INPUT)) + (port CLKB + (direction INPUT)) + (port WEB + (direction INPUT)) + (port CSB2 + (direction INPUT)) + (port CSB1 + (direction INPUT)) + (port CSB0 + (direction INPUT)) + (port RSTB + (direction INPUT)) + (port DOA8 + (direction OUTPUT)) + (port DOA7 + (direction OUTPUT)) + (port DOA6 + (direction OUTPUT)) + (port DOA5 + (direction OUTPUT)) + (port DOA4 + (direction OUTPUT)) + (port DOA3 + (direction OUTPUT)) + (port DOA2 + (direction OUTPUT)) + (port DOA1 + (direction OUTPUT)) + (port DOA0 + (direction OUTPUT)) + (port DOB8 + (direction OUTPUT)) + (port DOB7 + (direction OUTPUT)) + (port DOB6 + (direction OUTPUT)) + (port DOB5 + (direction OUTPUT)) + (port DOB4 + (direction OUTPUT)) + (port DOB3 + (direction OUTPUT)) + (port DOB2 + (direction OUTPUT)) + (port DOB1 + (direction OUTPUT)) + (port DOB0 + (direction OUTPUT))))) + (cell gram0 + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port (array (rename DataInA "DataInA(8:0)") 9) + (direction INPUT)) + (port (array (rename DataInB "DataInB(8:0)") 9) + (direction INPUT)) + (port (array (rename AddressA "AddressA(12:0)") 13) + (direction INPUT)) + (port (array (rename AddressB "AddressB(12:0)") 13) + (direction INPUT)) + (port ClockA + (direction INPUT)) + (port ClockB + (direction INPUT)) + (port ClockEnA + (direction INPUT)) + (port ClockEnB + (direction INPUT)) + (port WrA + (direction INPUT)) + (port WrB + (direction INPUT)) + (port ResetA + (direction INPUT)) + (port ResetB + (direction INPUT)) + (port (array (rename QA "QA(8:0)") 9) + (direction OUTPUT)) + (port (array (rename QB "QB(8:0)") 9) + (direction OUTPUT))) + (property NGD_DRC_MASK (integer 1)) + (contents + (instance INV_1 + (viewRef view1 + (cellRef INV))) + (instance AND2_t1 + (viewRef view1 + (cellRef AND2))) + (instance INV_0 + (viewRef view1 + (cellRef INV))) + (instance AND2_t0 + (viewRef view1 + (cellRef AND2))) + (instance gram0_0_0_6 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_19 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_18 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_17 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_16 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_15 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_14 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_13 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_12 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_11 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_10 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_09 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_08 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_07 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_06 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_05 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_04 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_03 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_02 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_01 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_00 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property CSDECODE_B + (string "0b000")) + (property CSDECODE_A + (string "0b000")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance gram0_1_0_5 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x0020100201000003F07E001F83FDFE3FBFE3FDC03FEFF00201000000000000000000003FC1E00000")) + (property INITVAL_1E + (string "0x001F03FC3E3F87E000003E0FE00000000003C1FE00000001FC3FE0F0020100000001C00FE01303FF")) + (property INITVAL_1D + (string "0x3FFC13FFFF3C3FF3FE0F00000000000000000000001F03FC00000003F1FE03FC13FE07001803FC0E")) + (property INITVAL_1C + (string "0x00000001003FE01002013F9FE0FC000000000000381FE00C003FDFF03FFD3FE0F3FFFF00E0100201")) + (property INITVAL_1B + (string "0x00000001FC3FFFF3FFFF303FF3FFFF3FEFF003FD207FF3FFFF3FFFF07FFF3FFFF3FFFF00F813FFFF")) + (property INITVAL_1A + (string "0x0020100000000003F83E001FC3FDFE3FDFE1FDE03FE7F0020100000000003FDFE3FDFE3FE1F3F3FF")) + (property INITVAL_19 + (string "0x3FFFF3FE033F83E3F1FE3FFFF3FFFF3FFFF3FDFF3FEFF003F93FE030020100000001C007E01383FF")) + (property INITVAL_18 + (string "0x3FFE13FFFF3C3FF3FE060000000000001E03FDFE3FFFF1FF813FFFF3FFFF003E13FF833FFFF3FFFF")) + (property INITVAL_17 + (string "0x3FFF73FFFF3FFFF3FE0F3F1FE03C0000000000003C1FE004003FDFF01FFF3FF0F3FFFF00E0100201")) + (property INITVAL_16 + (string "0x00000001FE3FFFF3FFFF383FF3FFFE3FE0F003FF307FF3FFFF3FFFF27FFF3FFFF3FFFF00F013FEFF")) + (property INITVAL_15 + (string "0x0000000000000003FC1E001FE3FCFE3FDFE0FDF03FE3F0020100000000003FDFE3FDFF3FE0F3FBFF")) + (property INITVAL_14 + (string "0x3FFFF07E013FC1E3F1FE3FFFF3FFFF3FFFE3FDFF3FE7F003F10FE010020100000001E003E013C3FF")) + (property INITVAL_13 + (string "0x1FFF13FFFF3F3FF3FC020000000000001F03FDFE3FFFF0FFC13FFFF3FEFF001E03FDC03FFFF3FFFF")) + (property INITVAL_12 + (string "0x3FFFB3FFFF3FFFF3FE073E1FE00C0000000000003C1FE000003FFFF21FFF3FF873FFFF0060100201")) + (property INITVAL_11 + (string "0x00000201FE3FFFF3FFFF383FF3FDFE03E01203FF383FF3FFFF3FFFF37FFF3FFFF3FFFF00F013FE3F")) + (property INITVAL_10 + (string "0x0000000000001003FC1E001FE3FC7E3FDFE0FDF93FE3F0020100000000003FDFE3FDFF3FE073FBFF")) + (property INITVAL_0F + (string "0x3FE3F002013FC1E3F9FF3FFFF3FFFF3FDFE3FFFF3FE3F003E103E010020100000001F001E013C3FF")) + (property INITVAL_0E + (string "0x0FFF13FFFF3F3FE3FC000000000000001F03FDFE3FFFF07FC13FFFF07E01001E01FD803FFFF3FFFF")) + (property INITVAL_0D + (string "0x3FFF13FFFF3FFFF3FE033C0FE0000000000000003C0FE000003FDFF007FF3FF013FFFF0020100200")) + (property INITVAL_0C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_09 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_08 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_07 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_06 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_05 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_04 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_03 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_02 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_01 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_00 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property CSDECODE_B + (string "0b001")) + (property CSDECODE_A + (string "0b001")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance gram0_2_0_4 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000003F83E000003FFFF3FFFF01E0100201001F01FC003E1FE3FD823FFFF387FF1FE0100201")) + (property INITVAL_1E + (string "0x000000000000000001C007E0100201001E03FD801FE01002013FE0100201001C03FC02001FE3FDFE")) + (property INITVAL_1D + (string "0x3FEFF0020100000301FE003813FFFE307FF3FE1F3FDFF01E0100000000000000000000381FE00400")) + (property INITVAL_1C + (string "0x00000001FE303FF01E01201FE03C0000000001FE006013C3FF3FFFF3FE0700000000003FC0E003F9")) + (property INITVAL_1B + (string "0x3FE3F3FBFF03FFD3FEFF000000000000000381FE3FFFF3FE3F00000000003FC1E3F07E000003E1FE")) + (property INITVAL_1A + (string "0x00000000003FC3E000003FDFF3FFFF0060100201001F80FC003F1FE3FDC23FFFF383FF1FE0100201")) + (property INITVAL_19 + (string "0x00000000003FFFF3FFFF07E0100201001E03FD800FE01003011FE0100201001E03FC00001FC0FC00")) + (property INITVAL_18 + (string "0x3FC1E0020100000301FE003813FDFE383FF3FE1F3FDFF00E010000000000001FE3FDFE3FFFF00201")) + (property INITVAL_17 + (string "0x00000201FE383FF00E01201FE01C0000000001FE00201383FF003F91FC0000000000003FC07003F1")) + (property INITVAL_16 + (string "0x3FE0F3F3FF01E01002010000000000000003E1FE3FFFF3FE1F00000000003FC1E3F87F000003F0FE")) + (property INITVAL_15 + (string "0x00000000003FC1E000013FC06383FF0020100200001FC07C00000000000000000000000000000000")) + (property INITVAL_14 + (string "0x00000001003FFFF3FFFF03E0100201001F01FDC007E01003811FE0100201001F03FC00001F81FC00")) + (property INITVAL_13 + (string "0x3FE070020100000381FE0020000000000000000000000000000000000000201FE3FDFE3FEFF00201")) + (property INITVAL_12 + (string "0x00000201FE383FF00600301FE00C0000000201FE00201303FE203FF07E0000000000003FC0300201")) + (property INITVAL_11 + (string "0x000000000000000000000000000000000003E1FE3FFFF3FE0F00000000003FC0E3FE3F000003F07E")) + (property INITVAL_10 + (string "0x00000000003FC0E000013FC0E3E3FF0000000000001FE07C00000000000000000000000000000000")) + (property INITVAL_0F + (string "0x00000001003FFFF3FFFF01E0100201001F80FDE007E01003C10FE0100201001F81FC00001F01FD80")) + (property INITVAL_0E + (string "0x1FE0100201000003C1FE001C03FDFE3C3FF3FC023FEFF002010000000000201FE3FDFE3FEFF00201")) + (property INITVAL_0D + (string "0x00000381FE3C3FF00000381FE0040000000301FE00201203FE383FF01E0100000000003FE01003FF")) + (property INITVAL_0C + (string "0x3FF073FFFF20FFF3FE1F00000000000000000000001803FC0600000000003FD073FE1F000003F83E")) + (property INITVAL_0B + (string "0x00000000003FC06002013FC1E3FC7F0000000000201FE03C003FDFE0FDF03FE7F3F3FF03E0100201")) + (property INITVAL_0A + (string "0x000000000000000001F800E0100201001FE07DF003E01003C107E0100201001F80FC00001F03FDF0")) + (property INITVAL_09 + (string "0x07E0100201000003E1FE001F03FDFE3E3FF3FD823FFFF00201000000000000000000003F87E00000")) + (property INITVAL_08 + (string "0x000003E1FE3E3FE000003C1FE0040000000381FE00201001FE3E3FF0020100000001001FE01203FF")) + (property INITVAL_07 + (string "0x3FF873FFFF307FF3FE1F00000000000000000000001C03FC0600000001003FF013FE0F000003FC1E")) + (property INITVAL_06 + (string "0x00000000003FC03002013FD9E3FC0E0000000000201FE01C003FDFE0FDF93FE3F3F3FF03E0100201")) + (property INITVAL_05 + (string "0x000000000000000001FC0060100201301FE03DF801E01003E103E0100201001FC07C00001E03FDFE")) + (property INITVAL_04 + (string "0x01E0100201000003F0FE001F03FDFE3F3FE3FDC23FFFF00201000000000000000000003F83E00000")) + (property INITVAL_03 + (string "0x000003F8FE3F0FE000003E1FE0000000000381FE00200001FE3FE7F0020100000001801FE01303FF")) + (property INITVAL_02 + (string "0x3FF833FFFF383FF3FE0F00000000000000000000001E03FC0200000001F00FF813FE0F001003FC1E")) + (property INITVAL_01 + (string "0x00000000003FE03002013F9FE3FC020000000000301FE00C003FDFE07FFD3FE1F3FBFF01E0100201")) + (property INITVAL_00 + (string "0x000000000000000001FE00601002013F9FE005F800E01003F101E0100201001FE03C00001C03FDFE")) + (property CSDECODE_B + (string "0b010")) + (property CSDECODE_A + (string "0b010")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance gram0_3_0_3 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1C + (string "0x00000000003FDFE3FDFF3FE013FBFF0FE01002013FC06000003F80E00000000003F01E381FE00000")) + (property INITVAL_1B + (string "0x000003FD063FFFF3FFFF00E0100201000000000000000000000000000000001F83FDFE3FFFF07FE1")) + (property INITVAL_1A + (string "0x3FFFF1FE01001F01FC00001E03FC0000000001C007E013FE3F00000001F021FFF3FFFF3FEFF00201")) + (property INITVAL_19 + (string "0x00000000000000000000000000000000000381FE3FFFF3FFFF3C3FE3FDFE00E01203FF00201003FE")) + (property INITVAL_18 + (string "0x0020100201381FE005E007E01002013F0FE3F1FE3FFFF3FE0F201FE3FC1E3FDFE01FF93FE0700201")) + (property INITVAL_17 + (string "0x00000000003FDFF3FFFF3FE033FFFF3FFFF002013FC0E002013FC1E00000000003F83E3C1FE00400")) + (property INITVAL_16 + (string "0x001C03FD8E3FFFF3FFFF01E013F3FF07FFD3FFFF3F9FE1FC000000000000001FC3FDFE3FFFF07FF1")) + (property INITVAL_15 + (string "0x3FFFF3FE7F001F81FC00001F03FC0000000001E007E013FA3F00000001FE30FFF3FFFF3FE7F00381")) + (property INITVAL_14 + (string "0x3FFFF387FF3FFC13FFFF002010020000000381FE3FFFF3FFFF3E3FE3FDFE1FE01303FF00201201FE")) + (property INITVAL_13 + (string "0x00201002003C1FE005C00FE01002013FC3E3F9FF3FFFF3FE07301FE3FC1E3FDFF03FFF3FE0700201")) + (property INITVAL_12 + (string "0x00000000003FFFF3FFFF3FF013FFFF3FFFF03E013FC07002013FC0E00001000003FC1E381FE00C00")) + (property INITVAL_11 + (string "0x001F03FDC03FFFF3FFFF00E013FBFF03FFD3FEFF3FDFE0FC000000000000001FE3FDFE3FFFF03FF1")) + (property INITVAL_10 + (string "0x3FFFF3FFFF003FC0FC00001F01FC0000000001E003E013FA7F00000301FE383FF3FFFF3FE7F003C1")) + (property INITVAL_0F + (string "0x3FFFF3C3FF1FFE13FFFF0020100000000003C1FE3FFFF3FFFF3E1FE3FDFE3FE07383FF00201301FE")) + (property INITVAL_0E + (string "0x00201002003E1FE001800FE01002013FC0F3FBFF3FFFF3FE03381FE3FC1E3FFFF01FFF3FE0700201")) + (property INITVAL_0D + (string "0x00000000003FDFE3FFFF3FE013FFFF3FFFF0FE013FC03002013FC0600201001003FC0E301FE01C00")) + (property INITVAL_0C + (string "0x001FE0FD003FFFF3FFFF006013FBFF01FFF3FEFF3FDFE07C0100000000000000000000201FE01C00")) + (property INITVAL_0B + (string "0x000003F1FE003FF07E00001F80FC0000000001F001E013F2FF000003E1FE00200000003FC3E001E0")) + (property INITVAL_0A + (string "0x3FEFF3C3FF0FFF13FFFF00200000000000000000000003E0FE00000000003FE0F3C3FF00200381FE")) + (property INITVAL_09 + (string "0x00201000003E0FE001801FE01003013FE0100201001E03FC023C1FE3FD0E3FFFF20FFF3FE0300201")) + (property INITVAL_08 + (string "0x000000000000000001801FE0100201001F81FC003FE03002013FC0700201001803FC0E201FE3FDFE")) + (property INITVAL_07 + (string "0x3FFFF03E0100000001FE002013FFFF21FFF3FE7F3FDFE07C0100000000000000000000301FE01C00")) + (property INITVAL_06 + (string "0x00000201FE003FF03E01001FC07C0000000001F800E013E3FF3FFFF3FEFF00000000003FC1E001E0")) + (property INITVAL_05 + (string "0x3FE7F3E3FF0FFF93FFFF00000000000000000000000003F07E00000000003FC1E3E1FF00000381FE")) + (property INITVAL_04 + (string "0x00200000003F07E001003FFFF3FFFF0FE0100201001F03FC003E1FE3FD063FFFF307FF3FE0100201")) + (property INITVAL_03 + (string "0x000000000000000001800FE0100201001E03FD003FE01002013FE0300201001C03FC06201FE3FDFE")) + (property INITVAL_02 + (string "0x3FFFF0060100000201FE003013FFFF30FFF3FE3F3FDFE03E0100000000000000000000381FE00C00")) + (property INITVAL_01 + (string "0x00000001FE203FF01E01001FE07C0000000001FC00E013C3FF3FFFF3FE1F00000000003FC0E001F1")) + (property INITVAL_00 + (string "0x3FE7F3F3FF07FF93FFFF00000000000000000000000003F87E00000000003FC1E3E0FE000003C1FE")) + (property CSDECODE_B + (string "0b011")) + (property CSDECODE_A + (string "0b011")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance gram0_4_0_2 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000003C40101E013FE0F003E1001F03FC003F8FE001C01FE013E303003F13FE0E3E0FE001E0")) + (property INITVAL_1E + (string "0x0011E03C0E3E1FE005E01FE01003FF3FE0F3FFFF20FFF3FE3F00000000000001C078F02000E1E000")) + (property INITVAL_1D + (string "0x1C00000000003C10061F3C10001D002060F3020F01C002001F3C0001C1F801E000001D1E00000000")) + (property INITVAL_1C + (string "0x3FDFE0FDF03FE7F3E3FF07E010020100000001801E2010F0000020101E010003C0001E03D0001CF0")) + (property INITVAL_1B + (string "0x2007E0E00000CE00020103C0001C003FAF3002000390001C00001E03FDFE3E3FF3FD823FFFF00201")) + (property INITVAL_1A + (string "0x0000000000301FE00D800021E000F0000003800201DE0000701E0003E10E0023D0000E001E0000E0")) + (property INITVAL_19 + (string "0x201CE27006001E0000F000000001FE3FF073FFFF307FF3FE1F0000000000000003FC7E380023C000")) + (property INITVAL_18 + (string "0x1E00000000004F10020F0F10000D8031E073800101C000001E1E0001E18E00F003FC1F3E0FE00000")) + (property INITVAL_17 + (string "0x3FDFE0FDF13FE3F3F3FF03E010020100000001F00FE0103A010030100E000001C2000E01D8000478")) + (property INITVAL_16 + (string "0x301E607000000F10020103D0001D0031E7F003F901E013FE3F001F03FDFE3F3FE3FD823FFFF00201")) + (property INITVAL_15 + (string "0x00000000000F180005C02000E00070000003C00000CF0000390F0000719C0021E2000E000E000070")) + (property INITVAL_14 + (string "0x2007E3F0023F0FE0018007E01203FF3FF833FFFF383FF3FE0F00000000000018000438380001E000")) + (property INITVAL_13 + (string "0x0F00000000002712020F07180005803FA023C00000C002000F0E0003F102006012020F0018000400")) + (property INITVAL_12 + (string "0x3FDFE07DF93FE1F3FBFF01E0100201000000003C07800039800038100C002000E3000600D8000439")) + (property INITVAL_11 + (string "0x3818207C00002790020100D8000F812023F0020101C0000039001F83FDFE3F3FE3FDC03FEFF00201")) + (property INITVAL_10 + (string "0x0000000000079C0005C03820200038000000F80000C700027907800039F80003C3C0020003C00078")) + (property INITVAL_0F + (string "0x3001E3E002000700000007800301FE3FFC13FFFF383FF3FE0F0000000000001803FC1E301FE03C00")) + (property INITVAL_0E + (string "0x3FE0F3C3FF00238300063F1FE005C03E000381FE003E13FE01070001F100003E13FE073F1FE00000")) + (property INITVAL_0D + (string "0x3FDFE03FFD3FE0F3FFFF00E010020100000001F003E013E2FF201FE1FC001FE013020300C003FE1F")) + (property INITVAL_0C + (string "0x3810003C003FC06203FF003C1007C02021F001FE00F813FE0F001F83FDFE3F9FE1FDE03FE7F00201")) + (property INITVAL_0B + (string "0x0000000000300FE0000001C013C3FF003FD00000000300030103E0101AC1001C001C001FC0000018")) + (property INITVAL_0A + (string "0x300021C0003FC3E001F800201383FE3FFC13FFFF3C3FF3FE06000000000000000000000000000000")) + (property INITVAL_09 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_08 + (string "0x3FDFF01FFF3FE0F3FFFF00E010020100000000000000000000000000000000000000000000000000")) + (property INITVAL_07 + (string "0x00000000000000000000000000000000000000000000000000001FC3FCFE3FDFE0FDF03FE3F00201")) + (property INITVAL_06 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_05 + (string "0x0000000000000000000000000381FE1FFE13FFFF3E3FF3FC02000000000000000000000000000000")) + (property INITVAL_04 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_03 + (string "0x3FDFF01FFF3FF073FFFF006010020100000000000000000000000000000000000000000000000000")) + (property INITVAL_02 + (string "0x00000000000000000000000000000000000000000000000000001FC3FC7E3FDFE07DF03FE3F00201")) + (property INITVAL_01 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_00 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property CSDECODE_B + (string "0b100")) + (property CSDECODE_A + (string "0b100")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance gram0_5_0_1 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_19 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_18 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_17 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_16 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_15 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_14 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_13 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_12 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_11 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_10 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_09 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_08 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_07 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_06 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_05 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_04 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_03 + (string "0x0000000000000000000000000000000000000000000000000000000000000000001CE0001E003C00")) + (property INITVAL_02 + (string "0x38000001FE000003F802001FC01C000020F003E0003011FE0038000381C001D003FC3E001FE01C00")) + (property INITVAL_01 + (string "0x3F1FE0FDC03FE3F3C3FF03E010020100000381E01C000381FE0020103C003FC0E001F101E013F3FF")) + (property INITVAL_00 + (string "0x0001E1C0003F87E001F800E0103A013C2E1003F907E013FAFF001C03FDFE3C3FF3FF063FFFF00601")) + (property CSDECODE_B + (string "0b101")) + (property CSDECODE_A + (string "0b101")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance scuba_vhi_inst + (viewRef view1 + (cellRef VHI))) + (instance gram0_6_0_0 + (viewRef view1 + (cellRef DP8KC)) + (property INIT_DATA + (string "STATIC")) + (property ASYNC_RESET_RELEASE + (string "SYNC")) + (property MEM_LPC_FILE + (string "gram0.lpc")) + (property MEM_INIT_FILE + (string "gram_init.mem")) + (property INITVAL_1F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_1A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_19 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_18 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_17 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_16 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_15 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_14 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_13 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_12 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_11 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_10 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0F + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0E + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0D + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0C + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0B + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_0A + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_09 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_08 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_07 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_06 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_05 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_04 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_03 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_02 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_01 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property INITVAL_00 + (string "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000")) + (property CSDECODE_B + (string "0b110")) + (property CSDECODE_A + (string "0b110")) + (property WRITEMODE_B + (string "NORMAL")) + (property WRITEMODE_A + (string "NORMAL")) + (property GSR + (string "ENABLED")) + (property RESETMODE + (string "SYNC")) + (property REGMODE_B + (string "OUTREG")) + (property REGMODE_A + (string "OUTREG")) + (property DATA_WIDTH_B + (string "9")) + (property DATA_WIDTH_A + (string "9"))) + (instance FF_11 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_10 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_9 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_8 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_7 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_6 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_5 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_4 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_3 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_2 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_1 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance FF_0 + (viewRef view1 + (cellRef FD1P3DX)) + (property GSR + (string "ENABLED"))) + (instance mux_17 + (viewRef view1 + (cellRef MUX81))) + (instance mux_16 + (viewRef view1 + (cellRef MUX81))) + (instance mux_15 + (viewRef view1 + (cellRef MUX81))) + (instance mux_14 + (viewRef view1 + (cellRef MUX81))) + (instance mux_13 + (viewRef view1 + (cellRef MUX81))) + (instance mux_12 + (viewRef view1 + (cellRef MUX81))) + (instance mux_11 + (viewRef view1 + (cellRef MUX81))) + (instance mux_10 + (viewRef view1 + (cellRef MUX81))) + (instance mux_9 + (viewRef view1 + (cellRef MUX81))) + (instance mux_8 + (viewRef view1 + (cellRef MUX81))) + (instance mux_7 + (viewRef view1 + (cellRef MUX81))) + (instance mux_6 + (viewRef view1 + (cellRef MUX81))) + (instance mux_5 + (viewRef view1 + (cellRef MUX81))) + (instance mux_4 + (viewRef view1 + (cellRef MUX81))) + (instance mux_3 + (viewRef view1 + (cellRef MUX81))) + (instance mux_2 + (viewRef view1 + (cellRef MUX81))) + (instance mux_1 + (viewRef view1 + (cellRef MUX81))) + (instance scuba_vlo_inst + (viewRef view1 + (cellRef VLO))) + (instance mux_0 + (viewRef view1 + (cellRef MUX81))) + (net wren0_inv + (joined + (portRef A (instanceRef AND2_t1)) + (portRef Z (instanceRef INV_1)))) + (net wren1_inv + (joined + (portRef A (instanceRef AND2_t0)) + (portRef Z (instanceRef INV_0)))) + (net scuba_vhi + (joined + (portRef Z (instanceRef scuba_vhi_inst)) + (portRef ADB0 (instanceRef gram0_0_0_6)) + (portRef ADA0 (instanceRef gram0_0_0_6)) + (portRef ADB0 (instanceRef gram0_1_0_5)) + (portRef ADA0 (instanceRef gram0_1_0_5)) + (portRef ADB0 (instanceRef gram0_2_0_4)) + (portRef ADA0 (instanceRef gram0_2_0_4)) + (portRef ADB0 (instanceRef gram0_3_0_3)) + (portRef ADA0 (instanceRef gram0_3_0_3)) + (portRef ADB0 (instanceRef gram0_4_0_2)) + (portRef ADA0 (instanceRef gram0_4_0_2)) + (portRef ADB0 (instanceRef gram0_5_0_1)) + (portRef ADA0 (instanceRef gram0_5_0_1)) + (portRef ADB0 (instanceRef gram0_6_0_0)) + (portRef ADA0 (instanceRef gram0_6_0_0)))) + (net wren0_inv_g + (joined + (portRef SP (instanceRef FF_9)) + (portRef Z (instanceRef AND2_t1)) + (portRef SP (instanceRef FF_11)) + (portRef SP (instanceRef FF_10)))) + (net addr010_ff + (joined + (portRef D (instanceRef FF_8)) + (portRef Q (instanceRef FF_11)))) + (net addr011_ff + (joined + (portRef D (instanceRef FF_7)) + (portRef Q (instanceRef FF_10)))) + (net addr012_ff + (joined + (portRef D (instanceRef FF_6)) + (portRef Q (instanceRef FF_9)))) + (net wren1_inv_g + (joined + (portRef SP (instanceRef FF_3)) + (portRef Z (instanceRef AND2_t0)) + (portRef SP (instanceRef FF_5)) + (portRef SP (instanceRef FF_4)))) + (net addr110_ff + (joined + (portRef D (instanceRef FF_2)) + (portRef Q (instanceRef FF_5)))) + (net addr111_ff + (joined + (portRef D (instanceRef FF_1)) + (portRef Q (instanceRef FF_4)))) + (net addr112_ff + (joined + (portRef D (instanceRef FF_0)) + (portRef Q (instanceRef FF_3)))) + (net mdout0_6_0 + (joined + (portRef D6 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_6_0_0)))) + (net mdout0_5_0 + (joined + (portRef D5 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_5_0_1)))) + (net mdout0_4_0 + (joined + (portRef D4 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_4_0_2)))) + (net mdout0_3_0 + (joined + (portRef D3 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_3_0_3)))) + (net mdout0_2_0 + (joined + (portRef D2 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_2_0_4)))) + (net mdout0_1_0 + (joined + (portRef D1 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_1_0_5)))) + (net mdout0_0_0 + (joined + (portRef D0 (instanceRef mux_17)) + (portRef DOA0 (instanceRef gram0_0_0_6)))) + (net mdout0_6_1 + (joined + (portRef D6 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_6_0_0)))) + (net mdout0_5_1 + (joined + (portRef D5 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_5_0_1)))) + (net mdout0_4_1 + (joined + (portRef D4 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_4_0_2)))) + (net mdout0_3_1 + (joined + (portRef D3 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_3_0_3)))) + (net mdout0_2_1 + (joined + (portRef D2 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_2_0_4)))) + (net mdout0_1_1 + (joined + (portRef D1 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_1_0_5)))) + (net mdout0_0_1 + (joined + (portRef D0 (instanceRef mux_16)) + (portRef DOA1 (instanceRef gram0_0_0_6)))) + (net mdout0_6_2 + (joined + (portRef D6 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_6_0_0)))) + (net mdout0_5_2 + (joined + (portRef D5 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_5_0_1)))) + (net mdout0_4_2 + (joined + (portRef D4 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_4_0_2)))) + (net mdout0_3_2 + (joined + (portRef D3 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_3_0_3)))) + (net mdout0_2_2 + (joined + (portRef D2 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_2_0_4)))) + (net mdout0_1_2 + (joined + (portRef D1 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_1_0_5)))) + (net mdout0_0_2 + (joined + (portRef D0 (instanceRef mux_15)) + (portRef DOA2 (instanceRef gram0_0_0_6)))) + (net mdout0_6_3 + (joined + (portRef D6 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_6_0_0)))) + (net mdout0_5_3 + (joined + (portRef D5 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_5_0_1)))) + (net mdout0_4_3 + (joined + (portRef D4 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_4_0_2)))) + (net mdout0_3_3 + (joined + (portRef D3 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_3_0_3)))) + (net mdout0_2_3 + (joined + (portRef D2 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_2_0_4)))) + (net mdout0_1_3 + (joined + (portRef D1 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_1_0_5)))) + (net mdout0_0_3 + (joined + (portRef D0 (instanceRef mux_14)) + (portRef DOA3 (instanceRef gram0_0_0_6)))) + (net mdout0_6_4 + (joined + (portRef D6 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_6_0_0)))) + (net mdout0_5_4 + (joined + (portRef D5 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_5_0_1)))) + (net mdout0_4_4 + (joined + (portRef D4 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_4_0_2)))) + (net mdout0_3_4 + (joined + (portRef D3 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_3_0_3)))) + (net mdout0_2_4 + (joined + (portRef D2 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_2_0_4)))) + (net mdout0_1_4 + (joined + (portRef D1 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_1_0_5)))) + (net mdout0_0_4 + (joined + (portRef D0 (instanceRef mux_13)) + (portRef DOA4 (instanceRef gram0_0_0_6)))) + (net mdout0_6_5 + (joined + (portRef D6 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_6_0_0)))) + (net mdout0_5_5 + (joined + (portRef D5 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_5_0_1)))) + (net mdout0_4_5 + (joined + (portRef D4 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_4_0_2)))) + (net mdout0_3_5 + (joined + (portRef D3 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_3_0_3)))) + (net mdout0_2_5 + (joined + (portRef D2 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_2_0_4)))) + (net mdout0_1_5 + (joined + (portRef D1 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_1_0_5)))) + (net mdout0_0_5 + (joined + (portRef D0 (instanceRef mux_12)) + (portRef DOA5 (instanceRef gram0_0_0_6)))) + (net mdout0_6_6 + (joined + (portRef D6 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_6_0_0)))) + (net mdout0_5_6 + (joined + (portRef D5 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_5_0_1)))) + (net mdout0_4_6 + (joined + (portRef D4 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_4_0_2)))) + (net mdout0_3_6 + (joined + (portRef D3 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_3_0_3)))) + (net mdout0_2_6 + (joined + (portRef D2 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_2_0_4)))) + (net mdout0_1_6 + (joined + (portRef D1 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_1_0_5)))) + (net mdout0_0_6 + (joined + (portRef D0 (instanceRef mux_11)) + (portRef DOA6 (instanceRef gram0_0_0_6)))) + (net mdout0_6_7 + (joined + (portRef D6 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_6_0_0)))) + (net mdout0_5_7 + (joined + (portRef D5 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_5_0_1)))) + (net mdout0_4_7 + (joined + (portRef D4 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_4_0_2)))) + (net mdout0_3_7 + (joined + (portRef D3 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_3_0_3)))) + (net mdout0_2_7 + (joined + (portRef D2 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_2_0_4)))) + (net mdout0_1_7 + (joined + (portRef D1 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_1_0_5)))) + (net mdout0_0_7 + (joined + (portRef D0 (instanceRef mux_10)) + (portRef DOA7 (instanceRef gram0_0_0_6)))) + (net addr012_ff2 + (joined + (portRef SD3 (instanceRef mux_9)) + (portRef Q (instanceRef FF_6)) + (portRef SD3 (instanceRef mux_17)) + (portRef SD3 (instanceRef mux_16)) + (portRef SD3 (instanceRef mux_15)) + (portRef SD3 (instanceRef mux_14)) + (portRef SD3 (instanceRef mux_13)) + (portRef SD3 (instanceRef mux_12)) + (portRef SD3 (instanceRef mux_11)) + (portRef SD3 (instanceRef mux_10)))) + (net addr011_ff2 + (joined + (portRef SD2 (instanceRef mux_9)) + (portRef Q (instanceRef FF_7)) + (portRef SD2 (instanceRef mux_17)) + (portRef SD2 (instanceRef mux_16)) + (portRef SD2 (instanceRef mux_15)) + (portRef SD2 (instanceRef mux_14)) + (portRef SD2 (instanceRef mux_13)) + (portRef SD2 (instanceRef mux_12)) + (portRef SD2 (instanceRef mux_11)) + (portRef SD2 (instanceRef mux_10)))) + (net addr010_ff2 + (joined + (portRef SD1 (instanceRef mux_9)) + (portRef Q (instanceRef FF_8)) + (portRef SD1 (instanceRef mux_17)) + (portRef SD1 (instanceRef mux_16)) + (portRef SD1 (instanceRef mux_15)) + (portRef SD1 (instanceRef mux_14)) + (portRef SD1 (instanceRef mux_13)) + (portRef SD1 (instanceRef mux_12)) + (portRef SD1 (instanceRef mux_11)) + (portRef SD1 (instanceRef mux_10)))) + (net mdout0_6_8 + (joined + (portRef D6 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_6_0_0)))) + (net mdout0_5_8 + (joined + (portRef D5 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_5_0_1)))) + (net mdout0_4_8 + (joined + (portRef D4 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_4_0_2)))) + (net mdout0_3_8 + (joined + (portRef D3 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_3_0_3)))) + (net mdout0_2_8 + (joined + (portRef D2 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_2_0_4)))) + (net mdout0_1_8 + (joined + (portRef D1 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_1_0_5)))) + (net mdout0_0_8 + (joined + (portRef D0 (instanceRef mux_9)) + (portRef DOA8 (instanceRef gram0_0_0_6)))) + (net mdout1_6_0 + (joined + (portRef D6 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_6_0_0)))) + (net mdout1_5_0 + (joined + (portRef D5 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_5_0_1)))) + (net mdout1_4_0 + (joined + (portRef D4 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_4_0_2)))) + (net mdout1_3_0 + (joined + (portRef D3 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_3_0_3)))) + (net mdout1_2_0 + (joined + (portRef D2 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_2_0_4)))) + (net mdout1_1_0 + (joined + (portRef D1 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_1_0_5)))) + (net mdout1_0_0 + (joined + (portRef D0 (instanceRef mux_8)) + (portRef DOB0 (instanceRef gram0_0_0_6)))) + (net mdout1_6_1 + (joined + (portRef D6 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_6_0_0)))) + (net mdout1_5_1 + (joined + (portRef D5 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_5_0_1)))) + (net mdout1_4_1 + (joined + (portRef D4 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_4_0_2)))) + (net mdout1_3_1 + (joined + (portRef D3 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_3_0_3)))) + (net mdout1_2_1 + (joined + (portRef D2 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_2_0_4)))) + (net mdout1_1_1 + (joined + (portRef D1 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_1_0_5)))) + (net mdout1_0_1 + (joined + (portRef D0 (instanceRef mux_7)) + (portRef DOB1 (instanceRef gram0_0_0_6)))) + (net mdout1_6_2 + (joined + (portRef D6 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_6_0_0)))) + (net mdout1_5_2 + (joined + (portRef D5 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_5_0_1)))) + (net mdout1_4_2 + (joined + (portRef D4 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_4_0_2)))) + (net mdout1_3_2 + (joined + (portRef D3 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_3_0_3)))) + (net mdout1_2_2 + (joined + (portRef D2 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_2_0_4)))) + (net mdout1_1_2 + (joined + (portRef D1 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_1_0_5)))) + (net mdout1_0_2 + (joined + (portRef D0 (instanceRef mux_6)) + (portRef DOB2 (instanceRef gram0_0_0_6)))) + (net mdout1_6_3 + (joined + (portRef D6 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_6_0_0)))) + (net mdout1_5_3 + (joined + (portRef D5 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_5_0_1)))) + (net mdout1_4_3 + (joined + (portRef D4 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_4_0_2)))) + (net mdout1_3_3 + (joined + (portRef D3 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_3_0_3)))) + (net mdout1_2_3 + (joined + (portRef D2 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_2_0_4)))) + (net mdout1_1_3 + (joined + (portRef D1 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_1_0_5)))) + (net mdout1_0_3 + (joined + (portRef D0 (instanceRef mux_5)) + (portRef DOB3 (instanceRef gram0_0_0_6)))) + (net mdout1_6_4 + (joined + (portRef D6 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_6_0_0)))) + (net mdout1_5_4 + (joined + (portRef D5 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_5_0_1)))) + (net mdout1_4_4 + (joined + (portRef D4 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_4_0_2)))) + (net mdout1_3_4 + (joined + (portRef D3 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_3_0_3)))) + (net mdout1_2_4 + (joined + (portRef D2 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_2_0_4)))) + (net mdout1_1_4 + (joined + (portRef D1 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_1_0_5)))) + (net mdout1_0_4 + (joined + (portRef D0 (instanceRef mux_4)) + (portRef DOB4 (instanceRef gram0_0_0_6)))) + (net mdout1_6_5 + (joined + (portRef D6 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_6_0_0)))) + (net mdout1_5_5 + (joined + (portRef D5 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_5_0_1)))) + (net mdout1_4_5 + (joined + (portRef D4 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_4_0_2)))) + (net mdout1_3_5 + (joined + (portRef D3 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_3_0_3)))) + (net mdout1_2_5 + (joined + (portRef D2 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_2_0_4)))) + (net mdout1_1_5 + (joined + (portRef D1 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_1_0_5)))) + (net mdout1_0_5 + (joined + (portRef D0 (instanceRef mux_3)) + (portRef DOB5 (instanceRef gram0_0_0_6)))) + (net mdout1_6_6 + (joined + (portRef D6 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_6_0_0)))) + (net mdout1_5_6 + (joined + (portRef D5 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_5_0_1)))) + (net mdout1_4_6 + (joined + (portRef D4 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_4_0_2)))) + (net mdout1_3_6 + (joined + (portRef D3 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_3_0_3)))) + (net mdout1_2_6 + (joined + (portRef D2 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_2_0_4)))) + (net mdout1_1_6 + (joined + (portRef D1 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_1_0_5)))) + (net mdout1_0_6 + (joined + (portRef D0 (instanceRef mux_2)) + (portRef DOB6 (instanceRef gram0_0_0_6)))) + (net mdout1_6_7 + (joined + (portRef D6 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_6_0_0)))) + (net mdout1_5_7 + (joined + (portRef D5 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_5_0_1)))) + (net mdout1_4_7 + (joined + (portRef D4 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_4_0_2)))) + (net mdout1_3_7 + (joined + (portRef D3 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_3_0_3)))) + (net mdout1_2_7 + (joined + (portRef D2 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_2_0_4)))) + (net mdout1_1_7 + (joined + (portRef D1 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_1_0_5)))) + (net mdout1_0_7 + (joined + (portRef D0 (instanceRef mux_1)) + (portRef DOB7 (instanceRef gram0_0_0_6)))) + (net addr112_ff2 + (joined + (portRef SD3 (instanceRef mux_0)) + (portRef Q (instanceRef FF_0)) + (portRef SD3 (instanceRef mux_8)) + (portRef SD3 (instanceRef mux_7)) + (portRef SD3 (instanceRef mux_6)) + (portRef SD3 (instanceRef mux_5)) + (portRef SD3 (instanceRef mux_4)) + (portRef SD3 (instanceRef mux_3)) + (portRef SD3 (instanceRef mux_2)) + (portRef SD3 (instanceRef mux_1)))) + (net addr111_ff2 + (joined + (portRef SD2 (instanceRef mux_0)) + (portRef Q (instanceRef FF_1)) + (portRef SD2 (instanceRef mux_8)) + (portRef SD2 (instanceRef mux_7)) + (portRef SD2 (instanceRef mux_6)) + (portRef SD2 (instanceRef mux_5)) + (portRef SD2 (instanceRef mux_4)) + (portRef SD2 (instanceRef mux_3)) + (portRef SD2 (instanceRef mux_2)) + (portRef SD2 (instanceRef mux_1)))) + (net addr110_ff2 + (joined + (portRef SD1 (instanceRef mux_0)) + (portRef Q (instanceRef FF_2)) + (portRef SD1 (instanceRef mux_8)) + (portRef SD1 (instanceRef mux_7)) + (portRef SD1 (instanceRef mux_6)) + (portRef SD1 (instanceRef mux_5)) + (portRef SD1 (instanceRef mux_4)) + (portRef SD1 (instanceRef mux_3)) + (portRef SD1 (instanceRef mux_2)) + (portRef SD1 (instanceRef mux_1)))) + (net scuba_vlo + (joined + (portRef Z (instanceRef scuba_vlo_inst)) + (portRef ADB2 (instanceRef gram0_0_0_6)) + (portRef ADA2 (instanceRef gram0_0_0_6)) + (portRef ADB1 (instanceRef gram0_0_0_6)) + (portRef ADA1 (instanceRef gram0_0_0_6)) + (portRef ADB2 (instanceRef gram0_1_0_5)) + (portRef ADA2 (instanceRef gram0_1_0_5)) + (portRef ADB1 (instanceRef gram0_1_0_5)) + (portRef ADA1 (instanceRef gram0_1_0_5)) + (portRef ADB2 (instanceRef gram0_2_0_4)) + (portRef ADA2 (instanceRef gram0_2_0_4)) + (portRef ADB1 (instanceRef gram0_2_0_4)) + (portRef ADA1 (instanceRef gram0_2_0_4)) + (portRef ADB2 (instanceRef gram0_3_0_3)) + (portRef ADA2 (instanceRef gram0_3_0_3)) + (portRef ADB1 (instanceRef gram0_3_0_3)) + (portRef ADA1 (instanceRef gram0_3_0_3)) + (portRef ADB2 (instanceRef gram0_4_0_2)) + (portRef ADA2 (instanceRef gram0_4_0_2)) + (portRef ADB1 (instanceRef gram0_4_0_2)) + (portRef ADA1 (instanceRef gram0_4_0_2)) + (portRef ADB2 (instanceRef gram0_5_0_1)) + (portRef ADA2 (instanceRef gram0_5_0_1)) + (portRef ADB1 (instanceRef gram0_5_0_1)) + (portRef ADA1 (instanceRef gram0_5_0_1)) + (portRef ADB2 (instanceRef gram0_6_0_0)) + (portRef ADA2 (instanceRef gram0_6_0_0)) + (portRef ADB1 (instanceRef gram0_6_0_0)) + (portRef ADA1 (instanceRef gram0_6_0_0)) + (portRef CD (instanceRef FF_11)) + (portRef CD (instanceRef FF_10)) + (portRef CD (instanceRef FF_9)) + (portRef CD (instanceRef FF_8)) + (portRef CD (instanceRef FF_7)) + (portRef CD (instanceRef FF_6)) + (portRef CD (instanceRef FF_5)) + (portRef CD (instanceRef FF_4)) + (portRef CD (instanceRef FF_3)) + (portRef CD (instanceRef FF_2)) + (portRef CD (instanceRef FF_1)) + (portRef CD (instanceRef FF_0)) + (portRef D7 (instanceRef mux_17)) + (portRef D7 (instanceRef mux_16)) + (portRef D7 (instanceRef mux_15)) + (portRef D7 (instanceRef mux_14)) + (portRef D7 (instanceRef mux_13)) + (portRef D7 (instanceRef mux_12)) + (portRef D7 (instanceRef mux_11)) + (portRef D7 (instanceRef mux_10)) + (portRef D7 (instanceRef mux_9)) + (portRef D7 (instanceRef mux_8)) + (portRef D7 (instanceRef mux_7)) + (portRef D7 (instanceRef mux_6)) + (portRef D7 (instanceRef mux_5)) + (portRef D7 (instanceRef mux_4)) + (portRef D7 (instanceRef mux_3)) + (portRef D7 (instanceRef mux_2)) + (portRef D7 (instanceRef mux_1)) + (portRef D7 (instanceRef mux_0)))) + (net mdout1_6_8 + (joined + (portRef D6 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_6_0_0)))) + (net mdout1_5_8 + (joined + (portRef D5 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_5_0_1)))) + (net mdout1_4_8 + (joined + (portRef D4 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_4_0_2)))) + (net mdout1_3_8 + (joined + (portRef D3 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_3_0_3)))) + (net mdout1_2_8 + (joined + (portRef D2 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_2_0_4)))) + (net mdout1_1_8 + (joined + (portRef D1 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_1_0_5)))) + (net mdout1_0_8 + (joined + (portRef D0 (instanceRef mux_0)) + (portRef DOB8 (instanceRef gram0_0_0_6)))) + (net dataout18 + (joined + (portRef (member QB 0)) + (portRef Z (instanceRef mux_0)))) + (net dataout17 + (joined + (portRef (member QB 1)) + (portRef Z (instanceRef mux_1)))) + (net dataout16 + (joined + (portRef (member QB 2)) + (portRef Z (instanceRef mux_2)))) + (net dataout15 + (joined + (portRef (member QB 3)) + (portRef Z (instanceRef mux_3)))) + (net dataout14 + (joined + (portRef (member QB 4)) + (portRef Z (instanceRef mux_4)))) + (net dataout13 + (joined + (portRef (member QB 5)) + (portRef Z (instanceRef mux_5)))) + (net dataout12 + (joined + (portRef (member QB 6)) + (portRef Z (instanceRef mux_6)))) + (net dataout11 + (joined + (portRef (member QB 7)) + (portRef Z (instanceRef mux_7)))) + (net dataout10 + (joined + (portRef (member QB 8)) + (portRef Z (instanceRef mux_8)))) + (net dataout08 + (joined + (portRef (member QA 0)) + (portRef Z (instanceRef mux_9)))) + (net dataout07 + (joined + (portRef (member QA 1)) + (portRef Z (instanceRef mux_10)))) + (net dataout06 + (joined + (portRef (member QA 2)) + (portRef Z (instanceRef mux_11)))) + (net dataout05 + (joined + (portRef (member QA 3)) + (portRef Z (instanceRef mux_12)))) + (net dataout04 + (joined + (portRef (member QA 4)) + (portRef Z (instanceRef mux_13)))) + (net dataout03 + (joined + (portRef (member QA 5)) + (portRef Z (instanceRef mux_14)))) + (net dataout02 + (joined + (portRef (member QA 6)) + (portRef Z (instanceRef mux_15)))) + (net dataout01 + (joined + (portRef (member QA 7)) + (portRef Z (instanceRef mux_16)))) + (net dataout00 + (joined + (portRef (member QA 8)) + (portRef Z (instanceRef mux_17)))) + (net ResetB + (joined + (portRef ResetB) + (portRef RSTB (instanceRef gram0_0_0_6)) + (portRef RSTB (instanceRef gram0_1_0_5)) + (portRef RSTB (instanceRef gram0_2_0_4)) + (portRef RSTB (instanceRef gram0_3_0_3)) + (portRef RSTB (instanceRef gram0_4_0_2)) + (portRef RSTB (instanceRef gram0_5_0_1)) + (portRef RSTB (instanceRef gram0_6_0_0)))) + (net ResetA + (joined + (portRef ResetA) + (portRef RSTA (instanceRef gram0_0_0_6)) + (portRef RSTA (instanceRef gram0_1_0_5)) + (portRef RSTA (instanceRef gram0_2_0_4)) + (portRef RSTA (instanceRef gram0_3_0_3)) + (portRef RSTA (instanceRef gram0_4_0_2)) + (portRef RSTA (instanceRef gram0_5_0_1)) + (portRef RSTA (instanceRef gram0_6_0_0)))) + (net wren1 + (joined + (portRef WrB) + (portRef A (instanceRef INV_0)) + (portRef WEB (instanceRef gram0_0_0_6)) + (portRef WEB (instanceRef gram0_1_0_5)) + (portRef WEB (instanceRef gram0_2_0_4)) + (portRef WEB (instanceRef gram0_3_0_3)) + (portRef WEB (instanceRef gram0_4_0_2)) + (portRef WEB (instanceRef gram0_5_0_1)) + (portRef WEB (instanceRef gram0_6_0_0)))) + (net wren0 + (joined + (portRef WrA) + (portRef A (instanceRef INV_1)) + (portRef WEA (instanceRef gram0_0_0_6)) + (portRef WEA (instanceRef gram0_1_0_5)) + (portRef WEA (instanceRef gram0_2_0_4)) + (portRef WEA (instanceRef gram0_3_0_3)) + (portRef WEA (instanceRef gram0_4_0_2)) + (portRef WEA (instanceRef gram0_5_0_1)) + (portRef WEA (instanceRef gram0_6_0_0)))) + (net ClockEnB + (joined + (portRef ClockEnB) + (portRef B (instanceRef AND2_t0)) + (portRef OCEB (instanceRef gram0_0_0_6)) + (portRef CEB (instanceRef gram0_0_0_6)) + (portRef OCEB (instanceRef gram0_1_0_5)) + (portRef CEB (instanceRef gram0_1_0_5)) + (portRef OCEB (instanceRef gram0_2_0_4)) + (portRef CEB (instanceRef gram0_2_0_4)) + (portRef OCEB (instanceRef gram0_3_0_3)) + (portRef CEB (instanceRef gram0_3_0_3)) + (portRef OCEB (instanceRef gram0_4_0_2)) + (portRef CEB (instanceRef gram0_4_0_2)) + (portRef OCEB (instanceRef gram0_5_0_1)) + (portRef CEB (instanceRef gram0_5_0_1)) + (portRef OCEB (instanceRef gram0_6_0_0)) + (portRef CEB (instanceRef gram0_6_0_0)) + (portRef SP (instanceRef FF_2)) + (portRef SP (instanceRef FF_1)) + (portRef SP (instanceRef FF_0)))) + (net ClockEnA + (joined + (portRef ClockEnA) + (portRef B (instanceRef AND2_t1)) + (portRef OCEA (instanceRef gram0_0_0_6)) + (portRef CEA (instanceRef gram0_0_0_6)) + (portRef OCEA (instanceRef gram0_1_0_5)) + (portRef CEA (instanceRef gram0_1_0_5)) + (portRef OCEA (instanceRef gram0_2_0_4)) + (portRef CEA (instanceRef gram0_2_0_4)) + (portRef OCEA (instanceRef gram0_3_0_3)) + (portRef CEA (instanceRef gram0_3_0_3)) + (portRef OCEA (instanceRef gram0_4_0_2)) + (portRef CEA (instanceRef gram0_4_0_2)) + (portRef OCEA (instanceRef gram0_5_0_1)) + (portRef CEA (instanceRef gram0_5_0_1)) + (portRef OCEA (instanceRef gram0_6_0_0)) + (portRef CEA (instanceRef gram0_6_0_0)) + (portRef SP (instanceRef FF_8)) + (portRef SP (instanceRef FF_7)) + (portRef SP (instanceRef FF_6)))) + (net clk1 + (joined + (portRef ClockB) + (portRef CLKB (instanceRef gram0_0_0_6)) + (portRef CLKB (instanceRef gram0_1_0_5)) + (portRef CLKB (instanceRef gram0_2_0_4)) + (portRef CLKB (instanceRef gram0_3_0_3)) + (portRef CLKB (instanceRef gram0_4_0_2)) + (portRef CLKB (instanceRef gram0_5_0_1)) + (portRef CLKB (instanceRef gram0_6_0_0)) + (portRef CK (instanceRef FF_5)) + (portRef CK (instanceRef FF_4)) + (portRef CK (instanceRef FF_3)) + (portRef CK (instanceRef FF_2)) + (portRef CK (instanceRef FF_1)) + (portRef CK (instanceRef FF_0)))) + (net clk0 + (joined + (portRef ClockA) + (portRef CLKA (instanceRef gram0_0_0_6)) + (portRef CLKA (instanceRef gram0_1_0_5)) + (portRef CLKA (instanceRef gram0_2_0_4)) + (portRef CLKA (instanceRef gram0_3_0_3)) + (portRef CLKA (instanceRef gram0_4_0_2)) + (portRef CLKA (instanceRef gram0_5_0_1)) + (portRef CLKA (instanceRef gram0_6_0_0)) + (portRef CK (instanceRef FF_11)) + (portRef CK (instanceRef FF_10)) + (portRef CK (instanceRef FF_9)) + (portRef CK (instanceRef FF_8)) + (portRef CK (instanceRef FF_7)) + (portRef CK (instanceRef FF_6)))) + (net addr112 + (joined + (portRef (member AddressB 0)) + (portRef CSB2 (instanceRef gram0_0_0_6)) + (portRef CSB2 (instanceRef gram0_1_0_5)) + (portRef CSB2 (instanceRef gram0_2_0_4)) + (portRef CSB2 (instanceRef gram0_3_0_3)) + (portRef CSB2 (instanceRef gram0_4_0_2)) + (portRef CSB2 (instanceRef gram0_5_0_1)) + (portRef CSB2 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_3)))) + (net addr111 + (joined + (portRef (member AddressB 1)) + (portRef CSB1 (instanceRef gram0_0_0_6)) + (portRef CSB1 (instanceRef gram0_1_0_5)) + (portRef CSB1 (instanceRef gram0_2_0_4)) + (portRef CSB1 (instanceRef gram0_3_0_3)) + (portRef CSB1 (instanceRef gram0_4_0_2)) + (portRef CSB1 (instanceRef gram0_5_0_1)) + (portRef CSB1 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_4)))) + (net addr110 + (joined + (portRef (member AddressB 2)) + (portRef CSB0 (instanceRef gram0_0_0_6)) + (portRef CSB0 (instanceRef gram0_1_0_5)) + (portRef CSB0 (instanceRef gram0_2_0_4)) + (portRef CSB0 (instanceRef gram0_3_0_3)) + (portRef CSB0 (instanceRef gram0_4_0_2)) + (portRef CSB0 (instanceRef gram0_5_0_1)) + (portRef CSB0 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_5)))) + (net addr19 + (joined + (portRef (member AddressB 3)) + (portRef ADB12 (instanceRef gram0_0_0_6)) + (portRef ADB12 (instanceRef gram0_1_0_5)) + (portRef ADB12 (instanceRef gram0_2_0_4)) + (portRef ADB12 (instanceRef gram0_3_0_3)) + (portRef ADB12 (instanceRef gram0_4_0_2)) + (portRef ADB12 (instanceRef gram0_5_0_1)) + (portRef ADB12 (instanceRef gram0_6_0_0)))) + (net addr18 + (joined + (portRef (member AddressB 4)) + (portRef ADB11 (instanceRef gram0_0_0_6)) + (portRef ADB11 (instanceRef gram0_1_0_5)) + (portRef ADB11 (instanceRef gram0_2_0_4)) + (portRef ADB11 (instanceRef gram0_3_0_3)) + (portRef ADB11 (instanceRef gram0_4_0_2)) + (portRef ADB11 (instanceRef gram0_5_0_1)) + (portRef ADB11 (instanceRef gram0_6_0_0)))) + (net addr17 + (joined + (portRef (member AddressB 5)) + (portRef ADB10 (instanceRef gram0_0_0_6)) + (portRef ADB10 (instanceRef gram0_1_0_5)) + (portRef ADB10 (instanceRef gram0_2_0_4)) + (portRef ADB10 (instanceRef gram0_3_0_3)) + (portRef ADB10 (instanceRef gram0_4_0_2)) + (portRef ADB10 (instanceRef gram0_5_0_1)) + (portRef ADB10 (instanceRef gram0_6_0_0)))) + (net addr16 + (joined + (portRef (member AddressB 6)) + (portRef ADB9 (instanceRef gram0_0_0_6)) + (portRef ADB9 (instanceRef gram0_1_0_5)) + (portRef ADB9 (instanceRef gram0_2_0_4)) + (portRef ADB9 (instanceRef gram0_3_0_3)) + (portRef ADB9 (instanceRef gram0_4_0_2)) + (portRef ADB9 (instanceRef gram0_5_0_1)) + (portRef ADB9 (instanceRef gram0_6_0_0)))) + (net addr15 + (joined + (portRef (member AddressB 7)) + (portRef ADB8 (instanceRef gram0_0_0_6)) + (portRef ADB8 (instanceRef gram0_1_0_5)) + (portRef ADB8 (instanceRef gram0_2_0_4)) + (portRef ADB8 (instanceRef gram0_3_0_3)) + (portRef ADB8 (instanceRef gram0_4_0_2)) + (portRef ADB8 (instanceRef gram0_5_0_1)) + (portRef ADB8 (instanceRef gram0_6_0_0)))) + (net addr14 + (joined + (portRef (member AddressB 8)) + (portRef ADB7 (instanceRef gram0_0_0_6)) + (portRef ADB7 (instanceRef gram0_1_0_5)) + (portRef ADB7 (instanceRef gram0_2_0_4)) + (portRef ADB7 (instanceRef gram0_3_0_3)) + (portRef ADB7 (instanceRef gram0_4_0_2)) + (portRef ADB7 (instanceRef gram0_5_0_1)) + (portRef ADB7 (instanceRef gram0_6_0_0)))) + (net addr13 + (joined + (portRef (member AddressB 9)) + (portRef ADB6 (instanceRef gram0_0_0_6)) + (portRef ADB6 (instanceRef gram0_1_0_5)) + (portRef ADB6 (instanceRef gram0_2_0_4)) + (portRef ADB6 (instanceRef gram0_3_0_3)) + (portRef ADB6 (instanceRef gram0_4_0_2)) + (portRef ADB6 (instanceRef gram0_5_0_1)) + (portRef ADB6 (instanceRef gram0_6_0_0)))) + (net addr12 + (joined + (portRef (member AddressB 10)) + (portRef ADB5 (instanceRef gram0_0_0_6)) + (portRef ADB5 (instanceRef gram0_1_0_5)) + (portRef ADB5 (instanceRef gram0_2_0_4)) + (portRef ADB5 (instanceRef gram0_3_0_3)) + (portRef ADB5 (instanceRef gram0_4_0_2)) + (portRef ADB5 (instanceRef gram0_5_0_1)) + (portRef ADB5 (instanceRef gram0_6_0_0)))) + (net addr11 + (joined + (portRef (member AddressB 11)) + (portRef ADB4 (instanceRef gram0_0_0_6)) + (portRef ADB4 (instanceRef gram0_1_0_5)) + (portRef ADB4 (instanceRef gram0_2_0_4)) + (portRef ADB4 (instanceRef gram0_3_0_3)) + (portRef ADB4 (instanceRef gram0_4_0_2)) + (portRef ADB4 (instanceRef gram0_5_0_1)) + (portRef ADB4 (instanceRef gram0_6_0_0)))) + (net addr10 + (joined + (portRef (member AddressB 12)) + (portRef ADB3 (instanceRef gram0_0_0_6)) + (portRef ADB3 (instanceRef gram0_1_0_5)) + (portRef ADB3 (instanceRef gram0_2_0_4)) + (portRef ADB3 (instanceRef gram0_3_0_3)) + (portRef ADB3 (instanceRef gram0_4_0_2)) + (portRef ADB3 (instanceRef gram0_5_0_1)) + (portRef ADB3 (instanceRef gram0_6_0_0)))) + (net addr012 + (joined + (portRef (member AddressA 0)) + (portRef CSA2 (instanceRef gram0_0_0_6)) + (portRef CSA2 (instanceRef gram0_1_0_5)) + (portRef CSA2 (instanceRef gram0_2_0_4)) + (portRef CSA2 (instanceRef gram0_3_0_3)) + (portRef CSA2 (instanceRef gram0_4_0_2)) + (portRef CSA2 (instanceRef gram0_5_0_1)) + (portRef CSA2 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_9)))) + (net addr011 + (joined + (portRef (member AddressA 1)) + (portRef CSA1 (instanceRef gram0_0_0_6)) + (portRef CSA1 (instanceRef gram0_1_0_5)) + (portRef CSA1 (instanceRef gram0_2_0_4)) + (portRef CSA1 (instanceRef gram0_3_0_3)) + (portRef CSA1 (instanceRef gram0_4_0_2)) + (portRef CSA1 (instanceRef gram0_5_0_1)) + (portRef CSA1 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_10)))) + (net addr010 + (joined + (portRef (member AddressA 2)) + (portRef CSA0 (instanceRef gram0_0_0_6)) + (portRef CSA0 (instanceRef gram0_1_0_5)) + (portRef CSA0 (instanceRef gram0_2_0_4)) + (portRef CSA0 (instanceRef gram0_3_0_3)) + (portRef CSA0 (instanceRef gram0_4_0_2)) + (portRef CSA0 (instanceRef gram0_5_0_1)) + (portRef CSA0 (instanceRef gram0_6_0_0)) + (portRef D (instanceRef FF_11)))) + (net addr09 + (joined + (portRef (member AddressA 3)) + (portRef ADA12 (instanceRef gram0_0_0_6)) + (portRef ADA12 (instanceRef gram0_1_0_5)) + (portRef ADA12 (instanceRef gram0_2_0_4)) + (portRef ADA12 (instanceRef gram0_3_0_3)) + (portRef ADA12 (instanceRef gram0_4_0_2)) + (portRef ADA12 (instanceRef gram0_5_0_1)) + (portRef ADA12 (instanceRef gram0_6_0_0)))) + (net addr08 + (joined + (portRef (member AddressA 4)) + (portRef ADA11 (instanceRef gram0_0_0_6)) + (portRef ADA11 (instanceRef gram0_1_0_5)) + (portRef ADA11 (instanceRef gram0_2_0_4)) + (portRef ADA11 (instanceRef gram0_3_0_3)) + (portRef ADA11 (instanceRef gram0_4_0_2)) + (portRef ADA11 (instanceRef gram0_5_0_1)) + (portRef ADA11 (instanceRef gram0_6_0_0)))) + (net addr07 + (joined + (portRef (member AddressA 5)) + (portRef ADA10 (instanceRef gram0_0_0_6)) + (portRef ADA10 (instanceRef gram0_1_0_5)) + (portRef ADA10 (instanceRef gram0_2_0_4)) + (portRef ADA10 (instanceRef gram0_3_0_3)) + (portRef ADA10 (instanceRef gram0_4_0_2)) + (portRef ADA10 (instanceRef gram0_5_0_1)) + (portRef ADA10 (instanceRef gram0_6_0_0)))) + (net addr06 + (joined + (portRef (member AddressA 6)) + (portRef ADA9 (instanceRef gram0_0_0_6)) + (portRef ADA9 (instanceRef gram0_1_0_5)) + (portRef ADA9 (instanceRef gram0_2_0_4)) + (portRef ADA9 (instanceRef gram0_3_0_3)) + (portRef ADA9 (instanceRef gram0_4_0_2)) + (portRef ADA9 (instanceRef gram0_5_0_1)) + (portRef ADA9 (instanceRef gram0_6_0_0)))) + (net addr05 + (joined + (portRef (member AddressA 7)) + (portRef ADA8 (instanceRef gram0_0_0_6)) + (portRef ADA8 (instanceRef gram0_1_0_5)) + (portRef ADA8 (instanceRef gram0_2_0_4)) + (portRef ADA8 (instanceRef gram0_3_0_3)) + (portRef ADA8 (instanceRef gram0_4_0_2)) + (portRef ADA8 (instanceRef gram0_5_0_1)) + (portRef ADA8 (instanceRef gram0_6_0_0)))) + (net addr04 + (joined + (portRef (member AddressA 8)) + (portRef ADA7 (instanceRef gram0_0_0_6)) + (portRef ADA7 (instanceRef gram0_1_0_5)) + (portRef ADA7 (instanceRef gram0_2_0_4)) + (portRef ADA7 (instanceRef gram0_3_0_3)) + (portRef ADA7 (instanceRef gram0_4_0_2)) + (portRef ADA7 (instanceRef gram0_5_0_1)) + (portRef ADA7 (instanceRef gram0_6_0_0)))) + (net addr03 + (joined + (portRef (member AddressA 9)) + (portRef ADA6 (instanceRef gram0_0_0_6)) + (portRef ADA6 (instanceRef gram0_1_0_5)) + (portRef ADA6 (instanceRef gram0_2_0_4)) + (portRef ADA6 (instanceRef gram0_3_0_3)) + (portRef ADA6 (instanceRef gram0_4_0_2)) + (portRef ADA6 (instanceRef gram0_5_0_1)) + (portRef ADA6 (instanceRef gram0_6_0_0)))) + (net addr02 + (joined + (portRef (member AddressA 10)) + (portRef ADA5 (instanceRef gram0_0_0_6)) + (portRef ADA5 (instanceRef gram0_1_0_5)) + (portRef ADA5 (instanceRef gram0_2_0_4)) + (portRef ADA5 (instanceRef gram0_3_0_3)) + (portRef ADA5 (instanceRef gram0_4_0_2)) + (portRef ADA5 (instanceRef gram0_5_0_1)) + (portRef ADA5 (instanceRef gram0_6_0_0)))) + (net addr01 + (joined + (portRef (member AddressA 11)) + (portRef ADA4 (instanceRef gram0_0_0_6)) + (portRef ADA4 (instanceRef gram0_1_0_5)) + (portRef ADA4 (instanceRef gram0_2_0_4)) + (portRef ADA4 (instanceRef gram0_3_0_3)) + (portRef ADA4 (instanceRef gram0_4_0_2)) + (portRef ADA4 (instanceRef gram0_5_0_1)) + (portRef ADA4 (instanceRef gram0_6_0_0)))) + (net addr00 + (joined + (portRef (member AddressA 12)) + (portRef ADA3 (instanceRef gram0_0_0_6)) + (portRef ADA3 (instanceRef gram0_1_0_5)) + (portRef ADA3 (instanceRef gram0_2_0_4)) + (portRef ADA3 (instanceRef gram0_3_0_3)) + (portRef ADA3 (instanceRef gram0_4_0_2)) + (portRef ADA3 (instanceRef gram0_5_0_1)) + (portRef ADA3 (instanceRef gram0_6_0_0)))) + (net datain18 + (joined + (portRef (member DataInB 0)) + (portRef DIB8 (instanceRef gram0_0_0_6)) + (portRef DIB8 (instanceRef gram0_1_0_5)) + (portRef DIB8 (instanceRef gram0_2_0_4)) + (portRef DIB8 (instanceRef gram0_3_0_3)) + (portRef DIB8 (instanceRef gram0_4_0_2)) + (portRef DIB8 (instanceRef gram0_5_0_1)) + (portRef DIB8 (instanceRef gram0_6_0_0)))) + (net datain17 + (joined + (portRef (member DataInB 1)) + (portRef DIB7 (instanceRef gram0_0_0_6)) + (portRef DIB7 (instanceRef gram0_1_0_5)) + (portRef DIB7 (instanceRef gram0_2_0_4)) + (portRef DIB7 (instanceRef gram0_3_0_3)) + (portRef DIB7 (instanceRef gram0_4_0_2)) + (portRef DIB7 (instanceRef gram0_5_0_1)) + (portRef DIB7 (instanceRef gram0_6_0_0)))) + (net datain16 + (joined + (portRef (member DataInB 2)) + (portRef DIB6 (instanceRef gram0_0_0_6)) + (portRef DIB6 (instanceRef gram0_1_0_5)) + (portRef DIB6 (instanceRef gram0_2_0_4)) + (portRef DIB6 (instanceRef gram0_3_0_3)) + (portRef DIB6 (instanceRef gram0_4_0_2)) + (portRef DIB6 (instanceRef gram0_5_0_1)) + (portRef DIB6 (instanceRef gram0_6_0_0)))) + (net datain15 + (joined + (portRef (member DataInB 3)) + (portRef DIB5 (instanceRef gram0_0_0_6)) + (portRef DIB5 (instanceRef gram0_1_0_5)) + (portRef DIB5 (instanceRef gram0_2_0_4)) + (portRef DIB5 (instanceRef gram0_3_0_3)) + (portRef DIB5 (instanceRef gram0_4_0_2)) + (portRef DIB5 (instanceRef gram0_5_0_1)) + (portRef DIB5 (instanceRef gram0_6_0_0)))) + (net datain14 + (joined + (portRef (member DataInB 4)) + (portRef DIB4 (instanceRef gram0_0_0_6)) + (portRef DIB4 (instanceRef gram0_1_0_5)) + (portRef DIB4 (instanceRef gram0_2_0_4)) + (portRef DIB4 (instanceRef gram0_3_0_3)) + (portRef DIB4 (instanceRef gram0_4_0_2)) + (portRef DIB4 (instanceRef gram0_5_0_1)) + (portRef DIB4 (instanceRef gram0_6_0_0)))) + (net datain13 + (joined + (portRef (member DataInB 5)) + (portRef DIB3 (instanceRef gram0_0_0_6)) + (portRef DIB3 (instanceRef gram0_1_0_5)) + (portRef DIB3 (instanceRef gram0_2_0_4)) + (portRef DIB3 (instanceRef gram0_3_0_3)) + (portRef DIB3 (instanceRef gram0_4_0_2)) + (portRef DIB3 (instanceRef gram0_5_0_1)) + (portRef DIB3 (instanceRef gram0_6_0_0)))) + (net datain12 + (joined + (portRef (member DataInB 6)) + (portRef DIB2 (instanceRef gram0_0_0_6)) + (portRef DIB2 (instanceRef gram0_1_0_5)) + (portRef DIB2 (instanceRef gram0_2_0_4)) + (portRef DIB2 (instanceRef gram0_3_0_3)) + (portRef DIB2 (instanceRef gram0_4_0_2)) + (portRef DIB2 (instanceRef gram0_5_0_1)) + (portRef DIB2 (instanceRef gram0_6_0_0)))) + (net datain11 + (joined + (portRef (member DataInB 7)) + (portRef DIB1 (instanceRef gram0_0_0_6)) + (portRef DIB1 (instanceRef gram0_1_0_5)) + (portRef DIB1 (instanceRef gram0_2_0_4)) + (portRef DIB1 (instanceRef gram0_3_0_3)) + (portRef DIB1 (instanceRef gram0_4_0_2)) + (portRef DIB1 (instanceRef gram0_5_0_1)) + (portRef DIB1 (instanceRef gram0_6_0_0)))) + (net datain10 + (joined + (portRef (member DataInB 8)) + (portRef DIB0 (instanceRef gram0_0_0_6)) + (portRef DIB0 (instanceRef gram0_1_0_5)) + (portRef DIB0 (instanceRef gram0_2_0_4)) + (portRef DIB0 (instanceRef gram0_3_0_3)) + (portRef DIB0 (instanceRef gram0_4_0_2)) + (portRef DIB0 (instanceRef gram0_5_0_1)) + (portRef DIB0 (instanceRef gram0_6_0_0)))) + (net datain08 + (joined + (portRef (member DataInA 0)) + (portRef DIA8 (instanceRef gram0_0_0_6)) + (portRef DIA8 (instanceRef gram0_1_0_5)) + (portRef DIA8 (instanceRef gram0_2_0_4)) + (portRef DIA8 (instanceRef gram0_3_0_3)) + (portRef DIA8 (instanceRef gram0_4_0_2)) + (portRef DIA8 (instanceRef gram0_5_0_1)) + (portRef DIA8 (instanceRef gram0_6_0_0)))) + (net datain07 + (joined + (portRef (member DataInA 1)) + (portRef DIA7 (instanceRef gram0_0_0_6)) + (portRef DIA7 (instanceRef gram0_1_0_5)) + (portRef DIA7 (instanceRef gram0_2_0_4)) + (portRef DIA7 (instanceRef gram0_3_0_3)) + (portRef DIA7 (instanceRef gram0_4_0_2)) + (portRef DIA7 (instanceRef gram0_5_0_1)) + (portRef DIA7 (instanceRef gram0_6_0_0)))) + (net datain06 + (joined + (portRef (member DataInA 2)) + (portRef DIA6 (instanceRef gram0_0_0_6)) + (portRef DIA6 (instanceRef gram0_1_0_5)) + (portRef DIA6 (instanceRef gram0_2_0_4)) + (portRef DIA6 (instanceRef gram0_3_0_3)) + (portRef DIA6 (instanceRef gram0_4_0_2)) + (portRef DIA6 (instanceRef gram0_5_0_1)) + (portRef DIA6 (instanceRef gram0_6_0_0)))) + (net datain05 + (joined + (portRef (member DataInA 3)) + (portRef DIA5 (instanceRef gram0_0_0_6)) + (portRef DIA5 (instanceRef gram0_1_0_5)) + (portRef DIA5 (instanceRef gram0_2_0_4)) + (portRef DIA5 (instanceRef gram0_3_0_3)) + (portRef DIA5 (instanceRef gram0_4_0_2)) + (portRef DIA5 (instanceRef gram0_5_0_1)) + (portRef DIA5 (instanceRef gram0_6_0_0)))) + (net datain04 + (joined + (portRef (member DataInA 4)) + (portRef DIA4 (instanceRef gram0_0_0_6)) + (portRef DIA4 (instanceRef gram0_1_0_5)) + (portRef DIA4 (instanceRef gram0_2_0_4)) + (portRef DIA4 (instanceRef gram0_3_0_3)) + (portRef DIA4 (instanceRef gram0_4_0_2)) + (portRef DIA4 (instanceRef gram0_5_0_1)) + (portRef DIA4 (instanceRef gram0_6_0_0)))) + (net datain03 + (joined + (portRef (member DataInA 5)) + (portRef DIA3 (instanceRef gram0_0_0_6)) + (portRef DIA3 (instanceRef gram0_1_0_5)) + (portRef DIA3 (instanceRef gram0_2_0_4)) + (portRef DIA3 (instanceRef gram0_3_0_3)) + (portRef DIA3 (instanceRef gram0_4_0_2)) + (portRef DIA3 (instanceRef gram0_5_0_1)) + (portRef DIA3 (instanceRef gram0_6_0_0)))) + (net datain02 + (joined + (portRef (member DataInA 6)) + (portRef DIA2 (instanceRef gram0_0_0_6)) + (portRef DIA2 (instanceRef gram0_1_0_5)) + (portRef DIA2 (instanceRef gram0_2_0_4)) + (portRef DIA2 (instanceRef gram0_3_0_3)) + (portRef DIA2 (instanceRef gram0_4_0_2)) + (portRef DIA2 (instanceRef gram0_5_0_1)) + (portRef DIA2 (instanceRef gram0_6_0_0)))) + (net datain01 + (joined + (portRef (member DataInA 7)) + (portRef DIA1 (instanceRef gram0_0_0_6)) + (portRef DIA1 (instanceRef gram0_1_0_5)) + (portRef DIA1 (instanceRef gram0_2_0_4)) + (portRef DIA1 (instanceRef gram0_3_0_3)) + (portRef DIA1 (instanceRef gram0_4_0_2)) + (portRef DIA1 (instanceRef gram0_5_0_1)) + (portRef DIA1 (instanceRef gram0_6_0_0)))) + (net datain00 + (joined + (portRef (member DataInA 8)) + (portRef DIA0 (instanceRef gram0_0_0_6)) + (portRef DIA0 (instanceRef gram0_1_0_5)) + (portRef DIA0 (instanceRef gram0_2_0_4)) + (portRef DIA0 (instanceRef gram0_3_0_3)) + (portRef DIA0 (instanceRef gram0_4_0_2)) + (portRef DIA0 (instanceRef gram0_5_0_1)) + (portRef DIA0 (instanceRef gram0_6_0_0)))))))) + (design gram0 + (cellRef gram0 + (libraryRef ORCLIB))) +) diff --git a/display/fpga/ip/gram0/gram0.ipx b/display/fpga/ip/gram0/gram0.ipx new file mode 100644 index 0000000..cd4a876 --- /dev/null +++ b/display/fpga/ip/gram0/gram0.ipx @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/display/fpga/ip/gram0/gram0.jhd b/display/fpga/ip/gram0/gram0.jhd new file mode 100644 index 0000000..108a5c7 --- /dev/null +++ b/display/fpga/ip/gram0/gram0.jhd @@ -0,0 +1,87 @@ +MODULE gram0 DEFIN gram0.vhd + SUBMODULE MUX81 + INSTANCE mux_0 + SUBMODULE VLO + INSTANCE scuba_vlo_inst + SUBMODULE MUX81 + INSTANCE mux_1 + SUBMODULE MUX81 + INSTANCE mux_2 + SUBMODULE MUX81 + INSTANCE mux_3 + SUBMODULE MUX81 + INSTANCE mux_4 + SUBMODULE MUX81 + INSTANCE mux_5 + SUBMODULE MUX81 + INSTANCE mux_6 + SUBMODULE MUX81 + INSTANCE mux_7 + SUBMODULE MUX81 + INSTANCE mux_8 + SUBMODULE MUX81 + INSTANCE mux_9 + SUBMODULE MUX81 + INSTANCE mux_10 + SUBMODULE MUX81 + INSTANCE mux_11 + SUBMODULE MUX81 + INSTANCE mux_12 + SUBMODULE MUX81 + INSTANCE mux_13 + SUBMODULE MUX81 + INSTANCE mux_14 + SUBMODULE MUX81 + INSTANCE mux_15 + SUBMODULE MUX81 + INSTANCE mux_16 + SUBMODULE MUX81 + INSTANCE mux_17 + SUBMODULE FD1P3DX + INSTANCE FF_0 + SUBMODULE FD1P3DX + INSTANCE FF_1 + SUBMODULE FD1P3DX + INSTANCE FF_2 + SUBMODULE FD1P3DX + INSTANCE FF_3 + SUBMODULE FD1P3DX + INSTANCE FF_4 + SUBMODULE FD1P3DX + INSTANCE FF_5 + SUBMODULE FD1P3DX + INSTANCE FF_6 + SUBMODULE FD1P3DX + INSTANCE FF_7 + SUBMODULE FD1P3DX + INSTANCE FF_8 + SUBMODULE FD1P3DX + INSTANCE FF_9 + SUBMODULE FD1P3DX + INSTANCE FF_10 + SUBMODULE FD1P3DX + INSTANCE FF_11 + SUBMODULE DP8KC + INSTANCE gram0_6_0_0 + SUBMODULE VHI + INSTANCE scuba_vhi_inst + SUBMODULE DP8KC + INSTANCE gram0_5_0_1 + SUBMODULE DP8KC + INSTANCE gram0_4_0_2 + SUBMODULE DP8KC + INSTANCE gram0_3_0_3 + SUBMODULE DP8KC + INSTANCE gram0_2_0_4 + SUBMODULE DP8KC + INSTANCE gram0_1_0_5 + SUBMODULE DP8KC + INSTANCE gram0_0_0_6 + SUBMODULE AND2 + INSTANCE AND2_t0 + SUBMODULE INV + INSTANCE INV_0 + SUBMODULE AND2 + INSTANCE AND2_t1 + SUBMODULE INV + INSTANCE INV_1 diff --git a/display/fpga/ip/gram0/gram0.lpc b/display/fpga/ip/gram0/gram0.lpc new file mode 100644 index 0000000..b78364e --- /dev/null +++ b/display/fpga/ip/gram0/gram0.lpc @@ -0,0 +1,56 @@ +[Device] +Family=machxo2 +PartType=LCMXO2-1200HC +PartName=LCMXO2-1200HC-5SG32C +SpeedGrade=5 +Package=QFN32 +OperatingCondition=COM +Status=S + +[IP] +VendorName=Lattice Semiconductor Corporation +CoreType=LPM +CoreStatus=Demo +CoreName=RAM_DP_TRUE +CoreRevision=7.5 +ModuleName=gram0 +SourceFormat=VHDL +ParameterFileVersion=1.0 +Date=04/22/2018 +Time=17:34:06 + +[Parameters] +Verilog=0 +VHDL=1 +EDIF=1 +Destination=Synplicity +Expression=BusA(0 to 7) +Order=Big Endian [MSB:LSB] +IO=0 +RAddress=7000 +RData=9 +WAddress=7000 +WData=9 +ROutputEn=1 +RClockEn=0 +WOutputEn=1 +WClockEn=0 +enByte=0 +ByteSize=8 +Optimization=Speed +Reset=Sync +Reset1=Sync +Init=mem +MemFile=/home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem +MemFormat=bin +EnECC=0 +Pipeline=0 +WriteA=Normal +WriteB=Normal +init_data=0 + +[FilesGenerated] +/home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem=mem + +[Command] +cmd_line= -w -n gram0 -lang vhdl -synth synplify -bus_exp 7 -bb -arch xo2c00 -type ramdp -device LCMXO2-1200HC -aaddr_width 13 -widtha 9 -baddr_width 13 -widthb 9 -anum_words 7000 -bnum_words 7000 -outdataA REGISTERED -outdataB REGISTERED -cascade -1 -resetmode SYNC -sync_reset -memfile /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem -memformat bin -writemodeA NORMAL -writemodeB NORMAL diff --git a/display/fpga/ip/gram0/gram0.naf b/display/fpga/ip/gram0/gram0.naf new file mode 100644 index 0000000..2340aef --- /dev/null +++ b/display/fpga/ip/gram0/gram0.naf @@ -0,0 +1,70 @@ +DataInA[8] i +DataInA[7] i +DataInA[6] i +DataInA[5] i +DataInA[4] i +DataInA[3] i +DataInA[2] i +DataInA[1] i +DataInA[0] i +DataInB[8] i +DataInB[7] i +DataInB[6] i +DataInB[5] i +DataInB[4] i +DataInB[3] i +DataInB[2] i +DataInB[1] i +DataInB[0] i +AddressA[12] i +AddressA[11] i +AddressA[10] i +AddressA[9] i +AddressA[8] i +AddressA[7] i +AddressA[6] i +AddressA[5] i +AddressA[4] i +AddressA[3] i +AddressA[2] i +AddressA[1] i +AddressA[0] i +AddressB[12] i +AddressB[11] i +AddressB[10] i +AddressB[9] i +AddressB[8] i +AddressB[7] i +AddressB[6] i +AddressB[5] i +AddressB[4] i +AddressB[3] i +AddressB[2] i +AddressB[1] i +AddressB[0] i +ClockA i +ClockB i +ClockEnA i +ClockEnB i +WrA i +WrB i +ResetA i +ResetB i +QA[8] o +QA[7] o +QA[6] o +QA[5] o +QA[4] o +QA[3] o +QA[2] o +QA[1] o +QA[0] o +QB[8] o +QB[7] o +QB[6] o +QB[5] o +QB[4] o +QB[3] o +QB[2] o +QB[1] o +QB[0] o diff --git a/display/fpga/ip/gram0/gram0.sort b/display/fpga/ip/gram0/gram0.sort new file mode 100644 index 0000000..4b47368 --- /dev/null +++ b/display/fpga/ip/gram0/gram0.sort @@ -0,0 +1 @@ +gram0.vhd diff --git a/display/fpga/ip/gram0/gram0.srp b/display/fpga/ip/gram0/gram0.srp new file mode 100644 index 0000000..54cb630 --- /dev/null +++ b/display/fpga/ip/gram0/gram0.srp @@ -0,0 +1,35 @@ +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Sun Apr 22 17:34:06 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n gram0 -lang vhdl -synth synplify -bus_exp 7 -bb -arch xo2c00 -type ramdp -device LCMXO2-1200HC -aaddr_width 13 -widtha 9 -baddr_width 13 -widthb 9 -anum_words 7000 -bnum_words 7000 -outdataA REGISTERED -outdataB REGISTERED -cascade -1 -resetmode SYNC -sync_reset -memfile /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem -memformat bin -writemodeA NORMAL -writemodeB NORMAL + Circuit name : gram0 + Module type : RAM_DP_TRUE + Module Version : 7.5 + Ports : + Inputs : DataInA[8:0], DataInB[8:0], AddressA[12:0], AddressB[12:0], ClockA, ClockB, ClockEnA, ClockEnB, WrA, WrB, ResetA, ResetB + Outputs : QA[8:0], QB[8:0] + I/O buffer : not inserted + Memory file : /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem + EDIF output : gram0.edn + VHDL output : gram0.vhd + VHDL template : gram0_tmpl.vhd + VHDL testbench : tb_gram0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : gram0.srp + Element Usage : + AND2 : 2 + FD1P3DX : 12 + INV : 2 + MUX81 : 18 + DP8KC : 7 + Estimated Resource Usage: + LUT : 38 + EBR : 7 + Reg : 12 diff --git a/display/fpga/ip/gram0/gram0.sym b/display/fpga/ip/gram0/gram0.sym new file mode 100644 index 0000000000000000000000000000000000000000..f403becb5f257ab17990af4a3638ab85950009a2 GIT binary patch literal 586 zcmY+Cu}cC`9LIm(XIVywLsK-|AR-NMIZ1=uT^i-m6_tY(NLoQ#ab2LVT zV>C%avqZChK$BBLQ{Q`+k_V6b@cI7Ud%t(@o(jSz#F1AMK8mX>WylroAksvJrYnmQ z&k~|`x$ITyb-TEnS}_kq_WcQ1A5WcO>M=BN9HimZ^UI?%TjZM7Mf1OPMDA&8xDD*I zuFX|h{X*ZyGz=jH*Ef!4=>5*~d5UvvB5ntPbOl=KY5QH{&ci0ENCQg|){B+pF zD4m-;@k$q_+#m^4WrA, Z=>wren0_inv); + + AND2_t1: AND2 + port map (A=>wren0_inv, B=>ClockEnA, Z=>wren0_inv_g); + + INV_0: INV + port map (A=>WrB, Z=>wren1_inv); + + AND2_t0: AND2 + port map (A=>wren1_inv, B=>ClockEnB, Z=>wren1_inv_g); + + gram0_0_0_6: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_19=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_18=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_17=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_16=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_15=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_14=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_13=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_12=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_11=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_10=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_09=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_08=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_07=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_06=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_05=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_04=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_03=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_02=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_01=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_00=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + CSDECODE_B=> "0b000", CSDECODE_A=> "0b000", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_0_8, DOA7=>mdout0_0_7, + DOA6=>mdout0_0_6, DOA5=>mdout0_0_5, DOA4=>mdout0_0_4, + DOA3=>mdout0_0_3, DOA2=>mdout0_0_2, DOA1=>mdout0_0_1, + DOA0=>mdout0_0_0, DOB8=>mdout1_0_8, DOB7=>mdout1_0_7, + DOB6=>mdout1_0_6, DOB5=>mdout1_0_5, DOB4=>mdout1_0_4, + DOB3=>mdout1_0_3, DOB2=>mdout1_0_2, DOB1=>mdout1_0_1, + DOB0=>mdout1_0_0); + + gram0_1_0_5: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x0020100201000003F07E001F83FDFE3FBFE3FDC03FEFF00201000000000000000000003FC1E00000", + INITVAL_1E=> "0x001F03FC3E3F87E000003E0FE00000000003C1FE00000001FC3FE0F0020100000001C00FE01303FF", + INITVAL_1D=> "0x3FFC13FFFF3C3FF3FE0F00000000000000000000001F03FC00000003F1FE03FC13FE07001803FC0E", + INITVAL_1C=> "0x00000001003FE01002013F9FE0FC000000000000381FE00C003FDFF03FFD3FE0F3FFFF00E0100201", + INITVAL_1B=> "0x00000001FC3FFFF3FFFF303FF3FFFF3FEFF003FD207FF3FFFF3FFFF07FFF3FFFF3FFFF00F813FFFF", + INITVAL_1A=> "0x0020100000000003F83E001FC3FDFE3FDFE1FDE03FE7F0020100000000003FDFE3FDFE3FE1F3F3FF", + INITVAL_19=> "0x3FFFF3FE033F83E3F1FE3FFFF3FFFF3FFFF3FDFF3FEFF003F93FE030020100000001C007E01383FF", + INITVAL_18=> "0x3FFE13FFFF3C3FF3FE060000000000001E03FDFE3FFFF1FF813FFFF3FFFF003E13FF833FFFF3FFFF", + INITVAL_17=> "0x3FFF73FFFF3FFFF3FE0F3F1FE03C0000000000003C1FE004003FDFF01FFF3FF0F3FFFF00E0100201", + INITVAL_16=> "0x00000001FE3FFFF3FFFF383FF3FFFE3FE0F003FF307FF3FFFF3FFFF27FFF3FFFF3FFFF00F013FEFF", + INITVAL_15=> "0x0000000000000003FC1E001FE3FCFE3FDFE0FDF03FE3F0020100000000003FDFE3FDFF3FE0F3FBFF", + INITVAL_14=> "0x3FFFF07E013FC1E3F1FE3FFFF3FFFF3FFFE3FDFF3FE7F003F10FE010020100000001E003E013C3FF", + INITVAL_13=> "0x1FFF13FFFF3F3FF3FC020000000000001F03FDFE3FFFF0FFC13FFFF3FEFF001E03FDC03FFFF3FFFF", + INITVAL_12=> "0x3FFFB3FFFF3FFFF3FE073E1FE00C0000000000003C1FE000003FFFF21FFF3FF873FFFF0060100201", + INITVAL_11=> "0x00000201FE3FFFF3FFFF383FF3FDFE03E01203FF383FF3FFFF3FFFF37FFF3FFFF3FFFF00F013FE3F", + INITVAL_10=> "0x0000000000001003FC1E001FE3FC7E3FDFE0FDF93FE3F0020100000000003FDFE3FDFF3FE073FBFF", + INITVAL_0F=> "0x3FE3F002013FC1E3F9FF3FFFF3FFFF3FDFE3FFFF3FE3F003E103E010020100000001F001E013C3FF", + INITVAL_0E=> "0x0FFF13FFFF3F3FE3FC000000000000001F03FDFE3FFFF07FC13FFFF07E01001E01FD803FFFF3FFFF", + INITVAL_0D=> "0x3FFF13FFFF3FFFF3FE033C0FE0000000000000003C0FE000003FDFF007FF3FF013FFFF0020100200", + INITVAL_0C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_09=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_08=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_07=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_06=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_05=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_04=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_03=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_02=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_01=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_00=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + CSDECODE_B=> "0b001", CSDECODE_A=> "0b001", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_1_8, DOA7=>mdout0_1_7, + DOA6=>mdout0_1_6, DOA5=>mdout0_1_5, DOA4=>mdout0_1_4, + DOA3=>mdout0_1_3, DOA2=>mdout0_1_2, DOA1=>mdout0_1_1, + DOA0=>mdout0_1_0, DOB8=>mdout1_1_8, DOB7=>mdout1_1_7, + DOB6=>mdout1_1_6, DOB5=>mdout1_1_5, DOB4=>mdout1_1_4, + DOB3=>mdout1_1_3, DOB2=>mdout1_1_2, DOB1=>mdout1_1_1, + DOB0=>mdout1_1_0); + + gram0_2_0_4: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000003F83E000003FFFF3FFFF01E0100201001F01FC003E1FE3FD823FFFF387FF1FE0100201", + INITVAL_1E=> "0x000000000000000001C007E0100201001E03FD801FE01002013FE0100201001C03FC02001FE3FDFE", + INITVAL_1D=> "0x3FEFF0020100000301FE003813FFFE307FF3FE1F3FDFF01E0100000000000000000000381FE00400", + INITVAL_1C=> "0x00000001FE303FF01E01201FE03C0000000001FE006013C3FF3FFFF3FE0700000000003FC0E003F9", + INITVAL_1B=> "0x3FE3F3FBFF03FFD3FEFF000000000000000381FE3FFFF3FE3F00000000003FC1E3F07E000003E1FE", + INITVAL_1A=> "0x00000000003FC3E000003FDFF3FFFF0060100201001F80FC003F1FE3FDC23FFFF383FF1FE0100201", + INITVAL_19=> "0x00000000003FFFF3FFFF07E0100201001E03FD800FE01003011FE0100201001E03FC00001FC0FC00", + INITVAL_18=> "0x3FC1E0020100000301FE003813FDFE383FF3FE1F3FDFF00E010000000000001FE3FDFE3FFFF00201", + INITVAL_17=> "0x00000201FE383FF00E01201FE01C0000000001FE00201383FF003F91FC0000000000003FC07003F1", + INITVAL_16=> "0x3FE0F3F3FF01E01002010000000000000003E1FE3FFFF3FE1F00000000003FC1E3F87F000003F0FE", + INITVAL_15=> "0x00000000003FC1E000013FC06383FF0020100200001FC07C00000000000000000000000000000000", + INITVAL_14=> "0x00000001003FFFF3FFFF03E0100201001F01FDC007E01003811FE0100201001F03FC00001F81FC00", + INITVAL_13=> "0x3FE070020100000381FE0020000000000000000000000000000000000000201FE3FDFE3FEFF00201", + INITVAL_12=> "0x00000201FE383FF00600301FE00C0000000201FE00201303FE203FF07E0000000000003FC0300201", + INITVAL_11=> "0x000000000000000000000000000000000003E1FE3FFFF3FE0F00000000003FC0E3FE3F000003F07E", + INITVAL_10=> "0x00000000003FC0E000013FC0E3E3FF0000000000001FE07C00000000000000000000000000000000", + INITVAL_0F=> "0x00000001003FFFF3FFFF01E0100201001F80FDE007E01003C10FE0100201001F81FC00001F01FD80", + INITVAL_0E=> "0x1FE0100201000003C1FE001C03FDFE3C3FF3FC023FEFF002010000000000201FE3FDFE3FEFF00201", + INITVAL_0D=> "0x00000381FE3C3FF00000381FE0040000000301FE00201203FE383FF01E0100000000003FE01003FF", + INITVAL_0C=> "0x3FF073FFFF20FFF3FE1F00000000000000000000001803FC0600000000003FD073FE1F000003F83E", + INITVAL_0B=> "0x00000000003FC06002013FC1E3FC7F0000000000201FE03C003FDFE0FDF03FE7F3F3FF03E0100201", + INITVAL_0A=> "0x000000000000000001F800E0100201001FE07DF003E01003C107E0100201001F80FC00001F03FDF0", + INITVAL_09=> "0x07E0100201000003E1FE001F03FDFE3E3FF3FD823FFFF00201000000000000000000003F87E00000", + INITVAL_08=> "0x000003E1FE3E3FE000003C1FE0040000000381FE00201001FE3E3FF0020100000001001FE01203FF", + INITVAL_07=> "0x3FF873FFFF307FF3FE1F00000000000000000000001C03FC0600000001003FF013FE0F000003FC1E", + INITVAL_06=> "0x00000000003FC03002013FD9E3FC0E0000000000201FE01C003FDFE0FDF93FE3F3F3FF03E0100201", + INITVAL_05=> "0x000000000000000001FC0060100201301FE03DF801E01003E103E0100201001FC07C00001E03FDFE", + INITVAL_04=> "0x01E0100201000003F0FE001F03FDFE3F3FE3FDC23FFFF00201000000000000000000003F83E00000", + INITVAL_03=> "0x000003F8FE3F0FE000003E1FE0000000000381FE00200001FE3FE7F0020100000001801FE01303FF", + INITVAL_02=> "0x3FF833FFFF383FF3FE0F00000000000000000000001E03FC0200000001F00FF813FE0F001003FC1E", + INITVAL_01=> "0x00000000003FE03002013F9FE3FC020000000000301FE00C003FDFE07FFD3FE1F3FBFF01E0100201", + INITVAL_00=> "0x000000000000000001FE00601002013F9FE005F800E01003F101E0100201001FE03C00001C03FDFE", + CSDECODE_B=> "0b010", CSDECODE_A=> "0b010", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_2_8, DOA7=>mdout0_2_7, + DOA6=>mdout0_2_6, DOA5=>mdout0_2_5, DOA4=>mdout0_2_4, + DOA3=>mdout0_2_3, DOA2=>mdout0_2_2, DOA1=>mdout0_2_1, + DOA0=>mdout0_2_0, DOB8=>mdout1_2_8, DOB7=>mdout1_2_7, + DOB6=>mdout1_2_6, DOB5=>mdout1_2_5, DOB4=>mdout1_2_4, + DOB3=>mdout1_2_3, DOB2=>mdout1_2_2, DOB1=>mdout1_2_1, + DOB0=>mdout1_2_0); + + gram0_3_0_3: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1C=> "0x00000000003FDFE3FDFF3FE013FBFF0FE01002013FC06000003F80E00000000003F01E381FE00000", + INITVAL_1B=> "0x000003FD063FFFF3FFFF00E0100201000000000000000000000000000000001F83FDFE3FFFF07FE1", + INITVAL_1A=> "0x3FFFF1FE01001F01FC00001E03FC0000000001C007E013FE3F00000001F021FFF3FFFF3FEFF00201", + INITVAL_19=> "0x00000000000000000000000000000000000381FE3FFFF3FFFF3C3FE3FDFE00E01203FF00201003FE", + INITVAL_18=> "0x0020100201381FE005E007E01002013F0FE3F1FE3FFFF3FE0F201FE3FC1E3FDFE01FF93FE0700201", + INITVAL_17=> "0x00000000003FDFF3FFFF3FE033FFFF3FFFF002013FC0E002013FC1E00000000003F83E3C1FE00400", + INITVAL_16=> "0x001C03FD8E3FFFF3FFFF01E013F3FF07FFD3FFFF3F9FE1FC000000000000001FC3FDFE3FFFF07FF1", + INITVAL_15=> "0x3FFFF3FE7F001F81FC00001F03FC0000000001E007E013FA3F00000001FE30FFF3FFFF3FE7F00381", + INITVAL_14=> "0x3FFFF387FF3FFC13FFFF002010020000000381FE3FFFF3FFFF3E3FE3FDFE1FE01303FF00201201FE", + INITVAL_13=> "0x00201002003C1FE005C00FE01002013FC3E3F9FF3FFFF3FE07301FE3FC1E3FDFF03FFF3FE0700201", + INITVAL_12=> "0x00000000003FFFF3FFFF3FF013FFFF3FFFF03E013FC07002013FC0E00001000003FC1E381FE00C00", + INITVAL_11=> "0x001F03FDC03FFFF3FFFF00E013FBFF03FFD3FEFF3FDFE0FC000000000000001FE3FDFE3FFFF03FF1", + INITVAL_10=> "0x3FFFF3FFFF003FC0FC00001F01FC0000000001E003E013FA7F00000301FE383FF3FFFF3FE7F003C1", + INITVAL_0F=> "0x3FFFF3C3FF1FFE13FFFF0020100000000003C1FE3FFFF3FFFF3E1FE3FDFE3FE07383FF00201301FE", + INITVAL_0E=> "0x00201002003E1FE001800FE01002013FC0F3FBFF3FFFF3FE03381FE3FC1E3FFFF01FFF3FE0700201", + INITVAL_0D=> "0x00000000003FDFE3FFFF3FE013FFFF3FFFF0FE013FC03002013FC0600201001003FC0E301FE01C00", + INITVAL_0C=> "0x001FE0FD003FFFF3FFFF006013FBFF01FFF3FEFF3FDFE07C0100000000000000000000201FE01C00", + INITVAL_0B=> "0x000003F1FE003FF07E00001F80FC0000000001F001E013F2FF000003E1FE00200000003FC3E001E0", + INITVAL_0A=> "0x3FEFF3C3FF0FFF13FFFF00200000000000000000000003E0FE00000000003FE0F3C3FF00200381FE", + INITVAL_09=> "0x00201000003E0FE001801FE01003013FE0100201001E03FC023C1FE3FD0E3FFFF20FFF3FE0300201", + INITVAL_08=> "0x000000000000000001801FE0100201001F81FC003FE03002013FC0700201001803FC0E201FE3FDFE", + INITVAL_07=> "0x3FFFF03E0100000001FE002013FFFF21FFF3FE7F3FDFE07C0100000000000000000000301FE01C00", + INITVAL_06=> "0x00000201FE003FF03E01001FC07C0000000001F800E013E3FF3FFFF3FEFF00000000003FC1E001E0", + INITVAL_05=> "0x3FE7F3E3FF0FFF93FFFF00000000000000000000000003F07E00000000003FC1E3E1FF00000381FE", + INITVAL_04=> "0x00200000003F07E001003FFFF3FFFF0FE0100201001F03FC003E1FE3FD063FFFF307FF3FE0100201", + INITVAL_03=> "0x000000000000000001800FE0100201001E03FD003FE01002013FE0300201001C03FC06201FE3FDFE", + INITVAL_02=> "0x3FFFF0060100000201FE003013FFFF30FFF3FE3F3FDFE03E0100000000000000000000381FE00C00", + INITVAL_01=> "0x00000001FE203FF01E01001FE07C0000000001FC00E013C3FF3FFFF3FE1F00000000003FC0E001F1", + INITVAL_00=> "0x3FE7F3F3FF07FF93FFFF00000000000000000000000003F87E00000000003FC1E3E0FE000003C1FE", + CSDECODE_B=> "0b011", CSDECODE_A=> "0b011", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_3_8, DOA7=>mdout0_3_7, + DOA6=>mdout0_3_6, DOA5=>mdout0_3_5, DOA4=>mdout0_3_4, + DOA3=>mdout0_3_3, DOA2=>mdout0_3_2, DOA1=>mdout0_3_1, + DOA0=>mdout0_3_0, DOB8=>mdout1_3_8, DOB7=>mdout1_3_7, + DOB6=>mdout1_3_6, DOB5=>mdout1_3_5, DOB4=>mdout1_3_4, + DOB3=>mdout1_3_3, DOB2=>mdout1_3_2, DOB1=>mdout1_3_1, + DOB0=>mdout1_3_0); + + gram0_4_0_2: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000003C40101E013FE0F003E1001F03FC003F8FE001C01FE013E303003F13FE0E3E0FE001E0", + INITVAL_1E=> "0x0011E03C0E3E1FE005E01FE01003FF3FE0F3FFFF20FFF3FE3F00000000000001C078F02000E1E000", + INITVAL_1D=> "0x1C00000000003C10061F3C10001D002060F3020F01C002001F3C0001C1F801E000001D1E00000000", + INITVAL_1C=> "0x3FDFE0FDF03FE7F3E3FF07E010020100000001801E2010F0000020101E010003C0001E03D0001CF0", + INITVAL_1B=> "0x2007E0E00000CE00020103C0001C003FAF3002000390001C00001E03FDFE3E3FF3FD823FFFF00201", + INITVAL_1A=> "0x0000000000301FE00D800021E000F0000003800201DE0000701E0003E10E0023D0000E001E0000E0", + INITVAL_19=> "0x201CE27006001E0000F000000001FE3FF073FFFF307FF3FE1F0000000000000003FC7E380023C000", + INITVAL_18=> "0x1E00000000004F10020F0F10000D8031E073800101C000001E1E0001E18E00F003FC1F3E0FE00000", + INITVAL_17=> "0x3FDFE0FDF13FE3F3F3FF03E010020100000001F00FE0103A010030100E000001C2000E01D8000478", + INITVAL_16=> "0x301E607000000F10020103D0001D0031E7F003F901E013FE3F001F03FDFE3F3FE3FD823FFFF00201", + INITVAL_15=> "0x00000000000F180005C02000E00070000003C00000CF0000390F0000719C0021E2000E000E000070", + INITVAL_14=> "0x2007E3F0023F0FE0018007E01203FF3FF833FFFF383FF3FE0F00000000000018000438380001E000", + INITVAL_13=> "0x0F00000000002712020F07180005803FA023C00000C002000F0E0003F102006012020F0018000400", + INITVAL_12=> "0x3FDFE07DF93FE1F3FBFF01E0100201000000003C07800039800038100C002000E3000600D8000439", + INITVAL_11=> "0x3818207C00002790020100D8000F812023F0020101C0000039001F83FDFE3F3FE3FDC03FEFF00201", + INITVAL_10=> "0x0000000000079C0005C03820200038000000F80000C700027907800039F80003C3C0020003C00078", + INITVAL_0F=> "0x3001E3E002000700000007800301FE3FFC13FFFF383FF3FE0F0000000000001803FC1E301FE03C00", + INITVAL_0E=> "0x3FE0F3C3FF00238300063F1FE005C03E000381FE003E13FE01070001F100003E13FE073F1FE00000", + INITVAL_0D=> "0x3FDFE03FFD3FE0F3FFFF00E010020100000001F003E013E2FF201FE1FC001FE013020300C003FE1F", + INITVAL_0C=> "0x3810003C003FC06203FF003C1007C02021F001FE00F813FE0F001F83FDFE3F9FE1FDE03FE7F00201", + INITVAL_0B=> "0x0000000000300FE0000001C013C3FF003FD00000000300030103E0101AC1001C001C001FC0000018", + INITVAL_0A=> "0x300021C0003FC3E001F800201383FE3FFC13FFFF3C3FF3FE06000000000000000000000000000000", + INITVAL_09=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_08=> "0x3FDFF01FFF3FE0F3FFFF00E010020100000000000000000000000000000000000000000000000000", + INITVAL_07=> "0x00000000000000000000000000000000000000000000000000001FC3FCFE3FDFE0FDF03FE3F00201", + INITVAL_06=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_05=> "0x0000000000000000000000000381FE1FFE13FFFF3E3FF3FC02000000000000000000000000000000", + INITVAL_04=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_03=> "0x3FDFF01FFF3FF073FFFF006010020100000000000000000000000000000000000000000000000000", + INITVAL_02=> "0x00000000000000000000000000000000000000000000000000001FC3FC7E3FDFE07DF03FE3F00201", + INITVAL_01=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_00=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + CSDECODE_B=> "0b100", CSDECODE_A=> "0b100", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_4_8, DOA7=>mdout0_4_7, + DOA6=>mdout0_4_6, DOA5=>mdout0_4_5, DOA4=>mdout0_4_4, + DOA3=>mdout0_4_3, DOA2=>mdout0_4_2, DOA1=>mdout0_4_1, + DOA0=>mdout0_4_0, DOB8=>mdout1_4_8, DOB7=>mdout1_4_7, + DOB6=>mdout1_4_6, DOB5=>mdout1_4_5, DOB4=>mdout1_4_4, + DOB3=>mdout1_4_3, DOB2=>mdout1_4_2, DOB1=>mdout1_4_1, + DOB0=>mdout1_4_0); + + gram0_5_0_1: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_19=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_18=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_17=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_16=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_15=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_14=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_13=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_12=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_11=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_10=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_09=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_08=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_07=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_06=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_05=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_04=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_03=> "0x0000000000000000000000000000000000000000000000000000000000000000001CE0001E003C00", + INITVAL_02=> "0x38000001FE000003F802001FC01C000020F003E0003011FE0038000381C001D003FC3E001FE01C00", + INITVAL_01=> "0x3F1FE0FDC03FE3F3C3FF03E010020100000381E01C000381FE0020103C003FC0E001F101E013F3FF", + INITVAL_00=> "0x0001E1C0003F87E001F800E0103A013C2E1003F907E013FAFF001C03FDFE3C3FF3FF063FFFF00601", + CSDECODE_B=> "0b101", CSDECODE_A=> "0b101", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_5_8, DOA7=>mdout0_5_7, + DOA6=>mdout0_5_6, DOA5=>mdout0_5_5, DOA4=>mdout0_5_4, + DOA3=>mdout0_5_3, DOA2=>mdout0_5_2, DOA1=>mdout0_5_1, + DOA0=>mdout0_5_0, DOB8=>mdout1_5_8, DOB7=>mdout1_5_7, + DOB6=>mdout1_5_6, DOB5=>mdout1_5_5, DOB4=>mdout1_5_4, + DOB3=>mdout1_5_3, DOB2=>mdout1_5_2, DOB1=>mdout1_5_1, + DOB0=>mdout1_5_0); + + scuba_vhi_inst: VHI + port map (Z=>scuba_vhi); + + gram0_6_0_0: DP8KC + generic map (INIT_DATA=> "STATIC", ASYNC_RESET_RELEASE=> "SYNC", + INITVAL_1F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_1A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_19=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_18=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_17=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_16=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_15=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_14=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_13=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_12=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_11=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_10=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0F=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0E=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0D=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0C=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0B=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_0A=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_09=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_08=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_07=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_06=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_05=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_04=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_03=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_02=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_01=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + INITVAL_00=> "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000", + CSDECODE_B=> "0b110", CSDECODE_A=> "0b110", WRITEMODE_B=> "NORMAL", + WRITEMODE_A=> "NORMAL", GSR=> "ENABLED", RESETMODE=> "SYNC", + REGMODE_B=> "OUTREG", REGMODE_A=> "OUTREG", DATA_WIDTH_B=> 9, + DATA_WIDTH_A=> 9) + port map (DIA8=>DataInA(8), DIA7=>DataInA(7), DIA6=>DataInA(6), + DIA5=>DataInA(5), DIA4=>DataInA(4), DIA3=>DataInA(3), + DIA2=>DataInA(2), DIA1=>DataInA(1), DIA0=>DataInA(0), + ADA12=>AddressA(9), ADA11=>AddressA(8), ADA10=>AddressA(7), + ADA9=>AddressA(6), ADA8=>AddressA(5), ADA7=>AddressA(4), + ADA6=>AddressA(3), ADA5=>AddressA(2), ADA4=>AddressA(1), + ADA3=>AddressA(0), ADA2=>scuba_vlo, ADA1=>scuba_vlo, + ADA0=>scuba_vhi, CEA=>ClockEnA, OCEA=>ClockEnA, CLKA=>ClockA, + WEA=>WrA, CSA2=>AddressA(12), CSA1=>AddressA(11), + CSA0=>AddressA(10), RSTA=>ResetA, DIB8=>DataInB(8), + DIB7=>DataInB(7), DIB6=>DataInB(6), DIB5=>DataInB(5), + DIB4=>DataInB(4), DIB3=>DataInB(3), DIB2=>DataInB(2), + DIB1=>DataInB(1), DIB0=>DataInB(0), ADB12=>AddressB(9), + ADB11=>AddressB(8), ADB10=>AddressB(7), ADB9=>AddressB(6), + ADB8=>AddressB(5), ADB7=>AddressB(4), ADB6=>AddressB(3), + ADB5=>AddressB(2), ADB4=>AddressB(1), ADB3=>AddressB(0), + ADB2=>scuba_vlo, ADB1=>scuba_vlo, ADB0=>scuba_vhi, + CEB=>ClockEnB, OCEB=>ClockEnB, CLKB=>ClockB, WEB=>WrB, + CSB2=>AddressB(12), CSB1=>AddressB(11), CSB0=>AddressB(10), + RSTB=>ResetB, DOA8=>mdout0_6_8, DOA7=>mdout0_6_7, + DOA6=>mdout0_6_6, DOA5=>mdout0_6_5, DOA4=>mdout0_6_4, + DOA3=>mdout0_6_3, DOA2=>mdout0_6_2, DOA1=>mdout0_6_1, + DOA0=>mdout0_6_0, DOB8=>mdout1_6_8, DOB7=>mdout1_6_7, + DOB6=>mdout1_6_6, DOB5=>mdout1_6_5, DOB4=>mdout1_6_4, + DOB3=>mdout1_6_3, DOB2=>mdout1_6_2, DOB1=>mdout1_6_1, + DOB0=>mdout1_6_0); + + FF_11: FD1P3DX + port map (D=>AddressA(10), SP=>wren0_inv_g, CK=>ClockA, + CD=>scuba_vlo, Q=>addr010_ff); + + FF_10: FD1P3DX + port map (D=>AddressA(11), SP=>wren0_inv_g, CK=>ClockA, + CD=>scuba_vlo, Q=>addr011_ff); + + FF_9: FD1P3DX + port map (D=>AddressA(12), SP=>wren0_inv_g, CK=>ClockA, + CD=>scuba_vlo, Q=>addr012_ff); + + FF_8: FD1P3DX + port map (D=>addr010_ff, SP=>ClockEnA, CK=>ClockA, CD=>scuba_vlo, + Q=>addr010_ff2); + + FF_7: FD1P3DX + port map (D=>addr011_ff, SP=>ClockEnA, CK=>ClockA, CD=>scuba_vlo, + Q=>addr011_ff2); + + FF_6: FD1P3DX + port map (D=>addr012_ff, SP=>ClockEnA, CK=>ClockA, CD=>scuba_vlo, + Q=>addr012_ff2); + + FF_5: FD1P3DX + port map (D=>AddressB(10), SP=>wren1_inv_g, CK=>ClockB, + CD=>scuba_vlo, Q=>addr110_ff); + + FF_4: FD1P3DX + port map (D=>AddressB(11), SP=>wren1_inv_g, CK=>ClockB, + CD=>scuba_vlo, Q=>addr111_ff); + + FF_3: FD1P3DX + port map (D=>AddressB(12), SP=>wren1_inv_g, CK=>ClockB, + CD=>scuba_vlo, Q=>addr112_ff); + + FF_2: FD1P3DX + port map (D=>addr110_ff, SP=>ClockEnB, CK=>ClockB, CD=>scuba_vlo, + Q=>addr110_ff2); + + FF_1: FD1P3DX + port map (D=>addr111_ff, SP=>ClockEnB, CK=>ClockB, CD=>scuba_vlo, + Q=>addr111_ff2); + + FF_0: FD1P3DX + port map (D=>addr112_ff, SP=>ClockEnB, CK=>ClockB, CD=>scuba_vlo, + Q=>addr112_ff2); + + mux_17: MUX81 + port map (D0=>mdout0_0_0, D1=>mdout0_1_0, D2=>mdout0_2_0, + D3=>mdout0_3_0, D4=>mdout0_4_0, D5=>mdout0_5_0, + D6=>mdout0_6_0, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(0)); + + mux_16: MUX81 + port map (D0=>mdout0_0_1, D1=>mdout0_1_1, D2=>mdout0_2_1, + D3=>mdout0_3_1, D4=>mdout0_4_1, D5=>mdout0_5_1, + D6=>mdout0_6_1, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(1)); + + mux_15: MUX81 + port map (D0=>mdout0_0_2, D1=>mdout0_1_2, D2=>mdout0_2_2, + D3=>mdout0_3_2, D4=>mdout0_4_2, D5=>mdout0_5_2, + D6=>mdout0_6_2, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(2)); + + mux_14: MUX81 + port map (D0=>mdout0_0_3, D1=>mdout0_1_3, D2=>mdout0_2_3, + D3=>mdout0_3_3, D4=>mdout0_4_3, D5=>mdout0_5_3, + D6=>mdout0_6_3, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(3)); + + mux_13: MUX81 + port map (D0=>mdout0_0_4, D1=>mdout0_1_4, D2=>mdout0_2_4, + D3=>mdout0_3_4, D4=>mdout0_4_4, D5=>mdout0_5_4, + D6=>mdout0_6_4, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(4)); + + mux_12: MUX81 + port map (D0=>mdout0_0_5, D1=>mdout0_1_5, D2=>mdout0_2_5, + D3=>mdout0_3_5, D4=>mdout0_4_5, D5=>mdout0_5_5, + D6=>mdout0_6_5, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(5)); + + mux_11: MUX81 + port map (D0=>mdout0_0_6, D1=>mdout0_1_6, D2=>mdout0_2_6, + D3=>mdout0_3_6, D4=>mdout0_4_6, D5=>mdout0_5_6, + D6=>mdout0_6_6, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(6)); + + mux_10: MUX81 + port map (D0=>mdout0_0_7, D1=>mdout0_1_7, D2=>mdout0_2_7, + D3=>mdout0_3_7, D4=>mdout0_4_7, D5=>mdout0_5_7, + D6=>mdout0_6_7, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(7)); + + mux_9: MUX81 + port map (D0=>mdout0_0_8, D1=>mdout0_1_8, D2=>mdout0_2_8, + D3=>mdout0_3_8, D4=>mdout0_4_8, D5=>mdout0_5_8, + D6=>mdout0_6_8, D7=>scuba_vlo, SD1=>addr010_ff2, + SD2=>addr011_ff2, SD3=>addr012_ff2, Z=>QA(8)); + + mux_8: MUX81 + port map (D0=>mdout1_0_0, D1=>mdout1_1_0, D2=>mdout1_2_0, + D3=>mdout1_3_0, D4=>mdout1_4_0, D5=>mdout1_5_0, + D6=>mdout1_6_0, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(0)); + + mux_7: MUX81 + port map (D0=>mdout1_0_1, D1=>mdout1_1_1, D2=>mdout1_2_1, + D3=>mdout1_3_1, D4=>mdout1_4_1, D5=>mdout1_5_1, + D6=>mdout1_6_1, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(1)); + + mux_6: MUX81 + port map (D0=>mdout1_0_2, D1=>mdout1_1_2, D2=>mdout1_2_2, + D3=>mdout1_3_2, D4=>mdout1_4_2, D5=>mdout1_5_2, + D6=>mdout1_6_2, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(2)); + + mux_5: MUX81 + port map (D0=>mdout1_0_3, D1=>mdout1_1_3, D2=>mdout1_2_3, + D3=>mdout1_3_3, D4=>mdout1_4_3, D5=>mdout1_5_3, + D6=>mdout1_6_3, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(3)); + + mux_4: MUX81 + port map (D0=>mdout1_0_4, D1=>mdout1_1_4, D2=>mdout1_2_4, + D3=>mdout1_3_4, D4=>mdout1_4_4, D5=>mdout1_5_4, + D6=>mdout1_6_4, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(4)); + + mux_3: MUX81 + port map (D0=>mdout1_0_5, D1=>mdout1_1_5, D2=>mdout1_2_5, + D3=>mdout1_3_5, D4=>mdout1_4_5, D5=>mdout1_5_5, + D6=>mdout1_6_5, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(5)); + + mux_2: MUX81 + port map (D0=>mdout1_0_6, D1=>mdout1_1_6, D2=>mdout1_2_6, + D3=>mdout1_3_6, D4=>mdout1_4_6, D5=>mdout1_5_6, + D6=>mdout1_6_6, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(6)); + + mux_1: MUX81 + port map (D0=>mdout1_0_7, D1=>mdout1_1_7, D2=>mdout1_2_7, + D3=>mdout1_3_7, D4=>mdout1_4_7, D5=>mdout1_5_7, + D6=>mdout1_6_7, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(7)); + + scuba_vlo_inst: VLO + port map (Z=>scuba_vlo); + + mux_0: MUX81 + port map (D0=>mdout1_0_8, D1=>mdout1_1_8, D2=>mdout1_2_8, + D3=>mdout1_3_8, D4=>mdout1_4_8, D5=>mdout1_5_8, + D6=>mdout1_6_8, D7=>scuba_vlo, SD1=>addr110_ff2, + SD2=>addr111_ff2, SD3=>addr112_ff2, Z=>QB(8)); + +end Structure; + +-- synopsys translate_off +library MACHXO2; +configuration Structure_CON of gram0 is + for Structure + for all:AND2 use entity MACHXO2.AND2(V); end for; + for all:FD1P3DX use entity MACHXO2.FD1P3DX(V); end for; + for all:INV use entity MACHXO2.INV(V); end for; + for all:MUX81 use entity MACHXO2.MUX81(V); end for; + for all:VHI use entity MACHXO2.VHI(V); end for; + for all:VLO use entity MACHXO2.VLO(V); end for; + for all:DP8KC use entity MACHXO2.DP8KC(V); end for; + end for; +end Structure_CON; + +-- synopsys translate_on diff --git a/display/fpga/ip/gram0/gram0_generate.log b/display/fpga/ip/gram0/gram0_generate.log new file mode 100644 index 0000000..e177011 --- /dev/null +++ b/display/fpga/ip/gram0/gram0_generate.log @@ -0,0 +1,49 @@ +Starting process: Module + +Starting process: + +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Sun Apr 22 17:34:06 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + +BEGIN SCUBA Module Synthesis + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n gram0 -lang vhdl -synth synplify -bus_exp 7 -bb -arch xo2c00 -type ramdp -device LCMXO2-1200HC -aaddr_width 13 -widtha 9 -baddr_width 13 -widthb 9 -anum_words 7000 -bnum_words 7000 -outdataA REGISTERED -outdataB REGISTERED -cascade -1 -resetmode SYNC -sync_reset -memfile /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem -memformat bin -writemodeA NORMAL -writemodeB NORMAL + Circuit name : gram0 + Module type : RAM_DP_TRUE + Module Version : 7.5 + Ports : + Inputs : DataInA[8:0], DataInB[8:0], AddressA[12:0], AddressB[12:0], ClockA, ClockB, ClockEnA, ClockEnB, WrA, WrB, ResetA, ResetB + Outputs : QA[8:0], QB[8:0] + I/O buffer : not inserted + Memory file : /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem + EDIF output : gram0.edn + VHDL output : gram0.vhd + VHDL template : gram0_tmpl.vhd + VHDL testbench : tb_gram0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : gram0.srp + Estimated Resource Usage: + LUT : 38 + EBR : 7 + Reg : 12 + +END SCUBA Module Synthesis + +File: gram0.lpc created. + + +End process: completed successfully. + + +Total Warnings: 0 + +Total Errors: 0 + + diff --git a/display/fpga/ip/gram0/gram0_tmpl.vhd b/display/fpga/ip/gram0/gram0_tmpl.vhd new file mode 100644 index 0000000..15d2c86 --- /dev/null +++ b/display/fpga/ip/gram0/gram0_tmpl.vhd @@ -0,0 +1,23 @@ +-- VHDL module instantiation generated by SCUBA Diamond (64-bit) 3.10.0.111.2 +-- Module Version: 7.5 +-- Sun Apr 22 17:34:06 2018 + +-- parameterized module component declaration +component gram0 + port (DataInA: in std_logic_vector(8 downto 0); + DataInB: in std_logic_vector(8 downto 0); + AddressA: in std_logic_vector(12 downto 0); + AddressB: in std_logic_vector(12 downto 0); + ClockA: in std_logic; ClockB: in std_logic; + ClockEnA: in std_logic; ClockEnB: in std_logic; + WrA: in std_logic; WrB: in std_logic; ResetA: in std_logic; + ResetB: in std_logic; QA: out std_logic_vector(8 downto 0); + QB: out std_logic_vector(8 downto 0)); +end component; + +-- parameterized module component instance +__ : gram0 + port map (DataInA(8 downto 0)=>__, DataInB(8 downto 0)=>__, AddressA(12 downto 0)=>__, + AddressB(12 downto 0)=>__, ClockA=>__, ClockB=>__, ClockEnA=>__, + ClockEnB=>__, WrA=>__, WrB=>__, ResetA=>__, ResetB=>__, QA(8 downto 0)=>__, + QB(8 downto 0)=>__); diff --git a/display/fpga/ip/gram0/msg_file.log b/display/fpga/ip/gram0/msg_file.log new file mode 100644 index 0000000..6d4715e --- /dev/null +++ b/display/fpga/ip/gram0/msg_file.log @@ -0,0 +1,34 @@ +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Sun Apr 22 17:34:06 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + +BEGIN SCUBA Module Synthesis + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n gram0 -lang vhdl -synth synplify -bus_exp 7 -bb -arch xo2c00 -type ramdp -device LCMXO2-1200HC -aaddr_width 13 -widtha 9 -baddr_width 13 -widthb 9 -anum_words 7000 -bnum_words 7000 -outdataA REGISTERED -outdataB REGISTERED -cascade -1 -resetmode SYNC -sync_reset -memfile /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem -memformat bin -writemodeA NORMAL -writemodeB NORMAL + Circuit name : gram0 + Module type : RAM_DP_TRUE + Module Version : 7.5 + Ports : + Inputs : DataInA[8:0], DataInB[8:0], AddressA[12:0], AddressB[12:0], ClockA, ClockB, ClockEnA, ClockEnB, WrA, WrB, ResetA, ResetB + Outputs : QA[8:0], QB[8:0] + I/O buffer : not inserted + Memory file : /home/markus/projects/workspaceSigasi/lmg6202/bin/gram_init.mem + EDIF output : gram0.edn + VHDL output : gram0.vhd + VHDL template : gram0_tmpl.vhd + VHDL testbench : tb_gram0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : gram0.srp + Estimated Resource Usage: + LUT : 38 + EBR : 7 + Reg : 12 + +END SCUBA Module Synthesis + diff --git a/display/fpga/ip/gram0/tb_gram0_tmpl.vhd b/display/fpga/ip/gram0/tb_gram0_tmpl.vhd new file mode 100644 index 0000000..02dd953 --- /dev/null +++ b/display/fpga/ip/gram0/tb_gram0_tmpl.vhd @@ -0,0 +1,178 @@ +-- VHDL testbench template generated by SCUBA Diamond (64-bit) 3.10.0.111.2 +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.std_logic_unsigned.all; + +use IEEE.math_real.all; + +use IEEE.numeric_std.all; + +entity tb is +end entity tb; + + +architecture test of tb is + + component gram0 + port (DataInA : in std_logic_vector(8 downto 0); + DataInB : in std_logic_vector(8 downto 0); + AddressA : in std_logic_vector(12 downto 0); + AddressB : in std_logic_vector(12 downto 0); + ClockA: in std_logic; ClockB: in std_logic; + ClockEnA: in std_logic; ClockEnB: in std_logic; + WrA: in std_logic; WrB: in std_logic; ResetA: in std_logic; + ResetB: in std_logic; QA : out std_logic_vector(8 downto 0); + QB : out std_logic_vector(8 downto 0) + ); + end component; + + signal DataInA : std_logic_vector(8 downto 0) := (others => '0'); + signal DataInB : std_logic_vector(8 downto 0) := (others => '0'); + signal AddressA : std_logic_vector(12 downto 0) := (others => '0'); + signal AddressB : std_logic_vector(12 downto 0) := (others => '0'); + signal ClockA: std_logic := '0'; + signal ClockB: std_logic := '0'; + signal ClockEnA: std_logic := '0'; + signal ClockEnB: std_logic := '0'; + signal WrA: std_logic := '0'; + signal WrB: std_logic := '0'; + signal ResetA: std_logic := '0'; + signal ResetB: std_logic := '0'; + signal QA : std_logic_vector(8 downto 0); + signal QB : std_logic_vector(8 downto 0); +begin + u1 : gram0 + port map (DataInA => DataInA, DataInB => DataInB, AddressA => AddressA, + AddressB => AddressB, ClockA => ClockA, ClockB => ClockB, + ClockEnA => ClockEnA, ClockEnB => ClockEnB, WrA => WrA, WrB => WrB, + ResetA => ResetA, ResetB => ResetB, QA => QA, QB => QB + ); + + process + + begin + DataInA <= (others => '0') ; + wait for 100 ns; + wait until ResetA = '0'; + for i in 0 to 7003 loop + wait until ClockA'event and ClockA = '1'; + DataInA <= DataInA + '1' after 1 ns; + end loop; + wait; + end process; + + process + + begin + DataInB <= (others => '0') ; + wait for 100 ns; + wait until ResetB = '0'; + wait until WrB = '1'; + for i in 0 to 7003 loop + wait until ClockB'event and ClockB = '1'; + DataInB <= DataInB + '1' after 1 ns; + end loop; + wait; + end process; + + process + + begin + AddressA <= (others => '0') ; + wait for 100 ns; + wait until ResetA = '0'; + for i in 0 to 14006 loop + wait until ClockA'event and ClockA = '1'; + AddressA <= AddressA + '1' after 1 ns; + end loop; + wait; + end process; + + process + + begin + AddressB <= (others => '0') ; + wait for 100 ns; + wait until ResetB = '0'; + wait until WrB = '1'; + for i in 0 to 14006 loop + wait until ClockB'event and ClockB = '1'; + AddressB <= AddressB + '1' after 1 ns; + end loop; + wait; + end process; + + ClockA <= not ClockA after 5.00 ns; + + ClockB <= not ClockB after 5.00 ns; + + process + + begin + ClockEnA <= '0' ; + wait for 100 ns; + wait until ResetA = '0'; + ClockEnA <= '1' ; + wait; + end process; + + process + + begin + ClockEnB <= '0' ; + wait for 100 ns; + wait until ResetB = '0'; + ClockEnB <= '1' ; + wait; + end process; + + process + + begin + WrA <= '0' ; + wait until ResetA = '0'; + for i in 0 to 7003 loop + wait until ClockA'event and ClockA = '1'; + WrA <= '1' after 1 ns; + end loop; + WrA <= '0' ; + wait; + end process; + + process + + begin + WrB <= '0' ; + wait until ResetB = '0'; + wait until WrA = '1'; + wait until WrA = '0'; + for i in 0 to 7003 loop + wait until ClockA'event and ClockA = '1'; + end loop; + for i in 0 to 7003 loop + wait until ClockB'event and ClockB = '1'; + WrB <= '1' after 1 ns; + end loop; + WrB <= '0' ; + wait; + end process; + + process + + begin + ResetA <= '1' ; + wait for 100 ns; + ResetA <= '0' ; + wait; + end process; + + process + + begin + ResetB <= '1' ; + wait for 100 ns; + ResetB <= '0' ; + wait; + end process; + +end architecture test; diff --git a/display/fpga/ip/pll0/._Real_._Math_.vhd b/display/fpga/ip/pll0/._Real_._Math_.vhd new file mode 100644 index 0000000..ad185b2 --- /dev/null +++ b/display/fpga/ip/pll0/._Real_._Math_.vhd @@ -0,0 +1,2574 @@ + + +------------------------------------------------------------------------ +-- +-- Copyright 1996 by IEEE. All rights reserved. +-- +-- This source file is an essential part of IEEE Std 1076.2-1996, IEEE Standard +-- VHDL Mathematical Packages. This source file may not be copied, sold, or +-- included with software that is sold without written permission from the IEEE +-- Standards Department. This source file may be used to implement this standard +-- and may be distributed in compiled form in any manner so long as the +-- compiled form does not allow direct decompilation of the original source file. +-- This source file may be copied for individual use between licensed users. +-- This source file is provided on an AS IS basis. The IEEE disclaims ANY +-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY +-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source +-- file shall indemnify and hold IEEE harmless from any damages or liability +-- arising out of the use thereof. +-- +-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996, +-- MATH_REAL) +-- +-- Library: This package shall be compiled into a library +-- symbolically named IEEE. +-- +-- Developers: IEEE DASC VHDL Mathematical Packages Working Group +-- +-- Purpose: This package defines a standard for designers to use in +-- describing VHDL models that make use of common REAL constants +-- and common REAL elementary mathematical functions. +-- +-- Limitation: The values generated by the functions in this package may +-- vary from platform to platform, and the precision of results +-- is only guaranteed to be the minimum required by IEEE Std 1076- +-- 1993. +-- +-- Notes: +-- No declarations or definitions shall be included in, or +-- excluded from, this package. +-- The "package declaration" defines the types, subtypes, and +-- declarations of MATH_REAL. +-- The standard mathematical definition and conventional meaning +-- of the mathematical functions that are part of this standard +-- represent the formal semantics of the implementation of the +-- MATH_REAL package declaration. The purpose of the MATH_REAL +-- package body is to provide a guideline for implementations to +-- verify their implementation of MATH_REAL. Tool developers may +-- choose to implement the package body in the most efficient +-- manner available to them. +-- +-- ----------------------------------------------------------------------------- +-- Version : 1.5 +-- Date : 24 July 1996 +-- ----------------------------------------------------------------------------- + +package MATH_REAL is + constant CopyRightNotice: STRING + := "Copyright 1996 IEEE. All rights reserved."; + + -- + -- Constant Definitions + -- + constant MATH_E : REAL := 2.71828_18284_59045_23536; + -- Value of e + constant MATH_1_OVER_E : REAL := 0.36787_94411_71442_32160; + -- Value of 1/e + constant MATH_PI : REAL := 3.14159_26535_89793_23846; + -- Value of pi + constant MATH_2_PI : REAL := 6.28318_53071_79586_47693; + -- Value of 2*pi + constant MATH_1_OVER_PI : REAL := 0.31830_98861_83790_67154; + -- Value of 1/pi + constant MATH_PI_OVER_2 : REAL := 1.57079_63267_94896_61923; + -- Value of pi/2 + constant MATH_PI_OVER_3 : REAL := 1.04719_75511_96597_74615; + -- Value of pi/3 + constant MATH_PI_OVER_4 : REAL := 0.78539_81633_97448_30962; + -- Value of pi/4 + constant MATH_3_PI_OVER_2 : REAL := 4.71238_89803_84689_85769; + -- Value 3*pi/2 + constant MATH_LOG_OF_2 : REAL := 0.69314_71805_59945_30942; + -- Natural log of 2 + constant MATH_LOG_OF_10 : REAL := 2.30258_50929_94045_68402; + -- Natural log of 10 + constant MATH_LOG2_OF_E : REAL := 1.44269_50408_88963_4074; + -- Log base 2 of e + constant MATH_LOG10_OF_E: REAL := 0.43429_44819_03251_82765; + -- Log base 10 of e + constant MATH_SQRT_2: REAL := 1.41421_35623_73095_04880; + -- square root of 2 + constant MATH_1_OVER_SQRT_2: REAL := 0.70710_67811_86547_52440; + -- square root of 1/2 + constant MATH_SQRT_PI: REAL := 1.77245_38509_05516_02730; + -- square root of pi + constant MATH_DEG_TO_RAD: REAL := 0.01745_32925_19943_29577; + -- Conversion factor from degree to radian + constant MATH_RAD_TO_DEG: REAL := 57.29577_95130_82320_87680; + -- Conversion factor from radian to degree + + -- + -- Function Declarations + -- + function SIGN (X: in REAL ) return REAL; + -- Purpose: + -- Returns 1.0 if X > 0.0; 0.0 if X = 0.0; -1.0 if X < 0.0 + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIGN(X)) <= 1.0 + -- Notes: + -- None + + function CEIL (X : in REAL ) return REAL; + -- Purpose: + -- Returns smallest INTEGER value (as REAL) not less than X + -- Special values: + -- None + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CEIL(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function FLOOR (X : in REAL ) return REAL; + -- Purpose: + -- Returns largest INTEGER value (as REAL) not greater than X + -- Special values: + -- FLOOR(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- FLOOR(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function ROUND (X : in REAL ) return REAL; + -- Purpose: + -- Rounds X to the nearest integer value (as real). If X is + -- halfway between two integers, rounding is away from 0.0 + -- Special values: + -- ROUND(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ROUND(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function TRUNC (X : in REAL ) return REAL; + -- Purpose: + -- Truncates X towards 0.0 and returns truncated value + -- Special values: + -- TRUNC(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- TRUNC(X) is mathematically unbounded + -- Notes: + -- a) Implementations have to support at least the domain + -- ABS(X) < REAL(INTEGER'HIGH) + + function "MOD" (X, Y: in REAL ) return REAL; + -- Purpose: + -- Returns floating point modulus of X/Y, with the same sign as + -- Y, and absolute value less than the absolute value of Y, and + -- for some INTEGER value N the result satisfies the relation + -- X = Y*N + MOD(X,Y) + -- Special values: + -- None + -- Domain: + -- X in REAL; Y in REAL and Y /= 0.0 + -- Error conditions: + -- Error if Y = 0.0 + -- Range: + -- ABS(MOD(X,Y)) < ABS(Y) + -- Notes: + -- None + + function REALMAX (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically larger of X and Y + -- Special values: + -- REALMAX(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMAX(X,Y) is mathematically unbounded + -- Notes: + -- None + + function REALMIN (X, Y : in REAL ) return REAL; + -- Purpose: + -- Returns the algebraically smaller of X and Y + -- Special values: + -- REALMIN(X,Y) = X when X = Y + -- Domain: + -- X in REAL; Y in REAL + -- Error conditions: + -- None + -- Range: + -- REALMIN(X,Y) is mathematically unbounded + -- Notes: + -- None + + procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE; variable X:out REAL); + -- Purpose: + -- Returns, in X, a pseudo-random number with uniform + -- distribution in the open interval (0.0, 1.0). + -- Special values: + -- None + -- Domain: + -- 1 <= SEED1 <= 2147483562; 1 <= SEED2 <= 2147483398 + -- Error conditions: + -- Error if SEED1 or SEED2 outside of valid domain + -- Range: + -- 0.0 < X < 1.0 + -- Notes: + -- a) The semantics for this function are described by the + -- algorithm published by Pierre L'Ecuyer in "Communications + -- of the ACM," vol. 31, no. 6, June 1988, pp. 742-774. + -- The algorithm is based on the combination of two + -- multiplicative linear congruential generators for 32-bit + -- platforms. + -- + -- b) Before the first call to UNIFORM, the seed values + -- (SEED1, SEED2) have to be initialized to values in the range + -- [1, 2147483562] and [1, 2147483398] respectively. The + -- seed values are modified after each call to UNIFORM. + -- + -- c) This random number generator is portable for 32-bit + -- computers, and it has a period of ~2.30584*(10**18) for each + -- set of seed values. + -- + -- d) For information on spectral tests for the algorithm, refer + -- to the L'Ecuyer article. + + function SQRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns square root of X + -- Special values: + -- SQRT(0.0) = 0.0 + -- SQRT(1.0) = 1.0 + -- Domain: + -- X >= 0.0 + -- Error conditions: + -- Error if X < 0.0 + -- Range: + -- SQRT(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of SQRT is + -- approximately given by: + -- SQRT(X) <= SQRT(REAL'HIGH) + + function CBRT (X : in REAL ) return REAL; + -- Purpose: + -- Returns cube root of X + -- Special values: + -- CBRT(0.0) = 0.0 + -- CBRT(1.0) = 1.0 + -- CBRT(-1.0) = -1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- CBRT(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of CBRT is approximately given by: + -- ABS(CBRT(X)) <= CBRT(REAL'HIGH) + + function "**" (X : in INTEGER; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0 + -- 0**Y = 0.0; Y > 0.0 + -- X**1.0 = REAL(X); X >= 0 + -- 1**Y = 1.0 + -- Domain: + -- X > 0 + -- X = 0 for Y > 0.0 + -- X < 0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0 and Y /= 0.0 + -- Error if X = 0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function "**" (X : in REAL; Y : in REAL) return REAL; + -- Purpose: + -- Returns Y power of X ==> X**Y + -- Special values: + -- X**0.0 = 1.0; X /= 0.0 + -- 0.0**Y = 0.0; Y > 0.0 + -- X**1.0 = X; X >= 0.0 + -- 1.0**Y = 1.0 + -- Domain: + -- X > 0.0 + -- X = 0.0 for Y > 0.0 + -- X < 0.0 for Y = 0.0 + -- Error conditions: + -- Error if X < 0.0 and Y /= 0.0 + -- Error if X = 0.0 and Y <= 0.0 + -- Range: + -- X**Y >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range for "**" is + -- approximately given by: + -- X**Y <= REAL'HIGH + + function EXP (X : in REAL ) return REAL; + -- Purpose: + -- Returns e**X; where e = MATH_E + -- Special values: + -- EXP(0.0) = 1.0 + -- EXP(1.0) = MATH_E + -- EXP(-1.0) = MATH_1_OVER_E + -- EXP(X) = 0.0 for X <= -LOG(REAL'HIGH) + -- Domain: + -- X in REAL such that EXP(X) <= REAL'HIGH + -- Error conditions: + -- Error if X > LOG(REAL'HIGH) + -- Range: + -- EXP(X) >= 0.0 + -- Notes: + -- a) The usable domain of EXP is approximately given by: + -- X <= LOG(REAL'HIGH) + + function LOG (X : in REAL ) return REAL; + -- Purpose: + -- Returns natural logarithm of X + -- Special values: + -- LOG(1.0) = 0.0 + -- LOG(MATH_E) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG is approximately given by: + -- LOG(0+) <= LOG(X) <= LOG(REAL'HIGH) + + function LOG2 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 2 of X + -- Special values: + -- LOG2(1.0) = 0.0 + -- LOG2(2.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG2(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG2 is approximately given by: + -- LOG2(0+) <= LOG2(X) <= LOG2(REAL'HIGH) + + function LOG10 (X : in REAL ) return REAL; + -- Purpose: + -- Returns logarithm base 10 of X + -- Special values: + -- LOG10(1.0) = 0.0 + -- LOG10(10.0) = 1.0 + -- Domain: + -- X > 0.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Range: + -- LOG10(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of LOG10 is approximately given by: + -- LOG10(0+) <= LOG10(X) <= LOG10(REAL'HIGH) + + function LOG (X: in REAL; BASE: in REAL) return REAL; + -- Purpose: + -- Returns logarithm base BASE of X + -- Special values: + -- LOG(1.0, BASE) = 0.0 + -- LOG(BASE, BASE) = 1.0 + -- Domain: + -- X > 0.0 + -- BASE > 0.0 + -- BASE /= 1.0 + -- Error conditions: + -- Error if X <= 0.0 + -- Error if BASE <= 0.0 + -- Error if BASE = 1.0 + -- Range: + -- LOG(X, BASE) is mathematically unbounded + -- Notes: + -- a) When BASE > 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(0+, BASE) <= LOG(X, BASE) <= LOG(REAL'HIGH, BASE) + -- b) When 0.0 < BASE < 1.0, the reachable range of LOG is + -- approximately given by: + -- LOG(REAL'HIGH, BASE) <= LOG(X, BASE) <= LOG(0+, BASE) + + function SIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns sine of X; X in radians + -- Special values: + -- SIN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- SIN(X) = 1.0 for X = (4*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- SIN(X) = -1.0 for X = (4*k+3)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(SIN(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function COS ( X : in REAL ) return REAL; + -- Purpose: + -- Returns cosine of X; X in radians + -- Special values: + -- COS(X) = 0.0 for X = (2*k+1)*MATH_PI_OVER_2, where k is an + -- INTEGER + -- COS(X) = 1.0 for X = (2*k)*MATH_PI, where k is an INTEGER + -- COS(X) = -1.0 for X = (2*k+1)*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(COS(X)) <= 1.0 + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function TAN (X : in REAL ) return REAL; + -- Purpose: + -- Returns tangent of X; X in radians + -- Special values: + -- TAN(X) = 0.0 for X = k*MATH_PI, where k is an INTEGER + -- Domain: + -- X in REAL and + -- X /= (2*k+1)*MATH_PI_OVER_2, where k is an INTEGER + -- Error conditions: + -- Error if X = ((2*k+1) * MATH_PI_OVER_2), where k is an + -- INTEGER + -- Range: + -- TAN(X) is mathematically unbounded + -- Notes: + -- a) For larger values of ABS(X), degraded accuracy is allowed. + + function ARCSIN (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse sine of X + -- Special values: + -- ARCSIN(0.0) = 0.0 + -- ARCSIN(1.0) = MATH_PI_OVER_2 + -- ARCSIN(-1.0) = -MATH_PI_OVER_2 + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- ABS(ARCSIN(X) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCCOS (X : in REAL ) return REAL; + -- Purpose: + -- Returns inverse cosine of X + -- Special values: + -- ARCCOS(1.0) = 0.0 + -- ARCCOS(0.0) = MATH_PI_OVER_2 + -- ARCCOS(-1.0) = MATH_PI + -- Domain: + -- ABS(X) <= 1.0 + -- Error conditions: + -- Error if ABS(X) > 1.0 + -- Range: + -- 0.0 <= ARCCOS(X) <= MATH_PI + -- Notes: + -- None + + function ARCTAN (Y : in REAL) return REAL; + -- Purpose: + -- Returns the value of the angle in radians of the point + -- (1.0, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0) = 0.0 + -- Domain: + -- Y in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(ARCTAN(Y)) <= MATH_PI_OVER_2 + -- Notes: + -- None + + function ARCTAN (Y : in REAL; X : in REAL) return REAL; + -- Purpose: + -- Returns the principal value of the angle in radians of + -- the point (X, Y), which is in rectangular coordinates + -- Special values: + -- ARCTAN(0.0, X) = 0.0 if X > 0.0 + -- ARCTAN(0.0, X) = MATH_PI if X < 0.0 + -- ARCTAN(Y, 0.0) = MATH_PI_OVER_2 if Y > 0.0 + -- ARCTAN(Y, 0.0) = -MATH_PI_OVER_2 if Y < 0.0 + -- Domain: + -- Y in REAL + -- X in REAL, X /= 0.0 when Y = 0.0 + -- Error conditions: + -- Error if X = 0.0 and Y = 0.0 + -- Range: + -- -MATH_PI < ARCTAN(Y,X) <= MATH_PI + -- Notes: + -- None + + function SINH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic sine of X + -- Special values: + -- SINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- SINH(X) is mathematically unbounded + -- Notes: + -- a) The usable domain of SINH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + + function COSH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic cosine of X + -- Special values: + -- COSH(0.0) = 1.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- COSH(X) >= 1.0 + -- Notes: + -- a) The usable domain of COSH is approximately given by: + -- ABS(X) <= LOG(REAL'HIGH) + + function TANH (X : in REAL) return REAL; + -- Purpose: + -- Returns hyperbolic tangent of X + -- Special values: + -- TANH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ABS(TANH(X)) <= 1.0 + -- Notes: + -- None + + function ARCSINH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic sine of X + -- Special values: + -- ARCSINH(0.0) = 0.0 + -- Domain: + -- X in REAL + -- Error conditions: + -- None + -- Range: + -- ARCSINH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCSINH is approximately given by: + -- ABS(ARCSINH(X)) <= LOG(REAL'HIGH) + + function ARCCOSH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic cosine of X + -- Special values: + -- ARCCOSH(1.0) = 0.0 + -- Domain: + -- X >= 1.0 + -- Error conditions: + -- Error if X < 1.0 + -- Range: + -- ARCCOSH(X) >= 0.0 + -- Notes: + -- a) The upper bound of the reachable range of ARCCOSH is + -- approximately given by: ARCCOSH(X) <= LOG(REAL'HIGH) + + function ARCTANH (X : in REAL) return REAL; + -- Purpose: + -- Returns inverse hyperbolic tangent of X + -- Special values: + -- ARCTANH(0.0) = 0.0 + -- Domain: + -- ABS(X) < 1.0 + -- Error conditions: + -- Error if ABS(X) >= 1.0 + -- Range: + -- ARCTANH(X) is mathematically unbounded + -- Notes: + -- a) The reachable range of ARCTANH is approximately given by: + -- ABS(ARCTANH(X)) < LOG(REAL'HIGH) + +end MATH_REAL; + + + +------------------------------------------------------------------------ +-- +-- Copyright 1996 by IEEE. All rights reserved. + +-- This source file is an informative part of IEEE Std 1076.2-1996, IEEE Standard +-- VHDL Mathematical Packages. This source file may not be copied, sold, or +-- included with software that is sold without written permission from the IEEE +-- Standards Department. This source file may be used to implement this standard +-- and may be distributed in compiled form in any manner so long as the +-- compiled form does not allow direct decompilation of the original source file. +-- This source file may be copied for individual use between licensed users. +-- This source file is provided on an AS IS basis. The IEEE disclaims ANY +-- WARRANTY EXPRESS OR IMPLIED INCLUDING ANY WARRANTY OF MERCHANTABILITY +-- AND FITNESS FOR USE FOR A PARTICULAR PURPOSE. The user of the source +-- file shall indemnify and hold IEEE harmless from any damages or liability +-- arising out of the use thereof. + +-- +-- Title: Standard VHDL Mathematical Packages (IEEE Std 1076.2-1996, +-- MATH_REAL) +-- +-- Library: This package shall be compiled into a library +-- symbolically named IEEE. +-- +-- Developers: IEEE DASC VHDL Mathematical Packages Working Group +-- +-- Purpose: This package body is a nonnormative implementation of the +-- functionality defined in the MATH_REAL package declaration. +-- +-- Limitation: The values generated by the functions in this package may +-- vary from platform to platform, and the precision of results +-- is only guaranteed to be the minimum required by IEEE Std 1076 +-- -1993. +-- +-- Notes: +-- The "package declaration" defines the types, subtypes, and +-- declarations of MATH_REAL. +-- The standard mathematical definition and conventional meaning +-- of the mathematical functions that are part of this standard +-- represent the formal semantics of the implementation of the +-- MATH_REAL package declaration. The purpose of the MATH_REAL +-- package body is to clarify such semantics and provide a +-- guideline for implementations to verify their implementation +-- of MATH_REAL. Tool developers may choose to implement +-- the package body in the most efficient manner available to them. +-- +-- ----------------------------------------------------------------------------- +-- Version : 1.5 +-- Date : 24 July 1996 +-- ----------------------------------------------------------------------------- + +package body MATH_REAL is + + -- + -- Local Constants for Use in the Package Body Only + -- + constant MATH_E_P2 : REAL := 7.38905_60989_30650; -- e**2 + constant MATH_E_P10 : REAL := 22026.46579_48067_17; -- e**10 + constant MATH_EIGHT_PI : REAL := 25.13274_12287_18345_90770_115; --8*pi + constant MAX_ITER: INTEGER := 27; -- Maximum precision factor for cordic + constant MAX_COUNT: INTEGER := 150; -- Maximum count for number of tries + constant BASE_EPS: REAL := 0.00001; -- Factor for convergence criteria + constant KC : REAL := 6.0725293500888142e-01; -- Constant for cordic + + -- + -- Local Type Declarations for Cordic Operations + -- + type REAL_VECTOR is array (NATURAL range <>) of REAL; + type NATURAL_VECTOR is array (NATURAL range <>) of NATURAL; + subtype REAL_VECTOR_N is REAL_VECTOR (0 to MAX_ITER); + subtype REAL_ARR_2 is REAL_VECTOR (0 to 1); + subtype REAL_ARR_3 is REAL_VECTOR (0 to 2); + subtype QUADRANT is INTEGER range 0 to 3; + type CORDIC_MODE_TYPE is (ROTATION, VECTORING); + + -- + -- Auxiliary Functions for Cordic Algorithms + -- + function POWER_OF_2_SERIES (D : in NATURAL_VECTOR; INITIAL_VALUE : in REAL; + NUMBER_OF_VALUES : in NATURAL) return REAL_VECTOR is + -- Description: + -- Returns power of two for a vector of values + -- Notes: + -- None + -- + variable V : REAL_VECTOR (0 to NUMBER_OF_VALUES); + variable TEMP : REAL := INITIAL_VALUE; + variable FLAG : BOOLEAN := TRUE; + begin + for I in 0 to NUMBER_OF_VALUES loop + V(I) := TEMP; + for P in D'RANGE loop + if I = D(P) then + FLAG := FALSE; + exit; + end if; + end loop; + if FLAG then + TEMP := TEMP/2.0; + end if; + FLAG := TRUE; + end loop; + return V; + end POWER_OF_2_SERIES; + + + constant TWO_AT_MINUS : REAL_VECTOR := POWER_OF_2_SERIES( + NATURAL_VECTOR'(100, 90),1.0, + MAX_ITER); + + constant EPSILON : REAL_VECTOR_N := ( + 7.8539816339744827e-01, + 4.6364760900080606e-01, + 2.4497866312686413e-01, + 1.2435499454676144e-01, + 6.2418809995957351e-02, + 3.1239833430268277e-02, + 1.5623728620476830e-02, + 7.8123410601011116e-03, + 3.9062301319669717e-03, + 1.9531225164788189e-03, + 9.7656218955931937e-04, + 4.8828121119489829e-04, + 2.4414062014936175e-04, + 1.2207031189367021e-04, + 6.1035156174208768e-05, + 3.0517578115526093e-05, + 1.5258789061315760e-05, + 7.6293945311019699e-06, + 3.8146972656064960e-06, + 1.9073486328101870e-06, + 9.5367431640596080e-07, + 4.7683715820308876e-07, + 2.3841857910155801e-07, + 1.1920928955078067e-07, + 5.9604644775390553e-08, + 2.9802322387695303e-08, + 1.4901161193847654e-08, + 7.4505805969238281e-09 + ); + + function CORDIC ( X0 : in REAL; + Y0 : in REAL; + Z0 : in REAL; + N : in NATURAL; -- Precision factor + CORDIC_MODE : in CORDIC_MODE_TYPE -- Rotation (Z -> 0) + -- or vectoring (Y -> 0) + ) return REAL_ARR_3 is + -- Description: + -- Compute cordic values + -- Notes: + -- None + variable X : REAL := X0; + variable Y : REAL := Y0; + variable Z : REAL := Z0; + variable X_TEMP : REAL; + begin + if CORDIC_MODE = ROTATION then + for K in 0 to N loop + X_TEMP := X; + if ( Z >= 0.0) then + X := X - Y * TWO_AT_MINUS(K); + Y := Y + X_TEMP * TWO_AT_MINUS(K); + Z := Z - EPSILON(K); + else + X := X + Y * TWO_AT_MINUS(K); + Y := Y - X_TEMP * TWO_AT_MINUS(K); + Z := Z + EPSILON(K); + end if; + end loop; + else + for K in 0 to N loop + X_TEMP := X; + if ( Y < 0.0) then + X := X - Y * TWO_AT_MINUS(K); + Y := Y + X_TEMP * TWO_AT_MINUS(K); + Z := Z - EPSILON(K); + else + X := X + Y * TWO_AT_MINUS(K); + Y := Y - X_TEMP * TWO_AT_MINUS(K); + Z := Z + EPSILON(K); + end if; + end loop; + end if; + return REAL_ARR_3'(X, Y, Z); + end CORDIC; + + -- + -- Bodies for Global Mathematical Functions Start Here + -- + function SIGN (X: in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- None + begin + if ( X > 0.0 ) then + return 1.0; + elsif ( X < 0.0 ) then + return -1.0; + else + return 0.0; + end if; + end SIGN; + + function CEIL (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) No conversion to an INTEGER type is expected, so truncate + -- cannot overflow for large arguments + -- b) The domain supported by this function is X <= LARGE + -- c) Returns X if ABS(X) >= LARGE + + constant LARGE: REAL := REAL(INTEGER'HIGH); + variable RD: REAL; + + begin + if ABS(X) >= LARGE then + return X; + end if; + + RD := REAL ( INTEGER(X)); + if RD = X then + return X; + end if; + + if X > 0.0 then + if RD >= X then + return RD; + else + return RD + 1.0; + end if; + elsif X = 0.0 then + return 0.0; + else + if RD <= X then + return RD + 1.0; + else + return RD; + end if; + end if; + end CEIL; + + function FLOOR (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) No conversion to an INTEGER type is expected, so truncate + -- cannot overflow for large arguments + -- b) The domain supported by this function is ABS(X) <= LARGE + -- c) Returns X if ABS(X) >= LARGE + + constant LARGE: REAL := REAL(INTEGER'HIGH); + variable RD: REAL; + + begin + if ABS( X ) >= LARGE then + return X; + end if; + + RD := REAL ( INTEGER(X)); + if RD = X then + return X; + end if; + + if X > 0.0 then + if RD <= X then + return RD; + else + return RD - 1.0; + end if; + elsif X = 0.0 then + return 0.0; + else + if RD >= X then + return RD - 1.0; + else + return RD; + end if; + end if; + end FLOOR; + + function ROUND (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 if X = 0.0 + -- b) Returns FLOOR(X + 0.5) if X > 0 + -- c) Returns CEIL(X - 0.5) if X < 0 + + begin + if X > 0.0 then + return FLOOR(X + 0.5); + elsif X < 0.0 then + return CEIL( X - 0.5); + else + return 0.0; + end if; + end ROUND; + + function TRUNC (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 if X = 0.0 + -- b) Returns FLOOR(X) if X > 0 + -- c) Returns CEIL(X) if X < 0 + + begin + if X > 0.0 then + return FLOOR(X); + elsif X < 0.0 then + return CEIL( X); + else + return 0.0; + end if; + end TRUNC; + + + + + function "MOD" (X, Y: in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + + variable XNEGATIVE : BOOLEAN := X < 0.0; + variable YNEGATIVE : BOOLEAN := Y < 0.0; + variable VALUE : REAL; + begin + -- Check validity of input arguments + if (Y = 0.0) then + assert FALSE + report "MOD(X, 0.0) is undefined" + severity ERROR; + return 0.0; + end if; + + -- Compute value + if ( XNEGATIVE ) then + if ( YNEGATIVE ) then + VALUE := X + (FLOOR(ABS(X)/ABS(Y)))*ABS(Y); + else + VALUE := X + (CEIL(ABS(X)/ABS(Y)))*ABS(Y); + end if; + else + if ( YNEGATIVE ) then + VALUE := X - (CEIL(ABS(X)/ABS(Y)))*ABS(Y); + else + VALUE := X - (FLOOR(ABS(X)/ABS(Y)))*ABS(Y); + end if; + end if; + + return VALUE; + end "MOD"; + + + function REALMAX (X, Y : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) REALMAX(X,Y) = X when X = Y + -- + begin + if X >= Y then + return X; + else + return Y; + end if; + end REALMAX; + + function REALMIN (X, Y : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) REALMIN(X,Y) = X when X = Y + -- + begin + if X <= Y then + return X; + else + return Y; + end if; + end REALMIN; + + + procedure UNIFORM(variable SEED1,SEED2:inout POSITIVE;variable X:out REAL) + is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + -- + variable Z, K: INTEGER; + variable TSEED1 : INTEGER := INTEGER'(SEED1); + variable TSEED2 : INTEGER := INTEGER'(SEED2); + begin + -- Check validity of arguments + if SEED1 > 2147483562 then + assert FALSE + report "SEED1 > 2147483562 in UNIFORM" + severity ERROR; + X := 0.0; + return; + end if; + + if SEED2 > 2147483398 then + assert FALSE + report "SEED2 > 2147483398 in UNIFORM" + severity ERROR; + X := 0.0; + return; + end if; + + -- Compute new seed values and pseudo-random number + K := TSEED1/53668; + TSEED1 := 40014 * (TSEED1 - K * 53668) - K * 12211; + + if TSEED1 < 0 then + TSEED1 := TSEED1 + 2147483563; + end if; + + K := TSEED2/52774; + TSEED2 := 40692 * (TSEED2 - K * 52774) - K * 3791; + + if TSEED2 < 0 then + TSEED2 := TSEED2 + 2147483399; + end if; + + Z := TSEED1 - TSEED2; + if Z < 1 then + Z := Z + 2147483562; + end if; + + -- Get output values + SEED1 := POSITIVE'(TSEED1); + SEED2 := POSITIVE'(TSEED2); + X := REAL(Z)*4.656613e-10; + end UNIFORM; + + + + function SQRT (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Uses the Newton-Raphson approximation: + -- F(n+1) = 0.5*[F(n) + x/F(n)] + -- b) Returns 0.0 on error + -- + + constant EPS : REAL := BASE_EPS*BASE_EPS; -- Convergence factor + + variable INIVAL: REAL; + variable OLDVAL : REAL ; + variable NEWVAL : REAL ; + variable COUNT : INTEGER := 1; + + begin + -- Check validity of argument + if ( X < 0.0 ) then + assert FALSE + report "X < 0.0 in SQRT(X)" + severity ERROR; + return 0.0; + end if; + + -- Get the square root for special cases + if X = 0.0 then + return 0.0; + else + if ( X = 1.0 ) then + return 1.0; + end if; + end if; + + -- Get the square root for general cases + INIVAL := EXP(LOG(X)*(0.5)); -- Mathematically correct but imprecise + OLDVAL := INIVAL; + NEWVAL := (X/OLDVAL + OLDVAL)*0.5; + + -- Check for relative and absolute error and max count + while ( ( (ABS((NEWVAL -OLDVAL)/NEWVAL) > EPS) OR + (ABS(NEWVAL - OLDVAL) > EPS) ) AND + (COUNT < MAX_COUNT) ) loop + OLDVAL := NEWVAL; + NEWVAL := (X/OLDVAL + OLDVAL)*0.5; + COUNT := COUNT + 1; + end loop; + return NEWVAL; + end SQRT; + + function CBRT (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Uses the Newton-Raphson approximation: + -- F(n+1) = (1/3)*[2*F(n) + x/F(n)**2]; + -- + constant EPS : REAL := BASE_EPS*BASE_EPS; + + variable INIVAL: REAL; + variable XLOCAL : REAL := X; + variable NEGATIVE : BOOLEAN := X < 0.0; + variable OLDVAL : REAL ; + variable NEWVAL : REAL ; + variable COUNT : INTEGER := 1; + + begin + + -- Compute root for special cases + if X = 0.0 then + return 0.0; + elsif ( X = 1.0 ) then + return 1.0; + else + if X = -1.0 then + return -1.0; + end if; + end if; + + -- Compute root for general cases + if NEGATIVE then + XLOCAL := -X; + end if; + + INIVAL := EXP(LOG(XLOCAL)/(3.0)); -- Mathematically correct but + -- imprecise + OLDVAL := INIVAL; + NEWVAL := (XLOCAL/(OLDVAL*OLDVAL) + 2.0*OLDVAL)/3.0; + + -- Check for relative and absolute errors and max count + while ( ( (ABS((NEWVAL -OLDVAL)/NEWVAL) > EPS ) OR + (ABS(NEWVAL - OLDVAL) > EPS ) ) AND + ( COUNT < MAX_COUNT ) ) loop + OLDVAL := NEWVAL; + NEWVAL :=(XLOCAL/(OLDVAL*OLDVAL) + 2.0*OLDVAL)/3.0; + COUNT := COUNT + 1; + end loop; + + if NEGATIVE then + NEWVAL := -NEWVAL; + end if; + + return NEWVAL; + end CBRT; + + function "**" (X : in INTEGER; Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error condition + + begin + -- Check validity of argument + if ( ( X < 0 ) and ( Y /= 0.0 ) ) then + assert FALSE + report "X < 0 and Y /= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + if ( ( X = 0 ) and ( Y <= 0.0 ) ) then + assert FALSE + report "X = 0 and Y <= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + -- Get value for special cases + if ( X = 0 and Y > 0.0 ) then + return 0.0; + end if; + + if ( X = 1 ) then + return 1.0; + end if; + + if ( Y = 0.0 and X /= 0 ) then + return 1.0; + end if; + + if ( Y = 1.0) then + return (REAL(X)); + end if; + + -- Get value for general case + return EXP (Y * LOG (REAL(X))); + end "**"; + + function "**" (X : in REAL; Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error condition + + begin + -- Check validity of argument + if ( ( X < 0.0 ) and ( Y /= 0.0 ) ) then + assert FALSE + report "X < 0.0 and Y /= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + if ( ( X = 0.0 ) and ( Y <= 0.0 ) ) then + assert FALSE + report "X = 0.0 and Y <= 0.0 in X**Y" + severity ERROR; + return 0.0; + end if; + + -- Get value for special cases + if ( X = 0.0 and Y > 0.0 ) then + return 0.0; + end if; + + if ( X = 1.0 ) then + return 1.0; + end if; + + if ( Y = 0.0 and X /= 0.0 ) then + return 1.0; + end if; + + if ( Y = 1.0) then + return (X); + end if; + + -- Get value for general case + return EXP (Y * LOG (X)); + end "**"; + + function EXP (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) This function computes the exponential using the following + -- series: + -- exp(x) = 1 + x + x**2/2! + x**3/3! + ... ; |x| < 1.0 + -- and reduces argument X to take advantage of exp(x+y) = + -- exp(x)*exp(y) + -- + -- b) This implementation limits X to be less than LOG(REAL'HIGH) + -- to avoid overflow. Returns REAL'HIGH when X reaches that + -- limit + -- + constant EPS : REAL := BASE_EPS*BASE_EPS*BASE_EPS;-- Precision criteria + + variable RECIPROCAL: BOOLEAN := X < 0.0;-- Check sign of argument + variable XLOCAL : REAL := ABS(X); -- Use positive value + variable OLDVAL: REAL ; + variable COUNT: INTEGER ; + variable NEWVAL: REAL ; + variable LAST_TERM: REAL ; + variable FACTOR : REAL := 1.0; + + begin + -- Compute value for special cases + if X = 0.0 then + return 1.0; + end if; + + if XLOCAL = 1.0 then + if RECIPROCAL then + return MATH_1_OVER_E; + else + return MATH_E; + end if; + end if; + + if XLOCAL = 2.0 then + if RECIPROCAL then + return 1.0/MATH_E_P2; + else + return MATH_E_P2; + end if; + end if; + + if XLOCAL = 10.0 then + if RECIPROCAL then + return 1.0/MATH_E_P10; + else + return MATH_E_P10; + end if; + end if; + + if XLOCAL > LOG(REAL'HIGH) then + if RECIPROCAL then + return 0.0; + else + assert FALSE + report "X > LOG(REAL'HIGH) in EXP(X)" + severity NOTE; + return REAL'HIGH; + end if; + end if; + + -- Reduce argument to ABS(X) < 1.0 + while XLOCAL > 10.0 loop + XLOCAL := XLOCAL - 10.0; + FACTOR := FACTOR*MATH_E_P10; + end loop; + + while XLOCAL > 1.0 loop + XLOCAL := XLOCAL - 1.0; + FACTOR := FACTOR*MATH_E; + end loop; + + -- Compute value for case 0 < XLOCAL < 1 + OLDVAL := 1.0; + LAST_TERM := XLOCAL; + NEWVAL:= OLDVAL + LAST_TERM; + COUNT := 2; + + -- Check for relative and absolute errors and max count + while ( ( (ABS((NEWVAL - OLDVAL)/NEWVAL) > EPS) OR + (ABS(NEWVAL - OLDVAL) > EPS) ) AND + (COUNT < MAX_COUNT ) ) loop + OLDVAL := NEWVAL; + LAST_TERM := LAST_TERM*(XLOCAL / (REAL(COUNT))); + NEWVAL := OLDVAL + LAST_TERM; + COUNT := COUNT + 1; + end loop; + + -- Compute final value using exp(x+y) = exp(x)*exp(y) + NEWVAL := NEWVAL*FACTOR; + + if RECIPROCAL then + NEWVAL := 1.0/NEWVAL; + end if; + + return NEWVAL; + end EXP; + + + -- + -- Auxiliary Functions to Compute LOG + -- + function ILOGB(X: in REAL) return INTEGER IS + -- Description: + -- Returns n such that -1 <= ABS(X)/2^n < 2 + -- Notes: + -- None + + variable N: INTEGER := 0; + variable Y: REAL := ABS(X); + + begin + if(Y = 1.0 or Y = 0.0) then + return 0; + end if; + + if( Y > 1.0) then + while Y >= 2.0 loop + Y := Y/2.0; + N := N+1; + end loop; + return N; + end if; + + -- O < Y < 1 + while Y < 1.0 loop + Y := Y*2.0; + N := N -1; + end loop; + return N; + end ILOGB; + + function LDEXP(X: in REAL; N: in INTEGER) RETURN REAL IS + -- Description: + -- Returns X*2^n + -- Notes: + -- None + begin + return X*(2.0 ** N); + end LDEXP; + + function LOG (X : in REAL ) return REAL IS + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- + -- Notes: + -- a) Returns REAL'LOW on error + -- + -- Copyright (c) 1992 Regents of the University of California. + -- All rights reserved. + -- + -- Redistribution and use in source and binary forms, with or without + -- modification, are permitted provided that the following conditions + -- are met: + -- 1. Redistributions of source code must retain the above copyright + -- notice, this list of conditions and the following disclaimer. + -- 2. Redistributions in binary form must reproduce the above copyright + -- notice, this list of conditions and the following disclaimer in the + -- documentation and/or other materials provided with the distribution. + -- 3. All advertising materials mentioning features or use of this + -- software must display the following acknowledgement: + -- This product includes software developed by the University of + -- California, Berkeley and its contributors. + -- 4. Neither the name of the University nor the names of its + -- contributors may be used to endorse or promote products derived + -- from this software without specific prior written permission. + -- + -- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' + -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + -- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR + -- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + -- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + -- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + -- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + -- USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + -- DAMAGE. + -- + -- NOTE: This VHDL version was generated using the C version of the + -- original function by the IEEE VHDL Mathematical Package + -- Working Group (CS/JT) + + constant N: INTEGER := 128; + + -- Table of log(Fj) = logF_head[j] + logF_tail[j], for Fj = 1+j/128. + -- Used for generation of extend precision logarithms. + -- The constant 35184372088832 is 2^45, so the divide is exact. + -- It ensures correct reading of logF_head, even for inaccurate + -- decimal-to-binary conversion routines. (Everybody gets the + -- right answer for INTEGERs less than 2^53.) + -- Values for LOG(F) were generated using error < 10^-57 absolute + -- with the bc -l package. + + type REAL_VECTOR is array (NATURAL range <>) of REAL; + + constant A1:REAL := 0.08333333333333178827; + constant A2:REAL := 0.01250000000377174923; + constant A3:REAL := 0.002232139987919447809; + constant A4:REAL := 0.0004348877777076145742; + + constant LOGF_HEAD: REAL_VECTOR(0 TO N) := ( + 0.0, + 0.007782140442060381246, + 0.015504186535963526694, + 0.023167059281547608406, + 0.030771658666765233647, + 0.038318864302141264488, + 0.045809536031242714670, + 0.053244514518837604555, + 0.060624621816486978786, + 0.067950661908525944454, + 0.075223421237524235039, + 0.082443669210988446138, + 0.089612158689760690322, + 0.096729626458454731618, + 0.103796793681567578460, + 0.110814366340264314203, + 0.117783035656430001836, + 0.124703478501032805070, + 0.131576357788617315236, + 0.138402322859292326029, + 0.145182009844575077295, + 0.151916042025732167530, + 0.158605030176659056451, + 0.165249572895390883786, + 0.171850256926518341060, + 0.178407657472689606947, + 0.184922338493834104156, + 0.191394852999565046047, + 0.197825743329758552135, + 0.204215541428766300668, + 0.210564769107350002741, + 0.216873938300523150246, + 0.223143551314024080056, + 0.229374101064877322642, + 0.235566071312860003672, + 0.241719936886966024758, + 0.247836163904594286577, + 0.253915209980732470285, + 0.259957524436686071567, + 0.265963548496984003577, + 0.271933715484010463114, + 0.277868451003087102435, + 0.283768173130738432519, + 0.289633292582948342896, + 0.295464212893421063199, + 0.301261330578199704177, + 0.307025035294827830512, + 0.312755710004239517729, + 0.318453731118097493890, + 0.324119468654316733591, + 0.329753286372579168528, + 0.335355541920762334484, + 0.340926586970454081892, + 0.346466767346100823488, + 0.351976423156884266063, + 0.357455888922231679316, + 0.362905493689140712376, + 0.368325561158599157352, + 0.373716409793814818840, + 0.379078352934811846353, + 0.384411698910298582632, + 0.389716751140440464951, + 0.394993808240542421117, + 0.400243164127459749579, + 0.405465108107819105498, + 0.410659924985338875558, + 0.415827895143593195825, + 0.420969294644237379543, + 0.426084395310681429691, + 0.431173464818130014464, + 0.436236766774527495726, + 0.441274560805140936281, + 0.446287102628048160113, + 0.451274644139630254358, + 0.456237433481874177232, + 0.461175715122408291790, + 0.466089729924533457960, + 0.470979715219073113985, + 0.475845904869856894947, + 0.480688529345570714212, + 0.485507815781602403149, + 0.490303988045525329653, + 0.495077266798034543171, + 0.499827869556611403822, + 0.504556010751912253908, + 0.509261901790523552335, + 0.513945751101346104405, + 0.518607764208354637958, + 0.523248143765158602036, + 0.527867089620485785417, + 0.532464798869114019908, + 0.537041465897345915436, + 0.541597282432121573947, + 0.546132437597407260909, + 0.550647117952394182793, + 0.555141507540611200965, + 0.559615787935399566777, + 0.564070138285387656651, + 0.568504735352689749561, + 0.572919753562018740922, + 0.577315365035246941260, + 0.581691739635061821900, + 0.586049045003164792433, + 0.590387446602107957005, + 0.594707107746216934174, + 0.599008189645246602594, + 0.603290851438941899687, + 0.607555250224322662688, + 0.611801541106615331955, + 0.616029877215623855590, + 0.620240409751204424537, + 0.624433288012369303032, + 0.628608659422752680256, + 0.632766669570628437213, + 0.636907462236194987781, + 0.641031179420679109171, + 0.645137961373620782978, + 0.649227946625615004450, + 0.653301272011958644725, + 0.657358072709030238911, + 0.661398482245203922502, + 0.665422632544505177065, + 0.669430653942981734871, + 0.673422675212350441142, + 0.677398823590920073911, + 0.681359224807238206267, + 0.685304003098281100392, + 0.689233281238557538017, + 0.693147180560117703862); + + constant LOGF_TAIL: REAL_VECTOR(0 TO N) := ( + 0.0, + -0.00000000000000543229938420049, + 0.00000000000000172745674997061, + -0.00000000000001323017818229233, + -0.00000000000001154527628289872, + -0.00000000000000466529469958300, + 0.00000000000005148849572685810, + -0.00000000000002532168943117445, + -0.00000000000005213620639136504, + -0.00000000000001819506003016881, + 0.00000000000006329065958724544, + 0.00000000000008614512936087814, + -0.00000000000007355770219435028, + 0.00000000000009638067658552277, + 0.00000000000007598636597194141, + 0.00000000000002579999128306990, + -0.00000000000004654729747598444, + -0.00000000000007556920687451336, + 0.00000000000010195735223708472, + -0.00000000000017319034406422306, + -0.00000000000007718001336828098, + 0.00000000000010980754099855238, + -0.00000000000002047235780046195, + -0.00000000000008372091099235912, + 0.00000000000014088127937111135, + 0.00000000000012869017157588257, + 0.00000000000017788850778198106, + 0.00000000000006440856150696891, + 0.00000000000016132822667240822, + -0.00000000000007540916511956188, + -0.00000000000000036507188831790, + 0.00000000000009120937249914984, + 0.00000000000018567570959796010, + -0.00000000000003149265065191483, + -0.00000000000009309459495196889, + 0.00000000000017914338601329117, + -0.00000000000001302979717330866, + 0.00000000000023097385217586939, + 0.00000000000023999540484211737, + 0.00000000000015393776174455408, + -0.00000000000036870428315837678, + 0.00000000000036920375082080089, + -0.00000000000009383417223663699, + 0.00000000000009433398189512690, + 0.00000000000041481318704258568, + -0.00000000000003792316480209314, + 0.00000000000008403156304792424, + -0.00000000000034262934348285429, + 0.00000000000043712191957429145, + -0.00000000000010475750058776541, + -0.00000000000011118671389559323, + 0.00000000000037549577257259853, + 0.00000000000013912841212197565, + 0.00000000000010775743037572640, + 0.00000000000029391859187648000, + -0.00000000000042790509060060774, + 0.00000000000022774076114039555, + 0.00000000000010849569622967912, + -0.00000000000023073801945705758, + 0.00000000000015761203773969435, + 0.00000000000003345710269544082, + -0.00000000000041525158063436123, + 0.00000000000032655698896907146, + -0.00000000000044704265010452446, + 0.00000000000034527647952039772, + -0.00000000000007048962392109746, + 0.00000000000011776978751369214, + -0.00000000000010774341461609578, + 0.00000000000021863343293215910, + 0.00000000000024132639491333131, + 0.00000000000039057462209830700, + -0.00000000000026570679203560751, + 0.00000000000037135141919592021, + -0.00000000000017166921336082431, + -0.00000000000028658285157914353, + -0.00000000000023812542263446809, + 0.00000000000006576659768580062, + -0.00000000000028210143846181267, + 0.00000000000010701931762114254, + 0.00000000000018119346366441110, + 0.00000000000009840465278232627, + -0.00000000000033149150282752542, + -0.00000000000018302857356041668, + -0.00000000000016207400156744949, + 0.00000000000048303314949553201, + -0.00000000000071560553172382115, + 0.00000000000088821239518571855, + -0.00000000000030900580513238244, + -0.00000000000061076551972851496, + 0.00000000000035659969663347830, + 0.00000000000035782396591276383, + -0.00000000000046226087001544578, + 0.00000000000062279762917225156, + 0.00000000000072838947272065741, + 0.00000000000026809646615211673, + -0.00000000000010960825046059278, + 0.00000000000002311949383800537, + -0.00000000000058469058005299247, + -0.00000000000002103748251144494, + -0.00000000000023323182945587408, + -0.00000000000042333694288141916, + -0.00000000000043933937969737844, + 0.00000000000041341647073835565, + 0.00000000000006841763641591466, + 0.00000000000047585534004430641, + 0.00000000000083679678674757695, + -0.00000000000085763734646658640, + 0.00000000000021913281229340092, + -0.00000000000062242842536431148, + -0.00000000000010983594325438430, + 0.00000000000065310431377633651, + -0.00000000000047580199021710769, + -0.00000000000037854251265457040, + 0.00000000000040939233218678664, + 0.00000000000087424383914858291, + 0.00000000000025218188456842882, + -0.00000000000003608131360422557, + -0.00000000000050518555924280902, + 0.00000000000078699403323355317, + -0.00000000000067020876961949060, + 0.00000000000016108575753932458, + 0.00000000000058527188436251509, + -0.00000000000035246757297904791, + -0.00000000000018372084495629058, + 0.00000000000088606689813494916, + 0.00000000000066486268071468700, + 0.00000000000063831615170646519, + 0.00000000000025144230728376072, + -0.00000000000017239444525614834); + + variable M, J:INTEGER; + variable F1, F2, G, Q, U, U2, V: REAL; + variable ZERO: REAL := 0.0;--Made variable so no constant folding occurs + variable ONE: REAL := 1.0; --Made variable so no constant folding occurs + + -- double logb(), ldexp(); + + variable U1:REAL; + + begin + + -- Check validity of argument + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = MATH_E ) then + return 1.0; + end if; + + -- Argument reduction: 1 <= g < 2; x/2^m = g; + -- y = F*(1 + f/F) for |f| <= 2^-8 + + M := ILOGB(X); + G := LDEXP(X, -M); + J := INTEGER(REAL(N)*(G-1.0)); -- C code adds 0.5 for rounding + F1 := (1.0/REAL(N)) * REAL(J) + 1.0; --F1*128 is an INTEGER in [128,512] + F2 := G - F1; + + -- Approximate expansion for log(1+f2/F1) ~= u + q + G := 1.0/(2.0*F1+F2); + U := 2.0*F2*G; + V := U*U; + Q := U*V*(A1 + V*(A2 + V*(A3 + V*A4))); + + -- Case 1: u1 = u rounded to 2^-43 absolute. Since u < 2^-8, + -- u1 has at most 35 bits, and F1*u1 is exact, as F1 has < 8 bits. + -- It also adds exactly to |m*log2_hi + log_F_head[j] | < 750. + -- + if ( J /= 0 or M /= 0) then + U1 := U + 513.0; + U1 := U1 - 513.0; + + -- Case 2: |1-x| < 1/256. The m- and j- dependent terms are zero + -- u1 = u to 24 bits. + -- + else + U1 := U; + --TRUNC(U1); --In c this is u1 = (double) (float) (u1) + end if; + + U2 := (2.0*(F2 - F1*U1) - U1*F2) * G; + -- u1 + u2 = 2f/(2F+f) to extra precision. + + -- log(x) = log(2^m*F1*(1+f2/F1)) = + -- (m*log2_hi+LOGF_HEAD(j)+u1) + (m*log2_lo+LOGF_TAIL(j)+q); + -- (exact) + (tiny) + + U1 := U1 + REAL(M)*LOGF_HEAD(N) + LOGF_HEAD(J); -- Exact + U2 := (U2 + LOGF_TAIL(J)) + Q; -- Tiny + U2 := U2 + LOGF_TAIL(N)*REAL(M); + return (U1 + U2); + end LOG; + + + function LOG2 (X: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG2(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = 2.0 ) then + return 1.0; + end if; + + -- Compute value for general case + return ( MATH_LOG2_OF_E*LOG(X) ); + end LOG2; + + + function LOG10 (X: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG10(X)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = 10.0 ) then + return 1.0; + end if; + + -- Compute value for general case + return ( MATH_LOG10_OF_E*LOG(X) ); + end LOG10; + + + function LOG (X: in REAL; BASE: in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns REAL'LOW on error + begin + -- Check validity of arguments + if ( X <= 0.0 ) then + assert FALSE + report "X <= 0.0 in LOG(X, BASE)" + severity ERROR; + return(REAL'LOW); + end if; + + if ( BASE <= 0.0 or BASE = 1.0 ) then + assert FALSE + report "BASE <= 0.0 or BASE = 1.0 in LOG(X, BASE)" + severity ERROR; + return(REAL'LOW); + end if; + + -- Compute value for special cases + if ( X = 1.0 ) then + return 0.0; + end if; + + if ( X = BASE ) then + return 1.0; + end if; + + -- Compute value for general case + return ( LOG(X)/LOG(BASE)); + end LOG; + + + function SIN (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) SIN(-X) = -SIN(X) + -- b) SIN(X) = X if ABS(X) < EPS + -- c) SIN(X) = X - X**3/3! if EPS < ABS(X) < BASE_EPS + -- d) SIN(MATH_PI_OVER_2 - X) = COS(X) + -- e) COS(X) = 1.0 - 0.5*X**2 if ABS(X) < EPS + -- f) COS(X) = 1.0 - 0.5*X**2 + (X**4)/4! if + -- EPS< ABS(X) MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in SIN(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_2_PI or XLOCAL = MATH_PI then + return 0.0; + end if; + + if XLOCAL = MATH_PI_OVER_2 then + if NEGATIVE then + return -1.0; + else + return 1.0; + end if; + end if; + + if XLOCAL = MATH_3_PI_OVER_2 then + if NEGATIVE then + return 1.0; + else + return -1.0; + end if; + end if; + + if XLOCAL < EPS then + if NEGATIVE then + return -XLOCAL; + else + return XLOCAL; + end if; + else + if XLOCAL < BASE_EPS then + TEMP := XLOCAL - (XLOCAL*XLOCAL*XLOCAL)/6.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := MATH_PI - XLOCAL; + if ABS(TEMP) < EPS then + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + else + if ABS(TEMP) < BASE_EPS then + TEMP := TEMP - (TEMP*TEMP*TEMP)/6.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := MATH_2_PI - XLOCAL; + if ABS(TEMP) < EPS then + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + else + if ABS(TEMP) < BASE_EPS then + TEMP := TEMP - (TEMP*TEMP*TEMP)/6.0; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + end if; + end if; + + TEMP := ABS(MATH_PI_OVER_2 - XLOCAL); + if TEMP < EPS then + TEMP := 1.0 - TEMP*TEMP*0.5; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + else + if TEMP < BASE_EPS then + TEMP := 1.0 -TEMP*TEMP*0.5 + TEMP*TEMP*TEMP*TEMP/24.0; + if NEGATIVE then + return -TEMP; + else + return TEMP; + end if; + end if; + end if; + + TEMP := ABS(MATH_3_PI_OVER_2 - XLOCAL); + if TEMP < EPS then + TEMP := 1.0 - TEMP*TEMP*0.5; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + else + if TEMP < BASE_EPS then + TEMP := 1.0 -TEMP*TEMP*0.5 + TEMP*TEMP*TEMP*TEMP/24.0; + if NEGATIVE then + return TEMP; + else + return -TEMP; + end if; + end if; + end if; + + -- Compute value for general cases + if ((XLOCAL < MATH_PI_OVER_2 ) and (XLOCAL > 0.0)) then + VALUE:= CORDIC( KC, 0.0, x, 27, ROTATION)(1); + end if; + + N := INTEGER ( FLOOR(XLOCAL/MATH_PI_OVER_2)); + case QUADRANT( N mod 4) is + when 0 => + VALUE := CORDIC( KC, 0.0, XLOCAL, 27, ROTATION)(1); + when 1 => + VALUE := CORDIC( KC, 0.0, XLOCAL - MATH_PI_OVER_2, 27, + ROTATION)(0); + when 2 => + VALUE := -CORDIC( KC, 0.0, XLOCAL - MATH_PI, 27, ROTATION)(1); + when 3 => + VALUE := -CORDIC( KC, 0.0, XLOCAL - MATH_3_PI_OVER_2, 27, + ROTATION)(0); + end case; + + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end SIN; + + + function COS (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) COS(-X) = COS(X) + -- b) COS(X) = SIN(MATH_PI_OVER_2 - X) + -- c) COS(MATH_PI + X) = -COS(X) + -- d) COS(X) = 1.0 - X*X/2.0 if ABS(X) < EPS + -- e) COS(X) = 1.0 - 0.5*X**2 + (X**4)/4! if + -- EPS< ABS(X) MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in COS(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_2_PI then + return 1.0; + end if; + + if XLOCAL = MATH_PI then + return -1.0; + end if; + + if XLOCAL = MATH_PI_OVER_2 or XLOCAL = MATH_3_PI_OVER_2 then + return 0.0; + end if; + + TEMP := ABS(XLOCAL); + if ( TEMP < EPS) then + return (1.0 - 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (1.0 -0.5*TEMP*TEMP + TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + TEMP := ABS(XLOCAL -MATH_2_PI); + if ( TEMP < EPS) then + return (1.0 - 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (1.0 -0.5*TEMP*TEMP + TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + TEMP := ABS (XLOCAL - MATH_PI); + if TEMP < EPS then + return (-1.0 + 0.5*TEMP*TEMP); + else + if (TEMP < BASE_EPS) then + return (-1.0 +0.5*TEMP*TEMP - TEMP*TEMP*TEMP*TEMP/24.0); + end if; + end if; + + -- Compute value for general cases + return SIN(MATH_PI_OVER_2 - XLOCAL); + end COS; + + function TAN (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) TAN(0.0) = 0.0 + -- b) TAN(-X) = -TAN(X) + -- c) Returns REAL'LOW on error if X < 0.0 + -- d) Returns REAL'HIGH on error if X > 0.0 + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X) ; + variable VALUE: REAL; + variable TEMP : REAL; + + begin + -- Make 0.0 <= XLOCAL <= MATH_2_PI + if XLOCAL > MATH_2_PI then + TEMP := FLOOR(XLOCAL/MATH_2_PI); + XLOCAL := XLOCAL - TEMP*MATH_2_PI; + end if; + + if XLOCAL < 0.0 then + assert FALSE + report "XLOCAL <= 0.0 after reduction in TAN(X)" + severity ERROR; + XLOCAL := -XLOCAL; + end if; + + -- Check validity of argument + if XLOCAL = MATH_PI_OVER_2 then + assert FALSE + report "X is a multiple of MATH_PI_OVER_2 in TAN(X)" + severity ERROR; + if NEGATIVE then + return(REAL'LOW); + else + return(REAL'HIGH); + end if; + end if; + + if XLOCAL = MATH_3_PI_OVER_2 then + assert FALSE + report "X is a multiple of MATH_3_PI_OVER_2 in TAN(X)" + severity ERROR; + if NEGATIVE then + return(REAL'HIGH); + else + return(REAL'LOW); + end if; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 or XLOCAL = MATH_PI then + return 0.0; + end if; + + -- Compute value for general cases + VALUE := SIN(XLOCAL)/COS(XLOCAL); + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end TAN; + + function ARCSIN (X : in REAL ) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCSIN(-X) = -ARCSIN(X) + -- b) Returns X on error + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable VALUE : REAL; + + begin + -- Check validity of arguments + if XLOCAL > 1.0 then + assert FALSE + report "ABS(X) > 1.0 in ARCSIN(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + elsif XLOCAL = 1.0 then + if NEGATIVE then + return -MATH_PI_OVER_2; + else + return MATH_PI_OVER_2; + end if; + end if; + + -- Compute value for general cases + if XLOCAL < 0.9 then + VALUE := ARCTAN(XLOCAL/(SQRT(1.0 - XLOCAL*XLOCAL))); + else + VALUE := MATH_PI_OVER_2 - ARCTAN(SQRT(1.0 - XLOCAL*XLOCAL)/XLOCAL); + end if; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCSIN; + + function ARCCOS (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCCOS(-X) = MATH_PI - ARCCOS(X) + -- b) Returns X on error + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable VALUE : REAL; + + begin + -- Check validity of argument + if XLOCAL > 1.0 then + assert FALSE + report "ABS(X) > 1.0 in ARCCOS(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 1.0 then + return 0.0; + elsif X = 0.0 then + return MATH_PI_OVER_2; + elsif X = -1.0 then + return MATH_PI; + end if; + + -- Compute value for general cases + if XLOCAL > 0.9 then + VALUE := ARCTAN(SQRT(1.0 - XLOCAL*XLOCAL)/XLOCAL); + else + VALUE := MATH_PI_OVER_2 - ARCTAN(XLOCAL/SQRT(1.0 - XLOCAL*XLOCAL)); + end if; + + + if NEGATIVE then + VALUE := MATH_PI - VALUE; + end if; + + return VALUE; + end ARCCOS; + + + function ARCTAN (Y : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) ARCTAN(-Y) = -ARCTAN(Y) + -- b) ARCTAN(Y) = -ARCTAN(1.0/Y) + MATH_PI_OVER_2 for |Y| > 1.0 + -- c) ARCTAN(Y) = Y for |Y| < EPS + + constant EPS : REAL := BASE_EPS*BASE_EPS*BASE_EPS; + + variable NEGATIVE : BOOLEAN := Y < 0.0; + variable RECIPROCAL : BOOLEAN; + variable YLOCAL : REAL := ABS(Y); + variable VALUE : REAL; + + begin + -- Make argument |Y| <=1.0 + if YLOCAL > 1.0 then + YLOCAL := 1.0/YLOCAL; + RECIPROCAL := TRUE; + else + RECIPROCAL := FALSE; + end if; + + -- Compute value for special cases + if YLOCAL = 0.0 then + if RECIPROCAL then + if NEGATIVE then + return (-MATH_PI_OVER_2); + else + return (MATH_PI_OVER_2); + end if; + else + return 0.0; + end if; + end if; + + if YLOCAL < EPS then + if NEGATIVE then + if RECIPROCAL then + return (-MATH_PI_OVER_2 + YLOCAL); + else + return -YLOCAL; + end if; + else + if RECIPROCAL then + return (MATH_PI_OVER_2 - YLOCAL); + else + return YLOCAL; + end if; + end if; + end if; + + -- Compute value for general cases + VALUE := CORDIC( 1.0, YLOCAL, 0.0, 27, VECTORING )(2); + + if RECIPROCAL then + VALUE := MATH_PI_OVER_2 - VALUE; + end if; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCTAN; + + + function ARCTAN (Y : in REAL; X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns 0.0 on error + + variable YLOCAL : REAL; + variable VALUE : REAL; + begin + + -- Check validity of arguments + if (Y = 0.0 and X = 0.0 ) then + assert FALSE report + "ARCTAN(0.0, 0.0) is undetermined" + severity ERROR; + return 0.0; + end if; + + -- Compute value for special cases + if Y = 0.0 then + if X > 0.0 then + return 0.0; + else + return MATH_PI; + end if; + end if; + + if X = 0.0 then + if Y > 0.0 then + return MATH_PI_OVER_2; + else + return -MATH_PI_OVER_2; + end if; + end if; + + + -- Compute value for general cases + YLOCAL := ABS(Y/X); + + VALUE := ARCTAN(YLOCAL); + + if X < 0.0 then + VALUE := MATH_PI - VALUE; + end if; + + if Y < 0.0 then + VALUE := -VALUE; + end if; + + return VALUE; + end ARCTAN; + + + function SINH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) - EXP(-X))/2.0 + -- b) SINH(-X) = SINH(X) + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP - 1.0/TEMP)*0.5; + + if NEGATIVE then + VALUE := -VALUE; + end if; + + return VALUE; + end SINH; + + function COSH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) + EXP(-X))/2.0 + -- b) COSH(-X) = COSH(X) + + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 1.0; + end if; + + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP + 1.0/TEMP)*0.5; + + return VALUE; + end COSH; + + function TANH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (EXP(X) - EXP(-X))/(EXP(X) + EXP(-X)) + -- b) TANH(-X) = -TANH(X) + + variable NEGATIVE : BOOLEAN := X < 0.0; + variable XLOCAL : REAL := ABS(X); + variable TEMP : REAL; + variable VALUE : REAL; + + begin + -- Compute value for special cases + if XLOCAL = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + TEMP := EXP(XLOCAL); + VALUE := (TEMP - 1.0/TEMP)/(TEMP + 1.0/TEMP); + + if NEGATIVE then + return -VALUE; + else + return VALUE; + end if; + end TANH; + + function ARCSINH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns LOG( X + SQRT( X*X + 1.0)) + + begin + -- Compute value for special cases + if X = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + return ( LOG( X + SQRT( X*X + 1.0)) ); + end ARCSINH; + + + + function ARCCOSH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns LOG( X + SQRT( X*X - 1.0)); X >= 1.0 + -- b) Returns X on error + + begin + -- Check validity of arguments + if X < 1.0 then + assert FALSE + report "X < 1.0 in ARCCOSH(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 1.0 then + return 0.0; + end if; + + -- Compute value for general cases + return ( LOG( X + SQRT( X*X - 1.0))); + end ARCCOSH; + + function ARCTANH (X : in REAL) return REAL is + -- Description: + -- See function declaration in IEEE Std 1076.2-1996 + -- Notes: + -- a) Returns (LOG( (1.0 + X)/(1.0 - X)))/2.0 ; | X | < 1.0 + -- b) Returns X on error + begin + -- Check validity of arguments + if ABS(X) >= 1.0 then + assert FALSE + report "ABS(X) >= 1.0 in ARCTANH(X)" + severity ERROR; + return X; + end if; + + -- Compute value for special cases + if X = 0.0 then + return 0.0; + end if; + + -- Compute value for general cases + return( 0.5*LOG( (1.0+X)/(1.0-X) ) ); + end ARCTANH; + +end MATH_REAL; diff --git a/display/fpga/ip/pll0/generate_core.tcl b/display/fpga/ip/pll0/generate_core.tcl new file mode 100644 index 0000000..23a0622 --- /dev/null +++ b/display/fpga/ip/pll0/generate_core.tcl @@ -0,0 +1,100 @@ +#!/usr/local/bin/wish + +proc GetPlatform {} { + global tcl_platform + + set cpu $tcl_platform(machine) + + switch $cpu { + intel - + i*86* { + set cpu ix86 + } + x86_64 { + if {$tcl_platform(wordSize) == 4} { + set cpu ix86 + } + } + } + + switch $tcl_platform(platform) { + windows { + if {$cpu == "amd64"} { + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 + } + if {$cpu == "x86_64"} { + return "nt64" + } else { + return "nt" + } + } + unix { + if {$tcl_platform(os) == "Linux"} { + if {$cpu == "x86_64"} { + return "lin64" + } else { + return "lin" + } + } else { + return "sol" + } + } + } + return "nt" +} + +proc GetCmdLine {lpcfile} { + global Para + + if [catch {open $lpcfile r} fileid] { + puts "Cannot open $para_file file!" + exit -1 + } + + seek $fileid 0 start + set default_match 0 + while {[gets $fileid line] >= 0} { + if {[string first "\[Command\]" $line] == 0} { + set default_match 1 + continue + } + if {[string first "\[" $line] == 0} { + set default_match 0 + } + if {$default_match == 1} { + if [regexp {([^=]*)=(.*)} $line match parameter value] { + if [regexp {([ |\t]*;)} $parameter match] {continue} + if [regexp {(.*)[ |\t]*;} $value match temp] { + set Para($parameter) $temp + } else { + set Para($parameter) $value + } + } + } + } + set default_match 0 + close $fileid + + return $Para(cmd_line) +} + +set platformpath [GetPlatform] +set Para(sbp_path) [file dirname [info script]] +set Para(install_dir) $env(TOOLRTF) +set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]" + +set scuba "$Para(FPGAPath)/scuba" +set modulename "pll0" +set lang "vhdl" +set lpcfile "$Para(sbp_path)/$modulename.lpc" +set arch "xo2c00" +set cmd_line [GetCmdLine $lpcfile] +set fdcfile "$Para(sbp_path)/$modulename.fdc" +if {[file exists $fdcfile] == 0} { + append scuba " " $cmd_line +} else { + append scuba " " $cmd_line " " -fdc " " \"$fdcfile\" +} +set Para(result) [catch {eval exec "$scuba"} msg] +#puts $msg diff --git a/display/fpga/ip/pll0/generate_ngd.tcl b/display/fpga/ip/pll0/generate_ngd.tcl new file mode 100644 index 0000000..f16dd0a --- /dev/null +++ b/display/fpga/ip/pll0/generate_ngd.tcl @@ -0,0 +1,115 @@ +#!/usr/local/bin/wish + +proc GetPlatform {} { + global tcl_platform + + set cpu $tcl_platform(machine) + + switch $cpu { + intel - + i*86* { + set cpu ix86 + } + x86_64 { + if {$tcl_platform(wordSize) == 4} { + set cpu ix86 + } + } + } + + switch $tcl_platform(platform) { + windows { + if {$cpu == "amd64"} { + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 + } + if {$cpu == "x86_64"} { + return "nt64" + } else { + return "nt" + } + } + unix { + if {$tcl_platform(os) == "Linux"} { + if {$cpu == "x86_64"} { + return "lin64" + } else { + return "lin" + } + } else { + return "sol" + } + } + } + return "nt" +} + +set platformpath [GetPlatform] +set Para(sbp_path) [file dirname [info script]] +set Para(install_dir) $env(TOOLRTF) +set Para(FPGAPath) "[file join $Para(install_dir) ispfpga bin $platformpath]" +set Para(bin_dir) "[file join $Para(install_dir) bin $platformpath]" + +set Para(ModuleName) "pll0" +set Para(Module) "PLL" +set Para(libname) machxo2 +set Para(arch_name) xo2c00 +set Para(PartType) "LCMXO2-1200HC" + +set Para(tech_syn) machxo2 +set Para(tech_cae) machxo2 +set Para(Package) "QFN32" +set Para(SpeedGrade) "5" +set Para(FMax) "100" +set fdcfile "$Para(sbp_path)/$Para(ModuleName).fdc" + +#create response file(*.cmd) for Synpwrap +proc CreateCmdFile {} { + global Para + + file mkdir "$Para(sbp_path)/syn_results" + if [catch {open $Para(ModuleName).cmd w} rspFile] { + puts "Cannot create response file $Para(ModuleName).cmd." + exit -1 + } else { + puts $rspFile "PROJECT: $Para(ModuleName) + working_path: \"$Para(sbp_path)/syn_results\" + module: $Para(ModuleName) + verilog_file_list: \"$Para(sbp_path)/$Para(ModuleName).vhd\" + vlog_std_v2001: true + constraint_file_name: \"$Para(sbp_path)/$Para(ModuleName).fdc\" + suffix_name: edn + output_file_name: $Para(ModuleName) + write_prf: true + disable_io_insertion: true + force_gsr: false + frequency: $Para(FMax) + fanout_limit: 50 + retiming: false + pipe: false + part: $Para(PartType) + speed_grade: $Para(SpeedGrade) + " + close $rspFile + } +} + +#synpwrap +CreateCmdFile +set synpwrap "$Para(bin_dir)/synpwrap" +if {[file exists $fdcfile] == 0} { + set Para(result) [catch {eval exec $synpwrap -rem -e $Para(ModuleName) -target $Para(tech_syn)} msg] +} else { + set Para(result) [catch {eval exec $synpwrap -rem -e $Para(ModuleName) -target $Para(tech_syn) -fdc $fdcfile} msg] +} +#puts $msg + +#edif2ngd +set edif2ngd "$Para(FPGAPath)/edif2ngd" +set Para(result) [catch {eval exec $edif2ngd -l $Para(libname) -d $Para(PartType) -nopropwarn \"syn_results/$Para(ModuleName).edn\" $Para(ModuleName).ngo} msg] +#puts $msg + +#ngdbuild +set ngdbuild "$Para(FPGAPath)/ngdbuild" +set Para(result) [catch {eval exec $ngdbuild -addiobuf -dt -a $Para(arch_name) $Para(ModuleName).ngo $Para(ModuleName).ngd} msg] +#puts $msg diff --git a/display/fpga/ip/pll0/msg_file.log b/display/fpga/ip/pll0/msg_file.log new file mode 100644 index 0000000..1196c02 --- /dev/null +++ b/display/fpga/ip/pll0/msg_file.log @@ -0,0 +1,29 @@ +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Tue Apr 24 22:15:53 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + +BEGIN SCUBA Module Synthesis + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n pll0 -lang vhdl -synth synplify -arch xo2c00 -type pll -fin 12 -fclkop 96 -fclkop_tol 0.0 -trimp 0 -phasep 0 -trimp_r -phase_cntl STATIC -fb_mode 1 -lock + Circuit name : pll0 + Module type : pll + Module Version : 5.7 + Ports : + Inputs : CLKI + Outputs : CLKOP, LOCK + I/O buffer : not inserted + EDIF output : pll0.edn + VHDL output : pll0.vhd + VHDL template : pll0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : pll0.srp + Estimated Resource Usage: + +END SCUBA Module Synthesis + diff --git a/display/fpga/ip/pll0/pll0.cst b/display/fpga/ip/pll0/pll0.cst new file mode 100644 index 0000000..0115c51 --- /dev/null +++ b/display/fpga/ip/pll0/pll0.cst @@ -0,0 +1,3 @@ +Date=04/24/2018 +Time=22:15:53 + diff --git a/display/fpga/ip/pll0/pll0.edn b/display/fpga/ip/pll0/pll0.edn new file mode 100644 index 0000000..b98af69 --- /dev/null +++ b/display/fpga/ip/pll0/pll0.edn @@ -0,0 +1,300 @@ +(edif pll0 + (edifVersion 2 0 0) + (edifLevel 0) + (keywordMap (keywordLevel 0)) + (status + (written + (timestamp 2018 4 24 22 15 53) + (program "SCUBA" (version "Diamond (64-bit) 3.10.0.111.2")))) + (comment "/usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n pll0 -lang vhdl -synth synplify -arch xo2c00 -type pll -fin 12 -fclkop 96 -fclkop_tol 0.0 -trimp 0 -phasep 0 -trimp_r -phase_cntl STATIC -fb_mode 1 -lock ") + (library ORCLIB + (edifLevel 0) + (technology + (numberDefinition)) + (cell VLO + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port Z + (direction OUTPUT))))) + (cell EHXPLLJ + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port CLKI + (direction INPUT)) + (port CLKFB + (direction INPUT)) + (port PHASESEL1 + (direction INPUT)) + (port PHASESEL0 + (direction INPUT)) + (port PHASEDIR + (direction INPUT)) + (port PHASESTEP + (direction INPUT)) + (port LOADREG + (direction INPUT)) + (port STDBY + (direction INPUT)) + (port PLLWAKESYNC + (direction INPUT)) + (port RST + (direction INPUT)) + (port RESETM + (direction INPUT)) + (port RESETC + (direction INPUT)) + (port RESETD + (direction INPUT)) + (port ENCLKOP + (direction INPUT)) + (port ENCLKOS + (direction INPUT)) + (port ENCLKOS2 + (direction INPUT)) + (port ENCLKOS3 + (direction INPUT)) + (port PLLCLK + (direction INPUT)) + (port PLLRST + (direction INPUT)) + (port PLLSTB + (direction INPUT)) + (port PLLWE + (direction INPUT)) + (port PLLADDR4 + (direction INPUT)) + (port PLLADDR3 + (direction INPUT)) + (port PLLADDR2 + (direction INPUT)) + (port PLLADDR1 + (direction INPUT)) + (port PLLADDR0 + (direction INPUT)) + (port PLLDATI7 + (direction INPUT)) + (port PLLDATI6 + (direction INPUT)) + (port PLLDATI5 + (direction INPUT)) + (port PLLDATI4 + (direction INPUT)) + (port PLLDATI3 + (direction INPUT)) + (port PLLDATI2 + (direction INPUT)) + (port PLLDATI1 + (direction INPUT)) + (port PLLDATI0 + (direction INPUT)) + (port CLKOP + (direction OUTPUT)) + (port CLKOS + (direction OUTPUT)) + (port CLKOS2 + (direction OUTPUT)) + (port CLKOS3 + (direction OUTPUT)) + (port LOCK + (direction OUTPUT)) + (port INTLOCK + (direction OUTPUT)) + (port REFCLK + (direction OUTPUT)) + (port CLKINTFB + (direction OUTPUT)) + (port DPHSRC + (direction OUTPUT)) + (port PLLACK + (direction OUTPUT)) + (port PLLDATO7 + (direction OUTPUT)) + (port PLLDATO6 + (direction OUTPUT)) + (port PLLDATO5 + (direction OUTPUT)) + (port PLLDATO4 + (direction OUTPUT)) + (port PLLDATO3 + (direction OUTPUT)) + (port PLLDATO2 + (direction OUTPUT)) + (port PLLDATO1 + (direction OUTPUT)) + (port PLLDATO0 + (direction OUTPUT))))) + (cell pll0 + (cellType GENERIC) + (view view1 + (viewType NETLIST) + (interface + (port CLKI + (direction INPUT)) + (port CLKOP + (direction OUTPUT)) + (port LOCK + (direction OUTPUT))) + (property NGD_DRC_MASK (integer 1)) + (contents + (instance scuba_vlo_inst + (viewRef view1 + (cellRef VLO))) + (instance PLLInst_0 + (viewRef view1 + (cellRef EHXPLLJ)) + (property DDRST_ENA + (string "DISABLED")) + (property DCRST_ENA + (string "DISABLED")) + (property MRST_ENA + (string "DISABLED")) + (property PLLRST_ENA + (string "DISABLED")) + (property INTFB_WAKE + (string "DISABLED")) + (property STDBY_ENABLE + (string "DISABLED")) + (property DPHASE_SOURCE + (string "DISABLED")) + (property PLL_USE_WB + (string "DISABLED")) + (property CLKOS3_FPHASE + (string "0")) + (property CLKOS3_CPHASE + (string "0")) + (property CLKOS2_FPHASE + (string "0")) + (property CLKOS2_CPHASE + (string "0")) + (property CLKOS_FPHASE + (string "0")) + (property CLKOS_CPHASE + (string "0")) + (property CLKOP_FPHASE + (string "0")) + (property CLKOP_CPHASE + (string "4")) + (property PLL_LOCK_MODE + (string "0")) + (property CLKOS_TRIM_DELAY + (string "0")) + (property CLKOS_TRIM_POL + (string "FALLING")) + (property CLKOP_TRIM_DELAY + (string "0")) + (property CLKOP_TRIM_POL + (string "RISING")) + (property FRACN_DIV + (string "0")) + (property FRACN_ENABLE + (string "DISABLED")) + (property OUTDIVIDER_MUXD2 + (string "DIVD")) + (property PREDIVIDER_MUXD1 + (string "0")) + (property VCO_BYPASS_D0 + (string "DISABLED")) + (property CLKOS3_ENABLE + (string "DISABLED")) + (property OUTDIVIDER_MUXC2 + (string "DIVC")) + (property PREDIVIDER_MUXC1 + (string "0")) + (property VCO_BYPASS_C0 + (string "DISABLED")) + (property CLKOS2_ENABLE + (string "DISABLED")) + (property OUTDIVIDER_MUXB2 + (string "DIVB")) + (property PREDIVIDER_MUXB1 + (string "0")) + (property VCO_BYPASS_B0 + (string "DISABLED")) + (property CLKOS_ENABLE + (string "DISABLED")) + (property FREQUENCY_PIN_CLKOP + (string "96.000000")) + (property OUTDIVIDER_MUXA2 + (string "DIVA")) + (property PREDIVIDER_MUXA1 + (string "0")) + (property VCO_BYPASS_A0 + (string "DISABLED")) + (property CLKOP_ENABLE + (string "ENABLED")) + (property FREQUENCY_PIN_CLKI + (string "12.000000")) + (property ICP_CURRENT + (string "7")) + (property LPF_RESISTOR + (string "8")) + (property CLKOS3_DIV + (string "1")) + (property CLKOS2_DIV + (string "1")) + (property CLKOS_DIV + (string "1")) + (property CLKOP_DIV + (string "5")) + (property CLKFB_DIV + (string "8")) + (property CLKI_DIV + (string "1")) + (property FEEDBK_PATH + (string "CLKOP"))) + (net scuba_vlo + (joined + (portRef Z (instanceRef scuba_vlo_inst)) + (portRef PLLADDR4 (instanceRef PLLInst_0)) + (portRef PLLADDR3 (instanceRef PLLInst_0)) + (portRef PLLADDR2 (instanceRef PLLInst_0)) + (portRef PLLADDR1 (instanceRef PLLInst_0)) + (portRef PLLADDR0 (instanceRef PLLInst_0)) + (portRef PLLDATI7 (instanceRef PLLInst_0)) + (portRef PLLDATI6 (instanceRef PLLInst_0)) + (portRef PLLDATI5 (instanceRef PLLInst_0)) + (portRef PLLDATI4 (instanceRef PLLInst_0)) + (portRef PLLDATI3 (instanceRef PLLInst_0)) + (portRef PLLDATI2 (instanceRef PLLInst_0)) + (portRef PLLDATI1 (instanceRef PLLInst_0)) + (portRef PLLDATI0 (instanceRef PLLInst_0)) + (portRef PLLWE (instanceRef PLLInst_0)) + (portRef PLLSTB (instanceRef PLLInst_0)) + (portRef PLLRST (instanceRef PLLInst_0)) + (portRef PLLCLK (instanceRef PLLInst_0)) + (portRef ENCLKOS3 (instanceRef PLLInst_0)) + (portRef ENCLKOS2 (instanceRef PLLInst_0)) + (portRef ENCLKOS (instanceRef PLLInst_0)) + (portRef ENCLKOP (instanceRef PLLInst_0)) + (portRef RESETD (instanceRef PLLInst_0)) + (portRef RESETC (instanceRef PLLInst_0)) + (portRef RESETM (instanceRef PLLInst_0)) + (portRef RST (instanceRef PLLInst_0)) + (portRef PLLWAKESYNC (instanceRef PLLInst_0)) + (portRef STDBY (instanceRef PLLInst_0)) + (portRef LOADREG (instanceRef PLLInst_0)) + (portRef PHASESTEP (instanceRef PLLInst_0)) + (portRef PHASEDIR (instanceRef PLLInst_0)) + (portRef PHASESEL1 (instanceRef PLLInst_0)) + (portRef PHASESEL0 (instanceRef PLLInst_0)))) + (net LOCK + (joined + (portRef LOCK) + (portRef LOCK (instanceRef PLLInst_0)))) + (net CLKOP + (joined + (portRef CLKOP) + (portRef CLKFB (instanceRef PLLInst_0)) + (portRef CLKOP (instanceRef PLLInst_0)))) + (net CLKI + (joined + (portRef CLKI) + (portRef CLKI (instanceRef PLLInst_0)))))))) + (design pll0 + (cellRef pll0 + (libraryRef ORCLIB))) +) diff --git a/display/fpga/ip/pll0/pll0.jhd b/display/fpga/ip/pll0/pll0.jhd new file mode 100644 index 0000000..7071916 --- /dev/null +++ b/display/fpga/ip/pll0/pll0.jhd @@ -0,0 +1,5 @@ +MODULE pll0 DEFIN pll0.vhd + SUBMODULE EHXPLLJ + INSTANCE PLLInst_0 + SUBMODULE VLO + INSTANCE scuba_vlo_inst diff --git a/display/fpga/ip/pll0/pll0.lpc b/display/fpga/ip/pll0/pll0.lpc new file mode 100644 index 0000000..77238f0 --- /dev/null +++ b/display/fpga/ip/pll0/pll0.lpc @@ -0,0 +1,87 @@ +[Device] +Family=machxo2 +PartType=LCMXO2-1200HC +PartName=LCMXO2-1200HC-5SG32C +SpeedGrade=5 +Package=QFN32 +OperatingCondition=COM +Status=S + +[IP] +VendorName=Lattice Semiconductor Corporation +CoreType=LPM +CoreStatus=Demo +CoreName=PLL +CoreRevision=5.8 +ModuleName=pll0 +SourceFormat=VHDL +ParameterFileVersion=1.0 +Date=04/24/2018 +Time=22:15:53 + +[Parameters] +Verilog=0 +VHDL=1 +EDIF=1 +Destination=Synplicity +Expression=None +Order=None +IO=0 +mode=Frequency +CLKI=12 +CLKI_DIV=1 +BW=1.146 +VCO=480.000 +fb_mode=CLKOP +CLKFB_DIV=8 +FRACN_ENABLE=0 +FRACN_DIV=0 +DynamicPhase=STATIC +ClkEnable=0 +Standby=0 +Enable_sel=0 +PLLRst=0 +PLLMRst=0 +ClkOS2Rst=0 +ClkOS3Rst=0 +LockSig=1 +LockStk=0 +WBProt=0 +OPBypass=0 +OPUseDiv=0 +CLKOP_DIV=5 +FREQ_PIN_CLKOP=96 +OP_Tol=0.0 +CLKOP_AFREQ=96.000000 +CLKOP_PHASEADJ=0 +CLKOP_TRIM_POL=Rising +CLKOP_TRIM_DELAY=0 +EnCLKOS=0 +OSBypass=0 +OSUseDiv=0 +CLKOS_DIV=1 +FREQ_PIN_CLKOS=100 +OS_Tol=0.0 +CLKOS_AFREQ= +CLKOS_PHASEADJ=0 +CLKOS_TRIM_POL=Rising +CLKOS_TRIM_DELAY=0 +EnCLKOS2=0 +OS2Bypass=0 +OS2UseDiv=0 +CLKOS2_DIV=1 +FREQ_PIN_CLKOS2=100 +OS2_Tol=0.0 +CLKOS2_AFREQ= +CLKOS2_PHASEADJ=0 +EnCLKOS3=0 +OS3Bypass=0 +OS3UseDiv=0 +CLKOS3_DIV=1 +FREQ_PIN_CLKOS3=100 +OS3_Tol=0.0 +CLKOS3_AFREQ= +CLKOS3_PHASEADJ=0 + +[Command] +cmd_line= -w -n pll0 -lang vhdl -synth synplify -arch xo2c00 -type pll -fin 12 -fclkop 96 -fclkop_tol 0.0 -trimp 0 -phasep 0 -trimp_r -phase_cntl STATIC -fb_mode 1 -lock diff --git a/display/fpga/ip/pll0/pll0.naf b/display/fpga/ip/pll0/pll0.naf new file mode 100644 index 0000000..719cc35 --- /dev/null +++ b/display/fpga/ip/pll0/pll0.naf @@ -0,0 +1,3 @@ +CLKI i +CLKOP o +LOCK o diff --git a/display/fpga/ip/pll0/pll0.sort b/display/fpga/ip/pll0/pll0.sort new file mode 100644 index 0000000..285de3a --- /dev/null +++ b/display/fpga/ip/pll0/pll0.sort @@ -0,0 +1 @@ +pll0.vhd diff --git a/display/fpga/ip/pll0/pll0.srp b/display/fpga/ip/pll0/pll0.srp new file mode 100644 index 0000000..1bd635a --- /dev/null +++ b/display/fpga/ip/pll0/pll0.srp @@ -0,0 +1,26 @@ +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Tue Apr 24 22:15:53 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n pll0 -lang vhdl -synth synplify -arch xo2c00 -type pll -fin 12 -fclkop 96 -fclkop_tol 0.0 -trimp 0 -phasep 0 -trimp_r -phase_cntl STATIC -fb_mode 1 -lock + Circuit name : pll0 + Module type : pll + Module Version : 5.7 + Ports : + Inputs : CLKI + Outputs : CLKOP, LOCK + I/O buffer : not inserted + EDIF output : pll0.edn + VHDL output : pll0.vhd + VHDL template : pll0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : pll0.srp + Element Usage : + EHXPLLJ : 1 + Estimated Resource Usage: diff --git a/display/fpga/ip/pll0/pll0.sym b/display/fpga/ip/pll0/pll0.sym new file mode 100644 index 0000000000000000000000000000000000000000..7a8a55fa4cace703607d442d39cf483f227a9e40 GIT binary patch literal 182 zcmZ1z&Hx0=K)j8C1;k_!U~FJeU?^i~1F~}%On{^VgBF8|3y{I$?Bngpzz_gbW58g? zpyKAiz`zO=^A7+@GBW#zh5%^+#sG#Wpj--2y^p`MH&6&JC&E&YlViZZP{+{0P{7~{ sl<8m)U~pxe#K6e#0c>sn!#ptC0Bpx9ARA=A0uVDWZ~scuba_vlo); + + PLLInst_0: EHXPLLJ + generic map (DDRST_ENA=> "DISABLED", DCRST_ENA=> "DISABLED", + MRST_ENA=> "DISABLED", PLLRST_ENA=> "DISABLED", INTFB_WAKE=> "DISABLED", + STDBY_ENABLE=> "DISABLED", DPHASE_SOURCE=> "DISABLED", + PLL_USE_WB=> "DISABLED", CLKOS3_FPHASE=> 0, CLKOS3_CPHASE=> 0, + CLKOS2_FPHASE=> 0, CLKOS2_CPHASE=> 0, CLKOS_FPHASE=> 0, + CLKOS_CPHASE=> 0, CLKOP_FPHASE=> 0, CLKOP_CPHASE=> 4, + PLL_LOCK_MODE=> 0, CLKOS_TRIM_DELAY=> 0, CLKOS_TRIM_POL=> "FALLING", + CLKOP_TRIM_DELAY=> 0, CLKOP_TRIM_POL=> "RISING", FRACN_DIV=> 0, + FRACN_ENABLE=> "DISABLED", OUTDIVIDER_MUXD2=> "DIVD", + PREDIVIDER_MUXD1=> 0, VCO_BYPASS_D0=> "DISABLED", CLKOS3_ENABLE=> "DISABLED", + OUTDIVIDER_MUXC2=> "DIVC", PREDIVIDER_MUXC1=> 0, VCO_BYPASS_C0=> "DISABLED", + CLKOS2_ENABLE=> "DISABLED", OUTDIVIDER_MUXB2=> "DIVB", + PREDIVIDER_MUXB1=> 0, VCO_BYPASS_B0=> "DISABLED", CLKOS_ENABLE=> "DISABLED", + OUTDIVIDER_MUXA2=> "DIVA", PREDIVIDER_MUXA1=> 0, VCO_BYPASS_A0=> "DISABLED", + CLKOP_ENABLE=> "ENABLED", CLKOS3_DIV=> 1, CLKOS2_DIV=> 1, + CLKOS_DIV=> 1, CLKOP_DIV=> 5, CLKFB_DIV=> 8, CLKI_DIV=> 1, + FEEDBK_PATH=> "CLKOP") + port map (CLKI=>CLKI, CLKFB=>CLKOP_t, PHASESEL1=>scuba_vlo, + PHASESEL0=>scuba_vlo, PHASEDIR=>scuba_vlo, + PHASESTEP=>scuba_vlo, LOADREG=>scuba_vlo, STDBY=>scuba_vlo, + PLLWAKESYNC=>scuba_vlo, RST=>scuba_vlo, RESETM=>scuba_vlo, + RESETC=>scuba_vlo, RESETD=>scuba_vlo, ENCLKOP=>scuba_vlo, + ENCLKOS=>scuba_vlo, ENCLKOS2=>scuba_vlo, ENCLKOS3=>scuba_vlo, + PLLCLK=>scuba_vlo, PLLRST=>scuba_vlo, PLLSTB=>scuba_vlo, + PLLWE=>scuba_vlo, PLLADDR4=>scuba_vlo, PLLADDR3=>scuba_vlo, + PLLADDR2=>scuba_vlo, PLLADDR1=>scuba_vlo, + PLLADDR0=>scuba_vlo, PLLDATI7=>scuba_vlo, + PLLDATI6=>scuba_vlo, PLLDATI5=>scuba_vlo, + PLLDATI4=>scuba_vlo, PLLDATI3=>scuba_vlo, + PLLDATI2=>scuba_vlo, PLLDATI1=>scuba_vlo, + PLLDATI0=>scuba_vlo, CLKOP=>CLKOP_t, CLKOS=>open, + CLKOS2=>open, CLKOS3=>open, LOCK=>LOCK, INTLOCK=>open, + REFCLK=>open, CLKINTFB=>open, DPHSRC=>open, PLLACK=>open, + PLLDATO7=>open, PLLDATO6=>open, PLLDATO5=>open, + PLLDATO4=>open, PLLDATO3=>open, PLLDATO2=>open, + PLLDATO1=>open, PLLDATO0=>open); + + CLKOP <= CLKOP_t; +end Structure; + +-- synopsys translate_off +library MACHXO2; +configuration Structure_CON of pll0 is + for Structure + for all:VLO use entity MACHXO2.VLO(V); end for; + for all:EHXPLLJ use entity MACHXO2.EHXPLLJ(V); end for; + end for; +end Structure_CON; + +-- synopsys translate_on diff --git a/display/fpga/ip/pll0/pll0_generate.log b/display/fpga/ip/pll0/pll0_generate.log new file mode 100644 index 0000000..d4abbbe --- /dev/null +++ b/display/fpga/ip/pll0/pll0_generate.log @@ -0,0 +1,44 @@ +Starting process: Module + +Starting process: + +SCUBA, Version Diamond (64-bit) 3.10.0.111.2 +Tue Apr 24 22:15:53 2018 + +Copyright (c) 1991-1994 by NeoCAD Inc. All rights reserved. +Copyright (c) 1995 AT&T Corp. All rights reserved. +Copyright (c) 1995-2001 Lucent Technologies Inc. All rights reserved. +Copyright (c) 2001 Agere Systems All rights reserved. +Copyright (c) 2002-2017 Lattice Semiconductor Corporation, All rights reserved. + +BEGIN SCUBA Module Synthesis + + Issued command : /usr/local/diamond/3.10_x64/ispfpga/bin/lin64/scuba -w -n pll0 -lang vhdl -synth synplify -arch xo2c00 -type pll -fin 12 -fclkop 96 -fclkop_tol 0.0 -trimp 0 -phasep 0 -trimp_r -phase_cntl STATIC -fb_mode 1 -lock + Circuit name : pll0 + Module type : pll + Module Version : 5.7 + Ports : + Inputs : CLKI + Outputs : CLKOP, LOCK + I/O buffer : not inserted + EDIF output : pll0.edn + VHDL output : pll0.vhd + VHDL template : pll0_tmpl.vhd + VHDL purpose : for synthesis and simulation + Bus notation : big endian + Report output : pll0.srp + Estimated Resource Usage: + +END SCUBA Module Synthesis + +File: pll0.lpc created. + + +End process: completed successfully. + + +Total Warnings: 0 + +Total Errors: 0 + + diff --git a/display/fpga/ip/pll0/pll0_tmpl.vhd b/display/fpga/ip/pll0/pll0_tmpl.vhd new file mode 100644 index 0000000..29f88a2 --- /dev/null +++ b/display/fpga/ip/pll0/pll0_tmpl.vhd @@ -0,0 +1,13 @@ +-- VHDL module instantiation generated by SCUBA Diamond (64-bit) 3.10.0.111.2 +-- Module Version: 5.7 +-- Tue Apr 24 22:15:53 2018 + +-- parameterized module component declaration +component pll0 + port (CLKI: in std_logic; CLKOP: out std_logic; + LOCK: out std_logic); +end component; + +-- parameterized module component instance +__ : pll0 + port map (CLKI=>__, CLKOP=>__, LOCK=>__); diff --git a/display/fpga/sim_ip/gram0.vhd b/display/fpga/sim_ip/gram0.vhd new file mode 100644 index 0000000..a43cddf --- /dev/null +++ b/display/fpga/sim_ip/gram0.vhd @@ -0,0 +1,45 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +library generics; +use generics.all; + +entity gram0 is + port( + DataInA : in std_logic_vector(8 downto 0); + DataInB : in std_logic_vector(8 downto 0); + AddressA : in std_logic_vector(12 downto 0); + AddressB : in std_logic_vector(12 downto 0); + ClockA : in std_logic; + ClockB : in std_logic; + ClockEnA : in std_logic; + ClockEnB : in std_logic; + WrA : in std_logic; + WrB : in std_logic; + ResetA : in std_logic; + ResetB : in std_logic; + QA : out std_logic_vector(8 downto 0); + QB : out std_logic_vector(8 downto 0)); +end gram0; + +architecture RTL of gram0 is + +begin + ram_inst : entity generics.ram + generic map( + WIDTH => 9, + DEPTH => 13 + ) + port map( + clk => ClockA, + rst => ResetA, + a_addr_in => AddressA, + a_data_in => DataInA, + a_data_out => QA, + a_we => WrA, + b_addr_in => AddressB, + b_data_out => QB + ); + +end architecture RTL; diff --git a/display/fpga/sim_ip/pll0.vhd b/display/fpga/sim_ip/pll0.vhd new file mode 100644 index 0000000..0347b33 --- /dev/null +++ b/display/fpga/sim_ip/pll0.vhd @@ -0,0 +1,24 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity pll0 is + port( + CLKI : in std_logic; + CLKOP : out std_logic; + LOCK : out std_logic); +end entity pll0; + +architecture RTL of pll0 is + +begin + LOCK <= '1'; + clock_driver : process + constant period : time := (1 sec / 96000000); + begin + CLKOP <= '0'; + wait for period / 2; + CLKOP <= '1'; + wait for period / 2; + end process clock_driver; +end architecture RTL; diff --git a/display/kernel-driver/.gitignore b/display/kernel-driver/.gitignore new file mode 100644 index 0000000..f7f5fc8 --- /dev/null +++ b/display/kernel-driver/.gitignore @@ -0,0 +1,6 @@ +*.o +*.ko +*.mod.c +modules.order +Module.symvers +*.pro.user diff --git a/display/kernel-driver/Makefile b/display/kernel-driver/Makefile new file mode 100644 index 0000000..b246984 --- /dev/null +++ b/display/kernel-driver/Makefile @@ -0,0 +1,14 @@ +obj-m := lmg6202ulyt.o +KDIR := ~/projects/arm-linux/current +PWD := $(shell pwd) +default: lmg6202ulyt.ko +lmg6202ulyt.ko: lmg6202ulyt.c + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules + +deploy: lmg6202ulyt.ko + scp $< markus@opi:/home/markus/lmg6202ulyt/deploy + +clean: + rm -f ./*.o ./*.ko ./*.mod.c modules.order Module.symvers + +.phony: deploy clean diff --git a/display/kernel-driver/lmg6202ulyt.c b/display/kernel-driver/lmg6202ulyt.c new file mode 100644 index 0000000..dfc5453 --- /dev/null +++ b/display/kernel-driver/lmg6202ulyt.c @@ -0,0 +1,364 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BPP 8 // 8 +#define PIX_THRESHOLD 0 + +#define LMGE_GPIO 100 +#define LMGE_OTHER 99 + +#define PALETTE_SIZE 256 + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Markus Koch"); +MODULE_DESCRIPTION("lmg6202ulyt display driver"); +MODULE_VERSION("0.1"); + +static char *testparam = "param"; +module_param(testparam, charp, S_IRUGO); +MODULE_PARM_DESC(testparam, "A test parameter"); + +static struct of_device_id lmg6202ulyt_dt_ids[] = { +{ .compatible = "hitachi,lmg6202ulyt", }, +{ /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, lmg6202ulyt_dt_ids); + +static const struct fb_videomode default_mode = { + NULL, 30, 480, 128, /* name, refresh, xres, yres */ + 39300, /* pixclk */ + 0, 0, 0, 0, /* margin l, r, t, b */ + 0, 0, /* hsync_len, vsync_len */ + 0, FB_VMODE_NONINTERLACED /* vmode, flag */ +}; + +struct lmg6202ulyt_priv { + struct spi_device *spi; + struct fb_info info; + + dma_addr_t fb_phys; + void __iomem *fb_virt; + u32 pseudo_palette[PALETTE_SIZE]; +}; + +static int lmg6202ulyt_init_var(struct lmg6202ulyt_priv *priv) +{ + struct fb_var_screeninfo *var = &priv->info.var; + + var->accel_flags = FB_ACCEL_NONE; + var->activate = FB_ACTIVATE_NOW; + var->xres_virtual = var->xres; + var->yres_virtual = var->yres; + + switch (var->bits_per_pixel) { + case 8: + var->transp.offset = 0; + var->transp.length = 0; + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + break; + + case 16: + var->transp.offset = 0; + var->transp.length = 0; + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + break; + + case 24: + var->transp.offset = 0; + var->transp.length = 0; + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + break; + + case 32: + var->transp.offset = 24; + var->transp.length = 8; + var->red.offset = 16; + var->red.length = 8; + var->green.offset = 8; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + break; + } + + return 0; +} + +static int lmg6202ulyt_init_fix(struct lmg6202ulyt_priv *priv) +{ + struct fb_var_screeninfo *var = &priv->info.var; + struct fb_fix_screeninfo *fix = &priv->info.fix; + + strcpy(fix->id, "LW-35 LCD"); + + fix->line_length = var->xres * var->bits_per_pixel/8; + fix->smem_len = fix->line_length * var->yres; + fix->type = FB_TYPE_PACKED_PIXELS; + + if (var->bits_per_pixel == 8 && !var->grayscale) + fix->visual = FB_VISUAL_PSEUDOCOLOR; + else + fix->visual = FB_VISUAL_TRUECOLOR; + + printk(KERN_INFO "lmg6202ulyt: Using %d bpp.\n", var->bits_per_pixel); + + return 0; +} + +void lfb_mkdirty(struct fb_info *info, int y, int height) +{ + //struct lmg6202ulyt_priv *priv = info->par; + struct fb_deferred_io *fbdefio = info->fbdefio; + + schedule_delayed_work(&info->deferred_work, fbdefio->delay); +} + +static int lfb_setcolreg(unsigned regno, unsigned red, unsigned green, + unsigned blue, unsigned transp, + struct fb_info *info) +{ + //struct lmg6202ulyt_priv *fbdev = (struct lmg6202ulyt_priv *)info->par; + u32 color; + + if (regno >= info->cmap.len) { + dev_err(info->device, "regno >= cmap.len\n"); + return 1; + } + + if (info->var.grayscale) { + /* grayscale = 0.30*R + 0.59*G + 0.11*B */ + red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; + } + + red >>= (16 - info->var.red.length); + green >>= (16 - info->var.green.length); + blue >>= (16 - info->var.blue.length); + transp >>= (16 - info->var.transp.length); + + if (info->var.bits_per_pixel == 8 && !info->var.grayscale) { + regno <<= 2; + color = (red << 16) | (green << 8) | blue; + //ocfb_writereg(fbdev, OCFB_PALETTE + regno, color); + } else { + ((u32 *)(info->pseudo_palette))[regno] = + (red << info->var.red.offset) | + (green << info->var.green.offset) | + (blue << info->var.blue.offset) | + (transp << info->var.transp.offset); + } + + return 0; +} + +void lfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) +{ + sys_fillrect(info, rect); + lfb_mkdirty(info, rect->dy, rect->height); +} + +void lfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) +{ + sys_copyarea(info, area); + lfb_mkdirty(info, area->dy, area->height); +} + +void lfb_imageblit(struct fb_info *info, const struct fb_image *image) +{ + sys_imageblit(info, image); + lfb_mkdirty(info, image->dy, image->height); +} + +static struct fb_ops ocfb_ops = { + .owner = THIS_MODULE, + .fb_setcolreg = lfb_setcolreg, + .fb_fillrect = lfb_fillrect, + .fb_copyarea = lfb_copyarea, + .fb_imageblit = lfb_imageblit, +}; + +#define BLOCKMUL 4 +#define BLOCKSIZE 180 * BLOCKMUL /* 180 = 3 rows */ +#define ROWSPERBLOCK (3 * BLOCKMUL) +#define BLOCKCNT (128 / ROWSPERBLOCK) + 1 +void lmg6202ulyt_deferred_io(struct fb_info *info, struct list_head *pagelist) +{ + struct lmg6202ulyt_priv *priv = info->par; + char buf[BLOCKSIZE + 3] = {0x00,0x00,0x00,0x00,0x00}; + int i; + int blk; + char __iomem *pixel; + int txsz; + + spi_write(priv->spi, buf, 5); + + pixel = info->screen_base; + for (blk = 0; blk < BLOCKCNT; ++blk) { + memset(buf, 0, sizeof(buf)); + buf[0] = 1; + + for (i = 0; i < BLOCKSIZE * 8; i++) { + if (*pixel > PIX_THRESHOLD) { + buf[(i / 8) + 1] |= (1 << (7 - (i % 8))); + } + if (pixel >= info->screen_base + info->screen_size - ((info->var.bits_per_pixel) / 8)) + break; + pixel+= (info->var.bits_per_pixel) / 8; + } + + if (blk == BLOCKCNT - 1) + txsz = sizeof(buf)/sizeof(buf[0]); + else + txsz = sizeof(buf)/sizeof(buf[0]); + + spi_write(priv->spi, buf, txsz); + } +} + +static int lmg6202ulyt_probe(struct spi_device *spi) +{ + struct lmg6202ulyt_priv *priv = NULL; + struct fb_deferred_io *fbdefio = NULL; + int fbsize; + int ret; + + printk(KERN_INFO "lmg6202ulyt: probe\n"); + + priv = devm_kzalloc(&spi->dev, + sizeof(struct lmg6202ulyt_priv), + GFP_KERNEL); + if (!priv) + return -ENOMEM; + spi_set_drvdata(spi, priv); + + priv->spi = spi; + + priv->info.fbops = &ocfb_ops; + priv->info.device = &spi->dev; + priv->info.par = priv; + + + printk(KERN_INFO "lmg6202ulyt: vmode\n"); + + if (!fb_find_mode(&priv->info.var, &priv->info, "", + NULL, 0, &default_mode, BPP)) { + dev_err(&spi->dev, "No valid video modes found\n"); + return -EINVAL; + } + + printk(KERN_INFO "lmg6202ulyt: Step 1\n"); + lmg6202ulyt_init_var(priv); + printk(KERN_INFO "lmg6202ulyt: Step 1.5\n"); + lmg6202ulyt_init_fix(priv); + + printk(KERN_INFO "lmg6202ulyt: Step 2\n"); + /* Allocate framebuffer memory */ + fbsize = priv->info.fix.smem_len; + dma_set_coherent_mask(&spi->dev, 0xFFFFFFFF); + priv->fb_virt = dma_alloc_coherent(&spi->dev, PAGE_ALIGN(fbsize), + &priv->fb_phys, GFP_KERNEL); + if (!priv->fb_virt) { + dev_err(&spi->dev, + "Frame buffer memory allocation failed\n"); + return -ENOMEM; + } + + printk(KERN_INFO, "lmg6202ulyt: fbdefio init\n"); + fbdefio = devm_kzalloc(&spi->dev, sizeof(struct fb_deferred_io), + GFP_KERNEL); + if (!fbdefio) { + dev_err(&spi->dev, + "FB defio memory allocation failed\n"); + return -ENOMEM; + } + + priv->info.fbdefio = fbdefio; + + fbdefio->delay = HZ/30; + fbdefio->deferred_io = lmg6202ulyt_deferred_io; + fb_deferred_io_init(&priv->info); + + printk(KERN_INFO "lmg6202ulyt: Step 3\n"); + priv->info.fix.smem_start = priv->fb_phys; + priv->info.screen_base = priv->fb_virt; + priv->info.screen_size = fbsize; + priv->info.pseudo_palette = priv->pseudo_palette; + + // HW specific init goes here + + /* Allocate color map */ + ret = fb_alloc_cmap(&priv->info.cmap, PALETTE_SIZE, 0); + if (ret) { + dev_err(&spi->dev, "Color map allocation failed\n"); + goto err_dma_free; + } + printk(KERN_INFO "lmg6202ulyt: Step 4\n"); + + /* Register framebuffer */ + ret = register_framebuffer(&priv->info); + if (ret) { + dev_err(&spi->dev, "Framebuffer registration failed\n"); + goto err_dealloc_cmap; + + } + printk(KERN_INFO "lmg6202ulyt: Loaded driver\n"); + + priv->info.var.grayscale = 1; + + lfb_mkdirty(&priv->info, 0, 0); + + return 0; + +err_dealloc_cmap: + fb_dealloc_cmap(&priv->info.cmap); + +err_dma_free: + // kzfree(priv->fb_mem); + dma_free_coherent(&spi->dev, PAGE_ALIGN(fbsize), priv->fb_virt, + priv->fb_phys); + + return ret; +} + +static int lmg6202ulyt_remove(struct spi_device *spi) +{ + struct lmg6202ulyt_priv *priv = spi_get_drvdata(spi); + + //unregister_framebuffer(&priv->info); + fb_dealloc_cmap(&priv->info.cmap); + + return 0; +} + +static struct spi_driver lmg6202ulyt_driver = { + .probe = lmg6202ulyt_probe, + .remove = lmg6202ulyt_remove, + .driver = { + .name = "lmg6202ulyt", + .owner = THIS_MODULE, + .of_match_table = lmg6202ulyt_dt_ids, + }, +}; +module_spi_driver(lmg6202ulyt_driver); + diff --git a/display/kernel-driver/lmg6202ulyt.pro b/display/kernel-driver/lmg6202ulyt.pro new file mode 100644 index 0000000..5a69472 --- /dev/null +++ b/display/kernel-driver/lmg6202ulyt.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +CONFIG += console +CONFIG -= app_bundle +CONFIG -= qt + +INCLUDEPATH += /home/markus/projects/arm-linux/current/include + +SOURCES += \ + lmg6202ulyt.c diff --git a/display/tools/.gitignore b/display/tools/.gitignore new file mode 100644 index 0000000..e7e22c3 --- /dev/null +++ b/display/tools/.gitignore @@ -0,0 +1,3 @@ +*.raw +*.mem +*.png diff --git a/display/tools/mkimage.py b/display/tools/mkimage.py new file mode 100755 index 0000000..dff5887 --- /dev/null +++ b/display/tools/mkimage.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# This script generates a memory initialization file for Lattice Diamond. + +import sys +from PIL import Image + +im = Image.open(sys.argv[1]); +pix = im.load() + +buf=[""] * 4 +block=0 +extra="" +pixcnt=0 + +foo=0 +for y in range(0, im.size[1]): + for x in range(0,im.size[0]): + foo=foo+1 + if block == 4: + buf[pixcnt] = buf[pixcnt] + str(pix[x,y]) + if pixcnt == 3: + for i in range(0,4): + print(buf[i]) + buf[i] = "" + block = 0 + pixcnt = 0 + else: + pixcnt = pixcnt + 1 + else: + buf[block] = buf[block] + str(pix[x,y]) + if (pixcnt == 7): + block = block + 1 + pixcnt = 0 + else: + pixcnt = pixcnt + 1 + + print("") + diff --git a/display/tools/mkraw.py b/display/tools/mkraw.py new file mode 100755 index 0000000..4252f42 --- /dev/null +++ b/display/tools/mkraw.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# This script generates a raw image file for use with the userspace display driver. + +import sys + +from PIL import Image +im = Image.open(sys.argv[1]); +pix = im.load() + +data=0 + +foo=0 +for y in range(0, im.size[1]): + for x in range(0,im.size[0]): + if (pix[x,y]): + data = data | (1 << (7 - (x % 8))) + if (((x+1) % 8) == 0): + sys.stdout.buffer.write(data.to_bytes(1, byteorder='big')) + data = 0 + diff --git a/display/userspace-driver/.gitignore b/display/userspace-driver/.gitignore new file mode 100644 index 0000000..f0c9b81 --- /dev/null +++ b/display/userspace-driver/.gitignore @@ -0,0 +1,2 @@ +*.o +main diff --git a/display/userspace-driver/loop.sh b/display/userspace-driver/loop.sh new file mode 100755 index 0000000..59a5389 --- /dev/null +++ b/display/userspace-driver/loop.sh @@ -0,0 +1,9 @@ +while [ 1 ]; do + #cat /dev/zero | tr '\0' \x55 | ./main + #./main < /dev/urandom + for file in ./*.raw; do + echo $file + ./main < $file + sleep 1 + done +done diff --git a/display/userspace-driver/main.c b/display/userspace-driver/main.c new file mode 100755 index 0000000..4513173 --- /dev/null +++ b/display/userspace-driver/main.c @@ -0,0 +1,176 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +static void pabort(const char *s) +{ + perror(s); + abort(); +} + +// LCM(bits) = 1440 to be even on a row boundary +// => Blocksize 180 bytes, 3 rows +#define MINBLK 180 +#define BLKMUL 4 +#define PLSIZE (MINBLK*BLKMUL + 3) +#define ROWSPERBLOCK (3 * BLKMUL) +#define BLKCNT (128 / ROWSPERBLOCK) + 1 + +int get_addr(int x, int y) +{ + int byteno; + byteno = (y * 480 + x) / 8; + if (x % 8 || byteno % 9) { + printf("ERROR: Invalid get_addr offset. Must be on 9 byte boundary.\n"); + return -1; + } + byteno -= byteno / 9; + printf("addr = %d\n", byteno); + return byteno; +} + +// Row must be multiple of 3 +static void transfer(int fd, uint8_t *memory) +{ + int ret; + uint8_t *tx; + //uint8_t *rx; + int i; + int txlen; + int addr; + int blk; + + txlen = PLSIZE; + + //tx = malloc(txlen * sizeof(uint8_t)); + //rx = malloc(PLSIZE * sizeof(uint8_t)); + tx = memory; + + + struct spi_ioc_transfer tr = { + .tx_buf = (unsigned long)tx, + .rx_buf = (unsigned long)NULL, + .len = txlen, + .delay_usecs = 10, + .speed_hz = 0, + .bits_per_word = 0, + }; + + for (blk = 0; blk < BLKCNT; ++blk) { + printf("tx = %d\n", tx - memory); + addr = get_addr(0, blk * ROWSPERBLOCK); + + tx[0] = 0x00; // Opcode: 0 + tx[1] = (addr >> 8) & 0xFF; // Base addr: + tx[2] = addr & 0xFF; + + tr.tx_buf = (unsigned long)tx; // TODO + tr.len = txlen; + + ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); + if (ret == 1) + pabort("can't send spi message"); + + tx += ROWSPERBLOCK * (480/8); + } + + /* + for (ret = 0; ret < PLSIZE; ret++) { + if (!(ret % 6)) + puts(""); + printf("%.2X ", rx[ret]); + } + puts(""); + */ + + //free(tx); + //free(rx); +} + +int main(int argc, char *argv[]) +{ + int fd; + int ret; + int i; + char temp; + + static uint8_t mode = 0; + static uint8_t bits = 8; + static uint32_t speed = 2000000; + + uint8_t memory[480*128/8 + 3]; + uint8_t *image = memory + 3; + + for (i = 0; i < 0; i++) { + printf("%3d: %d\n", i, get_addr(i, 0)); + if ((i+1)%8 == 0) { + printf("\n"); + } + } + + fd = open("/dev/spidev0.0", O_RDWR); + if (fd < 0) + pabort("can't open device"); + + /* + * spi mode + */ + ret = ioctl(fd, SPI_IOC_WR_MODE, &mode); + if (ret == -1) + pabort("can't set spi mode"); + + ret = ioctl(fd, SPI_IOC_RD_MODE, &mode); + if (ret == -1) + pabort("can't get spi mode"); + + /* + * bits per word + */ + ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits); + if (ret == -1) + pabort("can't set bits per word"); + + ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits); + if (ret == -1) + pabort("can't get bits per word"); + + /* + * max speed hz + */ + ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); + if (ret == -1) + pabort("can't set max speed hz"); + + ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed); + if (ret == -1) + pabort("can't get max speed hz"); + + //printf("spi mode: %d\n", mode); + //printf("bits per word: %d\n", bits); + //printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000); + + for (i = 3; i < ARRAY_SIZE(memory); i++) { + memory[i] = i*8/480; + fread(&temp, 1,1, stdin); + if (i < 720+3) + memory[i] = 0xAA; + else if (i < 720*2+3) + memory[i] = 0xFF; + else + memory[i] = 0x55; + memory[i] = temp; + //rx[i] = 0; + } + + transfer(fd, memory); + + close(fd); +}