mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2025-04-21 12:27:27 +03:00
Adding lm32 demo to SAKC project
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
DESIGN = plasma
|
||||
PINS = $(DESIGN).ucf
|
||||
DEVICE = xc3s500e-fg320-4
|
||||
DEVICE = xc3s500e-VQ100-4
|
||||
#DEVICE = xc3s250e-fg320-4
|
||||
BGFLAGS = -g TdoPin:PULLNONE -g DonePin:PULLUP \
|
||||
-g CRC:enable -g StartUpClk:CCLK
|
||||
SIM_CMD = /opt/cad/modeltech/bin/vsim
|
||||
SIM_COMP_SCRIPT = simulation/$(DESIGN)_TB.do
|
||||
SIMGEN_OPTIONS = -p $(FPGA_ARCH) -lang $(LANGUAGE)
|
||||
|
||||
SRC_HDL = plasma.vhd alu.vhd control.vhd mem_ctrl.vhd mult.vhd shifter.vhd bus_mux.vhd ddr_ctrl.vhd mlite_cpu.vhd pc_next.vhd cache.vhd eth_dma.vhd mlite_pack.vhd pipeline.vhd reg_bank.vhd uart.vhd ram_image.vhd
|
||||
SRC_HDL = plasma.vhd ram_image.vhd alu.vhd control.vhd mem_ctrl.vhd mult.vhd shifter.vhd bus_mux.vhd mlite_cpu.vhd pc_next.vhd mlite_pack.vhd pipeline.vhd reg_bank.vhd uart.vhd
|
||||
|
||||
all: bits
|
||||
|
||||
@@ -50,8 +51,8 @@ build/project.xst: build/project.src
|
||||
build/project.ngc: build/project.xst $(SRC)
|
||||
cd build && xst -ifn project.xst -ofn project.log
|
||||
|
||||
build/project.ngd: build/project.ngc #$(PINS)
|
||||
cd build && ngdbuild -p $(DEVICE) project.ngc #-uc ../$(PINS)
|
||||
build/project.ngd: build/project.ngc $(PINS)
|
||||
cd build && ngdbuild -p $(DEVICE) project.ngc -uc ../$(PINS)
|
||||
|
||||
build/project.ncd: build/project.ngd
|
||||
cd build && map -pr b -p $(DEVICE) project
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
setMode -bs
|
||||
setMode -bs
|
||||
setCable -port auto
|
||||
Identify
|
||||
identifyMPM
|
||||
assignFile -p 1 -file "/home/cain/Embedded/plasma/work/Example/logic/plasma_3e.bit"
|
||||
Program -p 1 -defaultVersion 0
|
||||
Program -p 1 -defaultVersion 0
|
||||
Program -p 1 -defaultVersion 0
|
||||
Program -p 1 -defaultVersion 0
|
||||
assignFile -p 1 -file "/home/cain/Embedded/plasma/work/Example/logic/plasma_3e.bit"
|
||||
Program -p 1 -defaultVersion 0
|
||||
Program -p 1 -defaultVersion 0
|
||||
Program -p 1 -defaultVersion 0
|
||||
saveProjectFile -file "/home/cain/Embedded/plasma/work/Example/logic/default.ipf"
|
||||
Binary file not shown.
Binary file not shown.
@@ -72,7 +72,7 @@ use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity mlite_cpu is
|
||||
generic(memory_type : string := "XILINX_16X"; --ALTERA_LPM, or DUAL_PORT_
|
||||
generic(memory_type : string := "XILINX_16X";
|
||||
mult_type : string := "DEFAULT"; --AREA_OPTIMIZED
|
||||
shifter_type : string := "DEFAULT"; --AREA_OPTIMIZED
|
||||
alu_type : string := "DEFAULT"; --AREA_OPTIMIZED
|
||||
|
||||
@@ -107,59 +107,6 @@ package mlite_pack is
|
||||
) return std_logic_vector;
|
||||
function bv_inc(a : in std_logic_vector
|
||||
) return std_logic_vector;
|
||||
|
||||
-- For Altera
|
||||
COMPONENT lpm_ram_dp
|
||||
generic (
|
||||
LPM_WIDTH : natural; -- MUST be greater than 0
|
||||
LPM_WIDTHAD : natural; -- MUST be greater than 0
|
||||
LPM_NUMWORDS : natural := 0;
|
||||
LPM_INDATA : string := "REGISTERED";
|
||||
LPM_OUTDATA : string := "REGISTERED";
|
||||
LPM_RDADDRESS_CONTROL : string := "REGISTERED";
|
||||
LPM_WRADDRESS_CONTROL : string := "REGISTERED";
|
||||
LPM_FILE : string := "UNUSED";
|
||||
LPM_TYPE : string := "LPM_RAM_DP";
|
||||
USE_EAB : string := "OFF";
|
||||
INTENDED_DEVICE_FAMILY : string := "UNUSED";
|
||||
RDEN_USED : string := "TRUE";
|
||||
LPM_HINT : string := "UNUSED");
|
||||
port (
|
||||
RDCLOCK : in std_logic := '0';
|
||||
RDCLKEN : in std_logic := '1';
|
||||
RDADDRESS : in std_logic_vector(LPM_WIDTHAD-1 downto 0);
|
||||
RDEN : in std_logic := '1';
|
||||
DATA : in std_logic_vector(LPM_WIDTH-1 downto 0);
|
||||
WRADDRESS : in std_logic_vector(LPM_WIDTHAD-1 downto 0);
|
||||
WREN : in std_logic;
|
||||
WRCLOCK : in std_logic := '0';
|
||||
WRCLKEN : in std_logic := '1';
|
||||
Q : out std_logic_vector(LPM_WIDTH-1 downto 0));
|
||||
END COMPONENT;
|
||||
|
||||
-- For Altera
|
||||
component LPM_RAM_DQ
|
||||
generic (
|
||||
LPM_WIDTH : natural; -- MUST be greater than 0
|
||||
LPM_WIDTHAD : natural; -- MUST be greater than 0
|
||||
LPM_NUMWORDS : natural := 0;
|
||||
LPM_INDATA : string := "REGISTERED";
|
||||
LPM_ADDRESS_CONTROL: string := "REGISTERED";
|
||||
LPM_OUTDATA : string := "REGISTERED";
|
||||
LPM_FILE : string := "UNUSED";
|
||||
LPM_TYPE : string := "LPM_RAM_DQ";
|
||||
USE_EAB : string := "OFF";
|
||||
INTENDED_DEVICE_FAMILY : string := "UNUSED";
|
||||
LPM_HINT : string := "UNUSED");
|
||||
port (
|
||||
DATA : in std_logic_vector(LPM_WIDTH-1 downto 0);
|
||||
ADDRESS : in std_logic_vector(LPM_WIDTHAD-1 downto 0);
|
||||
INCLOCK : in std_logic := '0';
|
||||
OUTCLOCK : in std_logic := '0';
|
||||
WE : in std_logic;
|
||||
Q : out std_logic_vector(LPM_WIDTH-1 downto 0));
|
||||
end component;
|
||||
|
||||
-- For Xilinx
|
||||
component RAM16X1D
|
||||
-- synthesis translate_off
|
||||
@@ -362,27 +309,24 @@ package mlite_pack is
|
||||
end component; --cache
|
||||
|
||||
component ram
|
||||
generic(memory_type : string := "DEFAULT");
|
||||
port(clk : in std_logic;
|
||||
enable : in std_logic;
|
||||
write_byte_enable : in std_logic_vector(3 downto 0);
|
||||
address : in std_logic_vector(31 downto 2);
|
||||
address : in std_logic_vector(10 downto 0);
|
||||
data_write : in std_logic_vector(31 downto 0);
|
||||
data_read : out std_logic_vector(31 downto 0));
|
||||
end component; --ram
|
||||
|
||||
component uart
|
||||
generic(log_file : string := "UNUSED");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
enable_read : in std_logic;
|
||||
enable_write : in std_logic;
|
||||
cs : in std_logic;
|
||||
nRdWr : in std_logic;
|
||||
data_in : in std_logic_vector(7 downto 0);
|
||||
data_out : out std_logic_vector(7 downto 0);
|
||||
uart_read : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
busy_write : out std_logic;
|
||||
data_avail : out std_logic);
|
||||
addr : in std_logic_vector(3 downto 0));
|
||||
end component; --uart
|
||||
|
||||
component eth_dma
|
||||
@@ -413,15 +357,17 @@ package mlite_pack is
|
||||
end component; --eth_dma
|
||||
|
||||
component plasma
|
||||
generic(memory_type : string := "XILINX_X16"; --"DUAL_PORT_" "ALTERA_LPM";
|
||||
log_file : string := "UNUSED");
|
||||
generic(memory_type : string := "XILINX_X16");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
uart_read : in std_logic;
|
||||
|
||||
data_read : in std_logic_vector(31 downto 0);
|
||||
mem_pause_in : in std_logic
|
||||
U_TxD : out std_logic;
|
||||
U_RxD : in std_logic;
|
||||
addr : in std_logic_vector(12 downto 0);
|
||||
sram_data : in std_logic_vector(7 downto 0);
|
||||
nwe : in std_logic;
|
||||
noe : in std_logic;
|
||||
ncs : in std_logic;
|
||||
led : out std_logic
|
||||
);
|
||||
end component; --plasma
|
||||
|
||||
|
||||
@@ -24,23 +24,26 @@
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use work.mlite_pack.all;
|
||||
library UNISIM;
|
||||
use UNISIM.vcomponents.all;
|
||||
|
||||
entity plasma is
|
||||
generic(memory_type : string := "XILINX_16X"; --"DUAL_PORT_" "ALTERA_LPM";
|
||||
log_file : string := "UNUSED");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
|
||||
uart_write : out std_logic;
|
||||
uart_read : in std_logic;
|
||||
|
||||
data_read : in std_logic_vector(31 downto 0);
|
||||
mem_pause_in : in std_logic
|
||||
generic(memory_type : string := "XILINX_16X");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
U_TxD : out std_logic;
|
||||
U_RxD : in std_logic;
|
||||
addr : in std_logic_vector(12 downto 0);
|
||||
sram_data : in std_logic_vector(7 downto 0);
|
||||
nwe : in std_logic;
|
||||
noe : in std_logic;
|
||||
ncs : in std_logic;
|
||||
led : out std_logic
|
||||
);
|
||||
end; --entity plasma
|
||||
|
||||
architecture logic of plasma is
|
||||
signal address_next : std_logic_vector(31 downto 2);
|
||||
signal address_next : std_logic_vector(31 downto 0);
|
||||
signal byte_we_next : std_logic_vector(3 downto 0);
|
||||
signal cpu_address : std_logic_vector(31 downto 0);
|
||||
signal cpu_byte_we : std_logic_vector(3 downto 0);
|
||||
@@ -49,26 +52,20 @@ architecture logic of plasma is
|
||||
signal cpu_pause : std_logic;
|
||||
|
||||
signal data_read_uart : std_logic_vector(7 downto 0);
|
||||
signal write_enable : std_logic;
|
||||
signal mem_busy : std_logic;
|
||||
|
||||
signal enable_misc : std_logic;
|
||||
signal enable_uart : std_logic;
|
||||
signal enable_uart_read : std_logic;
|
||||
signal enable_uart_write : std_logic;
|
||||
|
||||
signal cs_uart : std_logic;
|
||||
signal uart_write_busy : std_logic;
|
||||
signal uart_data_avail : std_logic;
|
||||
signal irq_mask_reg : std_logic_vector(7 downto 0);
|
||||
signal irq_status : std_logic_vector(7 downto 0);
|
||||
signal irq : std_logic;
|
||||
|
||||
signal ram_enable : std_logic;
|
||||
signal ram_byte_we : std_logic_vector(3 downto 0);
|
||||
signal cs_ram : std_logic;
|
||||
signal ram_address : std_logic_vector(31 downto 2);
|
||||
signal ram_data_w : std_logic_vector(31 downto 0);
|
||||
signal ram_data_r : std_logic_vector(31 downto 0);
|
||||
|
||||
signal nreset : std_logic;
|
||||
|
||||
begin --architecture
|
||||
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
-- PROCESSOR
|
||||
@@ -77,10 +74,10 @@ begin --architecture
|
||||
generic map (memory_type => memory_type)
|
||||
PORT MAP (
|
||||
clk => clk,
|
||||
reset_in => reset,
|
||||
reset_in => nreset,
|
||||
intr_in => irq,
|
||||
|
||||
address_next => address_next, --before rising_edge(clk)
|
||||
address_next => address_next(31 downto 2), --before rising_edge(clk)
|
||||
byte_we_next => byte_we_next,
|
||||
|
||||
address => cpu_address(31 downto 2), --after rising_edge(clk)
|
||||
@@ -89,76 +86,76 @@ begin --architecture
|
||||
data_r => cpu_data_r,
|
||||
mem_pause => cpu_pause);
|
||||
|
||||
u2_ram: ram
|
||||
port map (
|
||||
clk => clk,
|
||||
enable => cs_ram,
|
||||
write_byte_enable => byte_we_next,
|
||||
address => ram_address(12 downto 2),
|
||||
data_write => cpu_data_w,
|
||||
data_read => ram_data_r);
|
||||
|
||||
u3_uart: uart
|
||||
port map(
|
||||
clk => clk,
|
||||
reset => nreset,
|
||||
cs => cs_uart,
|
||||
nRdWr => cpu_byte_we(0),
|
||||
data_in => cpu_data_w(7 downto 0),
|
||||
data_out => data_read_uart,
|
||||
uart_read => U_RxD,
|
||||
uart_write => U_TxD,
|
||||
addr => cpu_address(7 downto 4));
|
||||
|
||||
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
-- ADDRESS DECODER
|
||||
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
write_enable <= '1' when cpu_byte_we /= "0000" else '0';
|
||||
mem_busy <= mem_pause_in;
|
||||
cpu_pause <= '0'; --(uart_write_busy and enable_uart and write_enable) or --UART busy
|
||||
-- (cpu_address(28) and mem_busy); --DDR or flash
|
||||
cpu_pause <= '0'; --(uart_write_busy and enable_uart and write_enable) or --UART busy
|
||||
ram_address <= ZERO(31 downto 13) & (address_next(12)) & address_next(11 downto 2);
|
||||
cpu_address(1 downto 0) <= "00";
|
||||
address_next(1 downto 0) <= "00";
|
||||
|
||||
enable_uart <= '1' when cpu_address(30 downto 28) = "010" and cpu_address(7 downto 4) = "0000" else '0';
|
||||
enable_uart_read <= enable_uart and not write_enable;
|
||||
enable_uart_write <= enable_uart and write_enable;
|
||||
cpu_address(1 downto 0) <= "00";
|
||||
ram_enable <= '1' when address_next(30 downto 28) = "000" else '0';
|
||||
ram_byte_we <= byte_we_next;
|
||||
ram_address(31 downto 13) <= ZERO(31 downto 13);
|
||||
ram_address(12 downto 2) <= (address_next(12)) & address_next(11 downto 2);
|
||||
ram_data_w <= cpu_data_w;
|
||||
nreset <= not(reset);
|
||||
|
||||
|
||||
misc_proc: process(clk, reset, cpu_address, enable_misc,
|
||||
ram_data_r, data_read, data_read_uart, cpu_pause,
|
||||
irq_mask_reg, irq_status, write_enable,
|
||||
cpu_data_w)
|
||||
led <= not(reset);
|
||||
|
||||
addr_dec: process (cpu_address(30 downto 4))
|
||||
begin
|
||||
if (cpu_address(30 downto 28) = "000") then
|
||||
cs_ram <= '1';
|
||||
cs_uart <= '0';
|
||||
elsif ( (cpu_address(30 downto 28) = "010") and ( (cpu_address(11 downto 8) = "0000") )) then
|
||||
cs_ram <= '0';
|
||||
cs_uart <= '1';
|
||||
else
|
||||
cs_ram <= '0';
|
||||
cs_uart <= '0';
|
||||
end if;
|
||||
end process;
|
||||
|
||||
misc_proc: process(clk, nreset, cpu_address,
|
||||
ram_data_r, data_read_uart, cpu_pause,
|
||||
irq_mask_reg, irq_status, cpu_data_w)
|
||||
begin
|
||||
case cpu_address(30 downto 28) is
|
||||
when "000" => --internal RAM
|
||||
cpu_data_r <= ram_data_r;
|
||||
when "001" => --external RAM
|
||||
cpu_data_r <= data_read; --DDR
|
||||
when "010" => --misc
|
||||
case cpu_address(6 downto 4) is
|
||||
when "000" => --uart
|
||||
cpu_data_r <= ZERO(31 downto 8) & data_read_uart;
|
||||
when "001" => --irq_mask
|
||||
cpu_data_r <= ZERO(31 downto 8) & irq_mask_reg;
|
||||
when "010" => --irq_status
|
||||
cpu_data_r <= ZERO(31 downto 8) & irq_status;
|
||||
when others =>
|
||||
when "010" => --uart
|
||||
cpu_data_r <= ZERO(31 downto 8) & data_read_uart;
|
||||
when others =>
|
||||
cpu_data_r <= ZERO;
|
||||
end case;
|
||||
when "011" => --flash
|
||||
cpu_data_r <= data_read;
|
||||
when others =>
|
||||
cpu_data_r <= ZERO;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
u2_ram: ram
|
||||
generic map (memory_type => memory_type)
|
||||
port map (
|
||||
clk => clk,
|
||||
enable => ram_enable,
|
||||
write_byte_enable => ram_byte_we,
|
||||
address => ram_address,
|
||||
data_write => ram_data_w,
|
||||
data_read => ram_data_r);
|
||||
|
||||
u3_uart: uart
|
||||
generic map (log_file => log_file)
|
||||
port map(
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
enable_read => enable_uart_read,
|
||||
enable_write => enable_uart_write,
|
||||
data_in => cpu_data_w(7 downto 0),
|
||||
data_out => data_read_uart,
|
||||
uart_read => uart_read,
|
||||
uart_write => uart_write,
|
||||
busy_write => uart_write_busy,
|
||||
data_avail => uart_data_avail);
|
||||
|
||||
|
||||
end; --architecture logic
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
#####################################################
|
||||
### SPARTAN-3E STARTER KIT BOARD CONSTRAINTS FILE
|
||||
#####################################################
|
||||
# ==== Analog-to-Digital Converter (ADC) ====
|
||||
# some connections shared with SPI Flash, DAC, ADC, and AMP
|
||||
#NET "AD_CONV" LOC = "P11" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== Programmable Gain Amplifier (AMP) ====
|
||||
# some connections shared with SPI Flash, DAC, ADC, and AMP
|
||||
#NET "AMP_CS" LOC = "N7" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "AMP_DOUT" LOC = "E18" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "AMP_SHDN" LOC = "P7" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== Pushbuttons (BTN) ====
|
||||
NET "BTN_EAST" LOC = "H13" | IOSTANDARD = LVTTL | PULLDOWN ;
|
||||
NET "BTN_NORTH" LOC = "V4" | IOSTANDARD = LVTTL | PULLDOWN ;
|
||||
NET "BTN_SOUTH" LOC = "K17" | IOSTANDARD = LVTTL | PULLDOWN ;
|
||||
NET "BTN_WEST" LOC = "D18" | IOSTANDARD = LVTTL | PULLDOWN ;
|
||||
# ==== Clock inputs (CLK) ====
|
||||
NET "CLK_50MHZ" LOC = "C9" | IOSTANDARD = LVCMOS33 ;
|
||||
# Define clock period for 50 MHz oscillator (40%/60% duty-cycle)
|
||||
NET "CLK_50MHZ" PERIOD = 20 ns HIGH 40 %;
|
||||
#NET "CLK_AUX" LOC = "B8" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "CLK_SMA" LOC = "A10" | IOSTANDARD = LVCMOS33 ;
|
||||
# ==== Digital-to-Analog Converter (DAC) ====
|
||||
# some connections shared with SPI Flash, DAC, ADC, and AMP
|
||||
#NET "DAC_CLR" LOC = "P8" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
#NET "DAC_CS" LOC = "N8" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
# ==== 1-Wire Secure EEPROM (DS)
|
||||
#NET "DS_WIRE" LOC = "U4" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
# ==== Ethernet PHY (E) ====
|
||||
#NET "E_COL" LOC = "U6" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "E_CRS" LOC = "U13" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_MDC" LOC = "P9" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_MDIO" LOC = "U5" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_RX_CLK" LOC = "V3" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_RX_DV" LOC = "V2" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_RXD<0>" LOC = "V8" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_RXD<1>" LOC = "T11" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_RXD<2>" LOC = "U11" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_RXD<3>" LOC = "V14" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "E_RXD<4>" LOC = "U14" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_TX_CLK" LOC = "T7" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "E_TX_EN" LOC = "P15" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_TXD<0>" LOC = "R11" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_TXD<1>" LOC = "T15" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_TXD<2>" LOC = "R5" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "E_TXD<3>" LOC = "T5" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
#NET "E_TXD<4>" LOC = "R6" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
# ==== FPGA Configuration Mode, INIT_B Pins (FPGA) ====
|
||||
#NET "FPGA_M0" LOC = "M10" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
#NET "FPGA_M1" LOC = "V11" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
#NET "FPGA_M2" LOC = "T10" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 8 ;
|
||||
#NET "FPGA_INIT_B" LOC = "T3" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 4 ;
|
||||
#NET "FPGA_RDWR_B" LOC = "U10" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 4 ;
|
||||
#NET "FPGA_HSWAP" LOC = "B3" | IOSTANDARD = LVCMOS33 ;
|
||||
# ==== FX2 Connector (FX2) ====
|
||||
#NET "FX2_CLKIN" LOC = "E10" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "FX2_CLKIO" LOC = "D9" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_CLKOUT" LOC = "D10" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
# These four connections are shared with the J1 6-pin accessory header
|
||||
#NET "FX2_IO<1>" LOC = "B4" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<2>" LOC = "A4" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<3>" LOC = "D5" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<4>" LOC = "C5" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
# These four connections are shared with the J2 6-pin accessory header
|
||||
#NET "FX2_IO<5>" LOC = "A6" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<6>" LOC = "B6" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<7>" LOC = "E7" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<8>" LOC = "F7" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
# These four connections are shared with the J4 6-pin accessory header
|
||||
#NET "FX2_IO<9>" LOC = "D7" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<10>" LOC = "C7" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<11>" LOC = "F8" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<12>" LOC = "E8" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
# The discrete LEDs are shared with the following 8 FX2 connections
|
||||
#NET "FX2_IO<13>" LOC = "F9" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<14>" LOC = "E9" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<15>" LOC = "D11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<16>" LOC = "C11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<17>" LOC = "F11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<18>" LOC = "E11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<19>" LOC = "E12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<20>" LOC = "F12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<21>" LOC = "A13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<22>" LOC = "B13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<23>" LOC = "A14" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<24>" LOC = "B14" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<25>" LOC = "C14" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<26>" LOC = "D14" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<27>" LOC = "A16" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<28>" LOC = "B16" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<29>" LOC = "E13" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<30>" LOC = "C4" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<31>" LOC = "B11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<32>" LOC = "A11" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<33>" LOC = "A8" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<34>" LOC = "G9" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IP<35>" LOC = "D12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IP<36>" LOC = "C12" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IP<37>" LOC = "A15" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IP<38>" LOC = "B15" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IO<39>" LOC = "C3" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
#NET "FX2_IP<40>" LOC = "C15" | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 8 ;
|
||||
# ==== 6-pin header J1 ====
|
||||
# These are shared connections with the FX2 connector
|
||||
#NET "J1<0>" LOC = "B4" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J1<1>" LOC = "A4" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J1<2>" LOC = "D5" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J1<3>" LOC = "C5" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== 6-pin header J2 ====
|
||||
# These are shared connections with the FX2 connector
|
||||
#NET "J2<0>" LOC = "A6" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J2<1>" LOC = "B6" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J2<2>" LOC = "E7" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J2<3>" LOC = "F7" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== 6-pin header J4 ====
|
||||
# These are shared connections with the FX2 connector
|
||||
#NET "J4<0>" LOC = "D7" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J4<1>" LOC = "C7" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J4<2>" LOC = "F8" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "J4<3>" LOC = "E8" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== Character LCD (LCD) ====
|
||||
#NET "LCD_E" LOC = "M18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "LCD_RS" LOC = "L18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "LCD_RW" LOC = "L17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
# LCD data connections are shared with StrataFlash connections SF_D<11:8>
|
||||
#NET "SF_D<8>" LOC = "R15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "SF_D<9>" LOC = "R16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "SF_D<10>" LOC = "P17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "SF_D<11>" LOC = "M15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
# ==== Discrete LEDs (LED) ====
|
||||
# These are shared connections with the FX2 connector
|
||||
NET "LED<0>" LOC = "F12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<1>" LOC = "E12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<2>" LOC = "E11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<3>" LOC = "F11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<4>" LOC = "C11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<5>" LOC = "D11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<6>" LOC = "E9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
NET "LED<7>" LOC = "F9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
|
||||
# ==== PS/2 Mouse/Keyboard Port (PS2) ====
|
||||
NET "PS2_CLK" LOC = "G14" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "PS2_DATA" LOC = "G13" | IOSTANDARD = LVCMOS33 ;
|
||||
# ==== Rotary Pushbutton Switch (ROT) ====
|
||||
NET "ROT_A" LOC = "K18" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
NET "ROT_B" LOC = "G18" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
NET "ROT_CENTER" LOC = "V16" | IOSTANDARD = LVTTL | PULLDOWN ;
|
||||
# ==== RS-232 Serial Ports (RS232) ====
|
||||
NET "RS232_DCE_RXD" LOC = "R7" | IOSTANDARD = LVTTL ;
|
||||
NET "RS232_DCE_TXD" LOC = "M14" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = SLOW ;
|
||||
#NET "RS232_DTE_RXD" LOC = "U8" | IOSTANDARD = LVTTL ;
|
||||
#NET "RS232_DTE_TXD" LOC = "M13" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = SLOW ;
|
||||
# ==== DDR SDRAM (SD) ==== (I/O Bank 3, VCCO=2.5V)
|
||||
NET "SD_A<0>" LOC = "T1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<1>" LOC = "R3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<2>" LOC = "R2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<3>" LOC = "P1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<4>" LOC = "F4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<5>" LOC = "H4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<6>" LOC = "H3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<7>" LOC = "H1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<8>" LOC = "H2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<9>" LOC = "N4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<10>" LOC = "T2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<11>" LOC = "N5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_A<12>" LOC = "P2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_BA<0>" LOC = "K5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_BA<1>" LOC = "K6" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_CAS" LOC = "C2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_CK_N" LOC = "J4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_CK_P" LOC = "J5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_CKE" LOC = "K3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_CS" LOC = "K4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<0>" LOC = "L2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<1>" LOC = "L1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<2>" LOC = "L3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<3>" LOC = "L4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<4>" LOC = "M3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<5>" LOC = "M4" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<6>" LOC = "M5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<7>" LOC = "M6" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<8>" LOC = "E2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<9>" LOC = "E1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<10>" LOC = "F1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<11>" LOC = "F2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<12>" LOC = "G6" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<13>" LOC = "G5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<14>" LOC = "H6" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_DQ<15>" LOC = "H5" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_LDM" LOC = "J2" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_LDQS" LOC = "L6" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_RAS" LOC = "C1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_UDM" LOC = "J1" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_UDQS" LOC = "G3" | IOSTANDARD = SSTL2_I ;
|
||||
NET "SD_WE" LOC = "D1" | IOSTANDARD = SSTL2_I ;
|
||||
# Path to allow connection to top DCM connection
|
||||
#NET "SD_CK_FB" LOC = "B9" | IOSTANDARD = LVCMOS33 ;
|
||||
# Prohibit VREF pins
|
||||
CONFIG PROHIBIT = D2;
|
||||
CONFIG PROHIBIT = G4;
|
||||
CONFIG PROHIBIT = J6;
|
||||
CONFIG PROHIBIT = L5;
|
||||
CONFIG PROHIBIT = R4;
|
||||
# ==== Intel StrataFlash Parallel NOR Flash (SF) ====
|
||||
NET "SF_A<0>" LOC = "H17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<1>" LOC = "J13" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<2>" LOC = "J12" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<3>" LOC = "J14" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<4>" LOC = "J15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<5>" LOC = "J16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<6>" LOC = "J17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<7>" LOC = "K14" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<8>" LOC = "K15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<9>" LOC = "K12" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<10>" LOC = "K13" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<11>" LOC = "L15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<12>" LOC = "L16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<13>" LOC = "T18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<14>" LOC = "R18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<15>" LOC = "T17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<16>" LOC = "U18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<17>" LOC = "T16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<18>" LOC = "U15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<19>" LOC = "V15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<20>" LOC = "T12" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<21>" LOC = "V13" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<22>" LOC = "V12" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<23>" LOC = "N11" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_A<24>" LOC = "A11" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_BYTE" LOC = "C17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_CE0" LOC = "D16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<1>" LOC = "P10" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<2>" LOC = "R10" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<3>" LOC = "V9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<4>" LOC = "U9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<5>" LOC = "R9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<6>" LOC = "M9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<7>" LOC = "N9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<8>" LOC = "R15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<9>" LOC = "R16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<10>" LOC = "P17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<11>" LOC = "M15" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<12>" LOC = "M16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<13>" LOC = "P6" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<14>" LOC = "R8" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_D<15>" LOC = "T8" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_OE" LOC = "C18" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "SF_STS" LOC = "B18" | IOSTANDARD = LVCMOS33 ;
|
||||
NET "SF_WE" LOC = "D17" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
# ==== STMicro SPI serial Flash (SPI) ====
|
||||
# some connections shared with SPI Flash, DAC, ADC, and AMP
|
||||
NET "SPI_MISO" LOC = "N10" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "SPI_MOSI" LOC = "T4" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "SPI_SCK" LOC = "U16" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "SPI_SS_B" LOC = "U3" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
#NET "SPI_ALT_CS_JP11" LOC = "R12" | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 6 ;
|
||||
# ==== Slide Switches (SW) ====
|
||||
NET "SW<0>" LOC = "L13" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
NET "SW<1>" LOC = "L14" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
NET "SW<2>" LOC = "H18" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
NET "SW<3>" LOC = "N17" | IOSTANDARD = LVTTL | PULLUP ;
|
||||
# ==== VGA Port (VGA) ====
|
||||
NET "VGA_BLUE" LOC = "G15" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
|
||||
NET "VGA_GREEN" LOC = "H15" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
|
||||
NET "VGA_HSYNC" LOC = "F15" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
|
||||
NET "VGA_RED" LOC = "H14" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
|
||||
NET "VGA_VSYNC" LOC = "F14" | IOSTANDARD = LVTTL | DRIVE = 8 | SLEW = FAST ;
|
||||
# ==== Xilinx CPLD (XC) ====
|
||||
#NET "XC_CMD<0>" LOC = "P18" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "XC_CMD<1>" LOC = "N18" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "XC_CPLD_EN" LOC = "B10" | IOSTANDARD = LVTTL ;
|
||||
#NET "XC_D<0>" LOC = "G16" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "XC_D<1>" LOC = "F18" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "XC_D<2>" LOC = "F17" | IOSTANDARD = LVTTL | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "XC_TRIG" LOC = "R17" | IOSTANDARD = LVCMOS33 ;
|
||||
#NET "XC_GCK0" LOC = "H16" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
#NET "GCLK10" LOC = "C9" | IOSTANDARD = LVCMOS33 | DRIVE = 4 | SLEW = SLOW ;
|
||||
NET "CLK_50MHZ" TNM_NET = "CLK_50MHZ";
|
||||
NET "clk_reg1" TNM_NET = "clk_reg1";
|
||||
TIMESPEC "TS_clk_reg1" = PERIOD "clk_reg1" 40 ns HIGH 50 %;
|
||||
@@ -1,277 +0,0 @@
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
--use work.mlite_pack.all;
|
||||
|
||||
entity plasma_3e is
|
||||
port(CLK_50MHZ : in std_logic;
|
||||
RS232_DCE_RXD : in std_logic;
|
||||
RS232_DCE_TXD : out std_logic;
|
||||
|
||||
SD_CK_P : out std_logic; --DDR SDRAM clock_positive
|
||||
SD_CK_N : out std_logic; --clock_negative
|
||||
SD_CKE : out std_logic; --clock_enable
|
||||
|
||||
SD_BA : out std_logic_vector(1 downto 0); --bank_address
|
||||
SD_A : out std_logic_vector(12 downto 0); --address(row or col)
|
||||
SD_CS : out std_logic; --chip_select
|
||||
SD_RAS : out std_logic; --row_address_strobe
|
||||
SD_CAS : out std_logic; --column_address_strobe
|
||||
SD_WE : out std_logic; --write_enable
|
||||
|
||||
SD_DQ : inout std_logic_vector(15 downto 0); --data
|
||||
SD_UDM : out std_logic; --upper_byte_enable
|
||||
SD_UDQS : inout std_logic; --upper_data_strobe
|
||||
SD_LDM : out std_logic; --low_byte_enable
|
||||
SD_LDQS : inout std_logic; --low_data_strobe
|
||||
|
||||
E_MDC : out std_logic; --Ethernet PHY
|
||||
E_MDIO : inout std_logic; --management data in/out
|
||||
E_RX_CLK : in std_logic; --receive clock
|
||||
E_RX_DV : in std_logic; --data valid
|
||||
E_RXD : in std_logic_vector(3 downto 0);
|
||||
E_TX_CLK : in std_logic; --transmit clock
|
||||
E_TX_EN : out std_logic; --data valid
|
||||
E_TXD : out std_logic_vector(3 downto 0);
|
||||
|
||||
SF_CE0 : out std_logic; --NOR flash
|
||||
SF_OE : out std_logic;
|
||||
SF_WE : out std_logic;
|
||||
SF_BYTE : out std_logic;
|
||||
SF_STS : in std_logic; --status
|
||||
SF_A : out std_logic_vector(24 downto 0);
|
||||
SF_D : inout std_logic_vector(15 downto 1);
|
||||
SPI_MISO : inout std_logic;
|
||||
|
||||
VGA_VSYNC : out std_logic; --VGA port
|
||||
VGA_HSYNC : out std_logic;
|
||||
VGA_RED : out std_logic;
|
||||
VGA_GREEN : out std_logic;
|
||||
VGA_BLUE : out std_logic;
|
||||
|
||||
PS2_CLK : in std_logic; --Keyboard
|
||||
PS2_DATA : in std_logic;
|
||||
|
||||
LED : out std_logic_vector(7 downto 0);
|
||||
ROT_CENTER : in std_logic;
|
||||
ROT_A : in std_logic;
|
||||
ROT_B : in std_logic;
|
||||
BTN_EAST : in std_logic;
|
||||
BTN_NORTH : in std_logic;
|
||||
BTN_SOUTH : in std_logic;
|
||||
BTN_WEST : in std_logic;
|
||||
SW : in std_logic_vector(3 downto 0));
|
||||
end; --entity plasma_if
|
||||
|
||||
|
||||
architecture logic of plasma_3e is
|
||||
|
||||
component plasma
|
||||
generic(memory_type : string := "XILINX_16X"; --"DUAL_PORT_" "ALTERA_LPM";
|
||||
log_file : string := "UNUSED";
|
||||
ethernet : std_logic := '0';
|
||||
use_cache : std_logic := '0');
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
uart_read : in std_logic;
|
||||
|
||||
address : out std_logic_vector(31 downto 2);
|
||||
byte_we : out std_logic_vector(3 downto 0);
|
||||
data_write : out std_logic_vector(31 downto 0);
|
||||
data_read : in std_logic_vector(31 downto 0);
|
||||
mem_pause_in : in std_logic;
|
||||
no_ddr_start : out std_logic;
|
||||
no_ddr_stop : out std_logic;
|
||||
|
||||
gpio0_out : out std_logic_vector(31 downto 0);
|
||||
gpioA_in : in std_logic_vector(31 downto 0));
|
||||
end component; --plasma
|
||||
|
||||
component ddr_ctrl
|
||||
port(clk : in std_logic;
|
||||
clk_2x : in std_logic;
|
||||
reset_in : in std_logic;
|
||||
|
||||
address : in std_logic_vector(25 downto 2);
|
||||
byte_we : in std_logic_vector(3 downto 0);
|
||||
data_w : in std_logic_vector(31 downto 0);
|
||||
data_r : out std_logic_vector(31 downto 0);
|
||||
active : in std_logic;
|
||||
no_start : in std_logic;
|
||||
no_stop : in std_logic;
|
||||
pause : out std_logic;
|
||||
|
||||
SD_CK_P : out std_logic; --clock_positive
|
||||
SD_CK_N : out std_logic; --clock_negative
|
||||
SD_CKE : out std_logic; --clock_enable
|
||||
|
||||
SD_BA : out std_logic_vector(1 downto 0); --bank_address
|
||||
SD_A : out std_logic_vector(12 downto 0); --address(row or col)
|
||||
SD_CS : out std_logic; --chip_select
|
||||
SD_RAS : out std_logic; --row_address_strobe
|
||||
SD_CAS : out std_logic; --column_address_strobe
|
||||
SD_WE : out std_logic; --write_enable
|
||||
|
||||
SD_DQ : inout std_logic_vector(15 downto 0); --data
|
||||
SD_UDM : out std_logic; --upper_byte_enable
|
||||
SD_UDQS : inout std_logic; --upper_data_strobe
|
||||
SD_LDM : out std_logic; --low_byte_enable
|
||||
SD_LDQS : inout std_logic); --low_data_strobe
|
||||
end component; --ddr
|
||||
|
||||
signal clk_reg : std_logic;
|
||||
signal address : std_logic_vector(31 downto 2);
|
||||
signal data_write : std_logic_vector(31 downto 0);
|
||||
signal data_read : std_logic_vector(31 downto 0);
|
||||
signal data_r_ddr : std_logic_vector(31 downto 0);
|
||||
signal byte_we : std_logic_vector(3 downto 0);
|
||||
signal write_enable : std_logic;
|
||||
signal pause_ddr : std_logic;
|
||||
signal pause : std_logic;
|
||||
signal no_ddr_start : std_logic;
|
||||
signal no_ddr_stop : std_logic;
|
||||
signal ddr_active : std_logic;
|
||||
signal flash_active : std_logic;
|
||||
signal flash_cnt : std_logic_vector(1 downto 0);
|
||||
signal flash_we : std_logic;
|
||||
signal reset : std_logic;
|
||||
signal gpio0_out : std_logic_vector(31 downto 0);
|
||||
signal gpio0_in : std_logic_vector(31 downto 0);
|
||||
|
||||
begin --architecture
|
||||
--Divide 50 MHz clock by two
|
||||
clk_div: process(reset, CLK_50MHZ, clk_reg)
|
||||
begin
|
||||
if reset = '1' then
|
||||
clk_reg <= '0';
|
||||
elsif rising_edge(CLK_50MHZ) then
|
||||
clk_reg <= not clk_reg;
|
||||
end if;
|
||||
end process; --clk_div
|
||||
|
||||
reset <= ROT_CENTER;
|
||||
E_TX_EN <= gpio0_out(28); --Ethernet
|
||||
E_TXD <= gpio0_out(27 downto 24);
|
||||
E_MDC <= gpio0_out(23);
|
||||
E_MDIO <= gpio0_out(21) when gpio0_out(22) = '1' else 'Z';
|
||||
VGA_VSYNC <= gpio0_out(20);
|
||||
VGA_HSYNC <= gpio0_out(19);
|
||||
VGA_RED <= gpio0_out(18);
|
||||
VGA_GREEN <= gpio0_out(17);
|
||||
VGA_BLUE <= gpio0_out(16);
|
||||
LED <= gpio0_out(7 downto 0);
|
||||
gpio0_in(31 downto 21) <= (others => '0');
|
||||
gpio0_in(20 downto 13) <= E_RX_CLK & E_RX_DV & E_RXD & E_TX_CLK & E_MDIO;
|
||||
gpio0_in(12 downto 10) <= SF_STS & PS2_CLK & PS2_DATA;
|
||||
gpio0_in(9 downto 0) <= ROT_A & ROT_B & BTN_EAST & BTN_NORTH &
|
||||
BTN_SOUTH & BTN_WEST & SW;
|
||||
ddr_active <= '1' when address(31 downto 28) = "0001" else '0';
|
||||
flash_active <= '1' when address(31 downto 28) = "0011" else '0';
|
||||
write_enable <= '1' when byte_we /= "0000" else '0';
|
||||
|
||||
u1_plama: plasma
|
||||
generic map (memory_type => "XILINX_16X",
|
||||
log_file => "UNUSED",
|
||||
ethernet => '1',
|
||||
use_cache => '1')
|
||||
--generic map (memory_type => "DUAL_PORT_",
|
||||
-- log_file => "output2.txt",
|
||||
-- ethernet => '1')
|
||||
PORT MAP (
|
||||
clk => clk_reg,
|
||||
reset => reset,
|
||||
uart_write => RS232_DCE_TXD,
|
||||
uart_read => RS232_DCE_RXD,
|
||||
|
||||
address => address,
|
||||
byte_we => byte_we,
|
||||
data_write => data_write,
|
||||
data_read => data_read,
|
||||
mem_pause_in => pause,
|
||||
no_ddr_start => no_ddr_start,
|
||||
no_ddr_stop => no_ddr_stop,
|
||||
|
||||
gpio0_out => gpio0_out,
|
||||
gpioA_in => gpio0_in);
|
||||
|
||||
u2_ddr: ddr_ctrl
|
||||
port map (
|
||||
clk => clk_reg,
|
||||
clk_2x => CLK_50MHZ,
|
||||
reset_in => reset,
|
||||
|
||||
address => address(25 downto 2),
|
||||
byte_we => byte_we,
|
||||
data_w => data_write,
|
||||
data_r => data_r_ddr,
|
||||
active => ddr_active,
|
||||
no_start => no_ddr_start,
|
||||
no_stop => no_ddr_stop,
|
||||
pause => pause_ddr,
|
||||
|
||||
SD_CK_P => SD_CK_P, --clock_positive
|
||||
SD_CK_N => SD_CK_N, --clock_negative
|
||||
SD_CKE => SD_CKE, --clock_enable
|
||||
|
||||
SD_BA => SD_BA, --bank_address
|
||||
SD_A => SD_A, --address(row or col)
|
||||
SD_CS => SD_CS, --chip_select
|
||||
SD_RAS => SD_RAS, --row_address_strobe
|
||||
SD_CAS => SD_CAS, --column_address_strobe
|
||||
SD_WE => SD_WE, --write_enable
|
||||
|
||||
SD_DQ => SD_DQ, --data
|
||||
SD_UDM => SD_UDM, --upper_byte_enable
|
||||
SD_UDQS => SD_UDQS, --upper_data_strobe
|
||||
SD_LDM => SD_LDM, --low_byte_enable
|
||||
SD_LDQS => SD_LDQS); --low_data_strobe
|
||||
|
||||
--Flash control (only lower 16-bit data lines connected)
|
||||
flash_ctrl: process(reset, clk_reg, flash_active, write_enable,
|
||||
flash_cnt, pause_ddr)
|
||||
begin
|
||||
if reset = '1' then
|
||||
flash_cnt <= "00";
|
||||
flash_we <= '1';
|
||||
elsif rising_edge(clk_reg) then
|
||||
if flash_active = '0' then
|
||||
flash_cnt <= "00";
|
||||
flash_we <= '1';
|
||||
else
|
||||
if write_enable = '1' and flash_cnt(1) = '0' then
|
||||
flash_we <= '0';
|
||||
else
|
||||
flash_we <= '1';
|
||||
end if;
|
||||
if flash_cnt /= "11" then
|
||||
flash_cnt <= flash_cnt + 1;
|
||||
end if;
|
||||
end if;
|
||||
end if; --rising_edge(clk_reg)
|
||||
if pause_ddr = '1' or (flash_active = '1' and flash_cnt /= "11") then
|
||||
pause <= '1';
|
||||
else
|
||||
pause <= '0';
|
||||
end if;
|
||||
end process; --flash_ctrl
|
||||
|
||||
SF_CE0 <= not flash_active;
|
||||
SF_OE <= write_enable or not flash_active;
|
||||
SF_WE <= flash_we;
|
||||
SF_BYTE <= '1'; --16-bit access
|
||||
SF_A <= address(25 downto 2) & '0' when flash_active = '1' else
|
||||
"0000000000000000000000000";
|
||||
SF_D <= data_write(15 downto 1) when
|
||||
flash_active = '1' and write_enable = '1'
|
||||
else "ZZZZZZZZZZZZZZZ";
|
||||
SPI_MISO <= data_write(0) when
|
||||
flash_active = '1' and write_enable = '1'
|
||||
else 'Z';
|
||||
data_read(31 downto 16) <= data_r_ddr(31 downto 16);
|
||||
data_read(15 downto 0) <= data_r_ddr(15 downto 0) when flash_active = '0'
|
||||
else SF_D & SPI_MISO;
|
||||
|
||||
end; --architecture logic
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
module plasma_TB_v;
|
||||
|
||||
reg clk;
|
||||
reg reset;
|
||||
|
||||
|
||||
plasma uut( .clk(clk), .reset(reset));
|
||||
|
||||
|
||||
parameter PERIOD = 20;
|
||||
parameter real DUTY_CYCLE = 0.5;
|
||||
parameter OFFSET = 0;
|
||||
parameter TSET = 3;
|
||||
parameter THLD = 3;
|
||||
parameter NWS = 3;
|
||||
parameter CAM_OFF = 4000;
|
||||
|
||||
reg [15:0] data_tx;
|
||||
|
||||
|
||||
event reset_trigger;
|
||||
event reset_done_trigger;
|
||||
|
||||
initial begin // Reset the system, Start the image capture process
|
||||
forever begin
|
||||
@ (reset_trigger);
|
||||
@ (negedge clk);
|
||||
reset = 1;
|
||||
@ (negedge clk);
|
||||
reset = 0;
|
||||
-> reset_done_trigger;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
initial begin // Initialize Inputs
|
||||
clk = 0;
|
||||
end
|
||||
|
||||
initial begin // Process for clk
|
||||
#OFFSET;
|
||||
forever
|
||||
begin
|
||||
clk = 1'b0;
|
||||
#(PERIOD-(PERIOD*DUTY_CYCLE)) clk = 1'b1;
|
||||
#(PERIOD*DUTY_CYCLE);
|
||||
end
|
||||
end
|
||||
|
||||
initial begin: TEST_CASE
|
||||
#10 -> reset_trigger;
|
||||
@ (reset_done_trigger);
|
||||
// Write data to SRAM
|
||||
end
|
||||
endmodule
|
||||
|
||||
@@ -20,45 +20,35 @@ end; --entity tbench
|
||||
architecture logic of tbench is
|
||||
constant memory_type : string :=
|
||||
"TRI_PORT_X";
|
||||
-- "DUAL_PORT_";
|
||||
-- "ALTERA_LPM";
|
||||
-- "XILINX_16X";
|
||||
|
||||
constant log_file : string :=
|
||||
-- "UNUSED";
|
||||
"output.txt";
|
||||
|
||||
signal clk : std_logic := '1';
|
||||
signal reset : std_logic := '1';
|
||||
signal interrupt : std_logic := '0';
|
||||
signal mem_write : std_logic;
|
||||
signal address : std_logic_vector(31 downto 2);
|
||||
signal data_write : std_logic_vector(31 downto 0);
|
||||
signal data_read : std_logic_vector(31 downto 0);
|
||||
signal pause1 : std_logic := '0';
|
||||
signal pause2 : std_logic := '0';
|
||||
signal pause : std_logic;
|
||||
signal byte_we : std_logic_vector(3 downto 0);
|
||||
signal uart_write : std_logic;
|
||||
signal gpioA_in : std_logic_vector(31 downto 0) := (others => '0');
|
||||
begin --architecture
|
||||
--Uncomment the line below to test interrupts
|
||||
--interrupt <= '1' after 20 us when interrupt = '0' else '0' after 445 ns;
|
||||
signal reset : std_logic := '0';
|
||||
signal addr : std_logic_vector(12 downto 0);
|
||||
signal sram_data : std_logic_vector(7 downto 0);
|
||||
signal nwe : std_logic;
|
||||
signal noe : std_logic;
|
||||
signal ncs : std_logic;
|
||||
signal led : std_logic;
|
||||
|
||||
signal TxD : std_logic;
|
||||
begin --architecture
|
||||
clk <= not clk after 50 ns;
|
||||
reset <= '0' after 500 ns;
|
||||
pause <= '0';
|
||||
reset <= '1' after 500 ns;
|
||||
|
||||
|
||||
u1_plasma: plasma
|
||||
generic map (memory_type => memory_type,
|
||||
log_file => log_file)
|
||||
generic map (memory_type => memory_type)
|
||||
PORT MAP (
|
||||
clk => clk,
|
||||
reset => reset,
|
||||
uart_read => uart_write,
|
||||
uart_write => uart_write,
|
||||
data_read => data_read,
|
||||
mem_pause_in => pause
|
||||
U_RxD => TxD,
|
||||
U_TxD => TxD,
|
||||
addr => addr,
|
||||
sram_data => sram_data,
|
||||
nwe => nwe,
|
||||
noe => noe,
|
||||
ncs => ncs,
|
||||
led => led
|
||||
);
|
||||
|
||||
end; --architecture logic
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
NET "clk_in" TNM_NET = "clk_in";
|
||||
TIMESPEC "TS_clk_in" = PERIOD "clk_in" 20 ns HIGH 50 %;
|
||||
#NET "clk_reg1" TNM_NET = "clk_reg1";
|
||||
#TIMESPEC "TS_clk_reg1" = PERIOD "clk_reg1" 40 ns HIGH 50 %;
|
||||
NET "clk_reg1" TNM_NET = "clk_reg1";
|
||||
TIMESPEC "TS_clk_reg1" = PERIOD "clk_reg1" 39.9 ns HIGH 50 %;
|
||||
#PACE: Start of Constraints generated by PACE
|
||||
#PACE: Start of PACE I/O Pin Assignments
|
||||
NET "clk_in" LOC = "T9";
|
||||
NET "gpio0_out<0>" LOC = "K12";
|
||||
NET "gpio0_out<10>" LOC = "N15";
|
||||
NET "gpio0_out<11>" LOC = "P15";
|
||||
NET "gpio0_out<12>" LOC = "R16";
|
||||
NET "gpio0_out<13>" LOC = "F13";
|
||||
NET "gpio0_out<14>" LOC = "N16";
|
||||
NET "gpio0_out<15>" LOC = "P16";
|
||||
NET "gpio0_out<16>" LOC = "E13";
|
||||
NET "gpio0_out<17>" LOC = "F14";
|
||||
NET "gpio0_out<18>" LOC = "G14";
|
||||
NET "gpio0_out<19>" LOC = "D14";
|
||||
NET "gpio0_out<1>" LOC = "P14";
|
||||
NET "gpio0_out<24>" LOC = "R12";
|
||||
NET "gpio0_out<25>" LOC = "T12";
|
||||
NET "gpio0_out<26>" LOC = "R11";
|
||||
NET "gpio0_out<27>" LOC = "R9";
|
||||
NET "gpio0_out<28>" LOC = "T10";
|
||||
NET "gpio0_out<2>" LOC = "L12";
|
||||
NET "gpio0_out<3>" LOC = "N14";
|
||||
NET "gpio0_out<4>" LOC = "P13";
|
||||
NET "gpio0_out<5>" LOC = "N12";
|
||||
NET "gpio0_out<6>" LOC = "P12";
|
||||
NET "gpio0_out<7>" LOC = "P11";
|
||||
NET "gpio0_out<8>" LOC = "E14";
|
||||
NET "gpio0_out<9>" LOC = "G13";
|
||||
NET "gpioA_in<0>" LOC = "F12";
|
||||
NET "gpioA_in<10>" LOC = "L13";
|
||||
NET "gpioA_in<1>" LOC = "G12";
|
||||
NET "gpioA_in<2>" LOC = "H14";
|
||||
NET "gpioA_in<30>" LOC = "M15";
|
||||
NET "gpioA_in<31>" LOC = "M16";
|
||||
NET "gpioA_in<3>" LOC = "H13";
|
||||
NET "gpioA_in<4>" LOC = "J14";
|
||||
NET "gpioA_in<5>" LOC = "J13";
|
||||
NET "gpioA_in<6>" LOC = "K14";
|
||||
NET "gpioA_in<7>" LOC = "K13";
|
||||
NET "gpioA_in<8>" LOC = "M13";
|
||||
NET "gpioA_in<9>" LOC = "M14";
|
||||
NET "ram_address<10>" LOC = "E3";
|
||||
NET "ram_address<11>" LOC = "E4";
|
||||
NET "ram_address<12>" LOC = "G5";
|
||||
NET "ram_address<13>" LOC = "H3";
|
||||
NET "ram_address<14>" LOC = "H4";
|
||||
NET "ram_address<15>" LOC = "J4";
|
||||
NET "ram_address<16>" LOC = "J3";
|
||||
NET "ram_address<17>" LOC = "K3";
|
||||
NET "ram_address<18>" LOC = "K5";
|
||||
NET "ram_address<19>" LOC = "L3";
|
||||
NET "ram_address<2>" LOC = "L5";
|
||||
NET "ram_address<3>" LOC = "N3";
|
||||
NET "ram_address<4>" LOC = "M4";
|
||||
NET "ram_address<5>" LOC = "M3";
|
||||
NET "ram_address<6>" LOC = "L4";
|
||||
NET "ram_address<7>" LOC = "G4";
|
||||
NET "ram_address<8>" LOC = "F3";
|
||||
NET "ram_address<9>" LOC = "F4";
|
||||
NET "ram_ce1_n" LOC = "P7";
|
||||
NET "ram_ce2_n" LOC = "N5";
|
||||
NET "ram_data<0>" LOC = "P2";
|
||||
NET "ram_data<10>" LOC = "G1";
|
||||
NET "ram_data<11>" LOC = "F5";
|
||||
NET "ram_data<12>" LOC = "C3";
|
||||
NET "ram_data<13>" LOC = "K2";
|
||||
NET "ram_data<14>" LOC = "M1";
|
||||
NET "ram_data<15>" LOC = "N1";
|
||||
NET "ram_data<16>" LOC = "N7";
|
||||
NET "ram_data<17>" LOC = "T8";
|
||||
NET "ram_data<18>" LOC = "R6";
|
||||
NET "ram_data<19>" LOC = "T5";
|
||||
NET "ram_data<1>" LOC = "N2";
|
||||
NET "ram_data<20>" LOC = "R5";
|
||||
NET "ram_data<21>" LOC = "C2";
|
||||
NET "ram_data<22>" LOC = "C1";
|
||||
NET "ram_data<23>" LOC = "B1";
|
||||
NET "ram_data<24>" LOC = "D3";
|
||||
NET "ram_data<25>" LOC = "P8";
|
||||
NET "ram_data<26>" LOC = "F2";
|
||||
NET "ram_data<27>" LOC = "H1";
|
||||
NET "ram_data<28>" LOC = "J2";
|
||||
NET "ram_data<29>" LOC = "L2";
|
||||
NET "ram_data<2>" LOC = "M2";
|
||||
NET "ram_data<30>" LOC = "P1";
|
||||
NET "ram_data<31>" LOC = "R1";
|
||||
NET "ram_data<3>" LOC = "K1";
|
||||
NET "ram_data<4>" LOC = "J1";
|
||||
NET "ram_data<5>" LOC = "G2";
|
||||
NET "ram_data<6>" LOC = "E1";
|
||||
NET "ram_data<7>" LOC = "D1";
|
||||
NET "ram_data<8>" LOC = "D2";
|
||||
NET "ram_data<9>" LOC = "E2";
|
||||
NET "ram_lb1_n" LOC = "P6";
|
||||
NET "ram_lb2_n" LOC = "P5";
|
||||
NET "ram_oe_n" LOC = "K4";
|
||||
NET "ram_ub1_n" LOC = "T4";
|
||||
NET "ram_ub2_n" LOC = "R4";
|
||||
NET "ram_we_n" LOC = "G3";
|
||||
NET "reset" LOC = "L14";
|
||||
NET "uart_read" LOC = "T13";
|
||||
NET "uart_write" LOC = "R13";
|
||||
#PACE: Start of PACE Area Constraints
|
||||
#PACE: Start of PACE Prohibit Constraints
|
||||
#PACE: End of Constraints generated by PACE
|
||||
@@ -1,152 +0,0 @@
|
||||
---------------------------------------------------------------------
|
||||
-- TITLE: Plamsa Interface (clock divider and interface to FPGA board)
|
||||
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
|
||||
-- DATE CREATED: 6/6/02
|
||||
-- FILENAME: plasma_if.vhd
|
||||
-- PROJECT: Plasma CPU core
|
||||
-- COPYRIGHT: Software placed into the public domain by the author.
|
||||
-- Software 'as is' without warranty. Author liable for nothing.
|
||||
-- DESCRIPTION:
|
||||
-- This entity divides the clock by two and interfaces to the
|
||||
-- Altera EP20K200EFC484-2X FPGA board.
|
||||
-- Xilinx Spartan-3 XC3S200FT256-4 FPGA.
|
||||
---------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
--use work.mlite_pack.all;
|
||||
|
||||
entity plasma_if is
|
||||
port(clk_in : in std_logic;
|
||||
reset : in std_logic;
|
||||
uart_read : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
|
||||
ram_address : out std_logic_vector(31 downto 2);
|
||||
ram_data : inout std_logic_vector(31 downto 0);
|
||||
ram_ce1_n : out std_logic;
|
||||
ram_ub1_n : out std_logic;
|
||||
ram_lb1_n : out std_logic;
|
||||
ram_ce2_n : out std_logic;
|
||||
ram_ub2_n : out std_logic;
|
||||
ram_lb2_n : out std_logic;
|
||||
ram_we_n : out std_logic;
|
||||
ram_oe_n : out std_logic;
|
||||
|
||||
gpio0_out : out std_logic_vector(31 downto 0);
|
||||
gpioA_in : in std_logic_vector(31 downto 0));
|
||||
end; --entity plasma_if
|
||||
|
||||
|
||||
architecture logic of plasma_if is
|
||||
|
||||
component plasma
|
||||
generic(memory_type : string := "XILINX_16X"; --"DUAL_PORT_" "ALTERA_LPM";
|
||||
log_file : string := "UNUSED");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
uart_read : in std_logic;
|
||||
|
||||
address : out std_logic_vector(31 downto 2);
|
||||
byte_we : out std_logic_vector(3 downto 0);
|
||||
data_write : out std_logic_vector(31 downto 0);
|
||||
data_read : in std_logic_vector(31 downto 0);
|
||||
mem_pause_in : in std_logic;
|
||||
|
||||
gpio0_out : out std_logic_vector(31 downto 0);
|
||||
gpioA_in : in std_logic_vector(31 downto 0));
|
||||
end component; --plasma
|
||||
|
||||
signal clk_reg : std_logic;
|
||||
signal we_n_next : std_logic;
|
||||
signal we_n_reg : std_logic;
|
||||
signal mem_address : std_logic_vector(31 downto 2);
|
||||
signal data_write : std_logic_vector(31 downto 0);
|
||||
signal data_reg : std_logic_vector(31 downto 0);
|
||||
signal byte_we : std_logic_vector(3 downto 0);
|
||||
signal mem_pause_in : std_logic;
|
||||
|
||||
begin --architecture
|
||||
--Divide 50 MHz clock by two
|
||||
clk_div: process(reset, clk_in, clk_reg, we_n_next)
|
||||
begin
|
||||
if reset = '1' then
|
||||
clk_reg <= '0';
|
||||
elsif rising_edge(clk_in) then
|
||||
clk_reg <= not clk_reg;
|
||||
end if;
|
||||
|
||||
if reset = '1' then
|
||||
we_n_reg <= '1';
|
||||
data_reg <= (others => '0');
|
||||
elsif falling_edge(clk_in) then
|
||||
we_n_reg <= we_n_next or not clk_reg;
|
||||
data_reg <= ram_data;
|
||||
end if;
|
||||
end process; --clk_div
|
||||
|
||||
mem_pause_in <= '0';
|
||||
ram_address <= mem_address(31 downto 2);
|
||||
ram_we_n <= we_n_reg;
|
||||
|
||||
--For Xilinx Spartan-3 Starter Kit
|
||||
ram_control:
|
||||
process(clk_reg, mem_address, byte_we, data_write)
|
||||
begin
|
||||
if mem_address(30 downto 28) = "001" then --RAM
|
||||
ram_ce1_n <= '0';
|
||||
ram_ce2_n <= '0';
|
||||
if byte_we = "0000" then --read
|
||||
ram_data <= (others => 'Z');
|
||||
ram_ub1_n <= '0';
|
||||
ram_lb1_n <= '0';
|
||||
ram_ub2_n <= '0';
|
||||
ram_lb2_n <= '0';
|
||||
we_n_next <= '1';
|
||||
ram_oe_n <= '0';
|
||||
else --write
|
||||
if clk_reg = '1' then
|
||||
ram_data <= (others => 'Z');
|
||||
else
|
||||
ram_data <= data_write;
|
||||
end if;
|
||||
ram_ub1_n <= not byte_we(3);
|
||||
ram_lb1_n <= not byte_we(2);
|
||||
ram_ub2_n <= not byte_we(1);
|
||||
ram_lb2_n <= not byte_we(0);
|
||||
we_n_next <= '0';
|
||||
ram_oe_n <= '1';
|
||||
end if;
|
||||
else
|
||||
ram_data <= (others => 'Z');
|
||||
ram_ce1_n <= '1';
|
||||
ram_ub1_n <= '1';
|
||||
ram_lb1_n <= '1';
|
||||
ram_ce2_n <= '1';
|
||||
ram_ub2_n <= '1';
|
||||
ram_lb2_n <= '1';
|
||||
we_n_next <= '1';
|
||||
ram_oe_n <= '1';
|
||||
end if;
|
||||
end process; --ram_control
|
||||
|
||||
u1_plama: plasma
|
||||
generic map (memory_type => "XILINX_16X",
|
||||
log_file => "UNUSED")
|
||||
PORT MAP (
|
||||
clk => clk_reg,
|
||||
reset => reset,
|
||||
uart_write => uart_write,
|
||||
uart_read => uart_read,
|
||||
|
||||
address => mem_address,
|
||||
byte_we => byte_we,
|
||||
data_write => data_write,
|
||||
data_read => data_reg,
|
||||
mem_pause_in => mem_pause_in,
|
||||
|
||||
gpio0_out => gpio0_out,
|
||||
gpioA_in => gpioA_in);
|
||||
|
||||
end; --architecture logic
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
---------------------------------------------------------------------
|
||||
-- TITLE: Random Access Memory
|
||||
-- AUTHOR: Steve Rhoads (rhoadss@yahoo.com)
|
||||
-- DATE CREATED: 4/21/01
|
||||
-- FILENAME: ram.vhd
|
||||
-- PROJECT: Plasma CPU core
|
||||
-- COPYRIGHT: Software placed into the public domain by the author.
|
||||
-- Software 'as is' without warranty. Author liable for nothing.
|
||||
-- DESCRIPTION:
|
||||
-- Implements the RAM, reads the executable from either "code.txt",
|
||||
-- or for Altera "code[0-3].hex".
|
||||
-- Modified from "The Designer's Guide to VHDL" by Peter J. Ashenden
|
||||
---------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_misc.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
use ieee.std_logic_textio.all;
|
||||
use std.textio.all;
|
||||
use work.mlite_pack.all;
|
||||
|
||||
entity ram is
|
||||
generic(memory_type : string := "DEFAULT");
|
||||
port(clk : in std_logic;
|
||||
enable : in std_logic;
|
||||
write_byte_enable : in std_logic_vector(3 downto 0);
|
||||
address : in std_logic_vector(31 downto 2);
|
||||
data_write : in std_logic_vector(31 downto 0);
|
||||
data_read : out std_logic_vector(31 downto 0));
|
||||
end; --entity ram
|
||||
|
||||
architecture logic of ram is
|
||||
constant ADDRESS_WIDTH : natural := 13;
|
||||
begin
|
||||
|
||||
generic_ram:
|
||||
if memory_type /= "ALTERA_LPM" generate
|
||||
begin
|
||||
--Simulate a synchronous RAM
|
||||
ram_proc: process(clk, enable, write_byte_enable,
|
||||
address, data_write) --mem_write, mem_sel
|
||||
variable mem_size : natural := 2 ** ADDRESS_WIDTH;
|
||||
variable data : std_logic_vector(31 downto 0);
|
||||
subtype word is std_logic_vector(data_write'length-1 downto 0);
|
||||
type storage_array is
|
||||
array(natural range 0 to mem_size/4 - 1) of word;
|
||||
variable storage : storage_array;
|
||||
variable index : natural := 0;
|
||||
file load_file : text open read_mode is "code.txt";
|
||||
variable hex_file_line : line;
|
||||
begin
|
||||
|
||||
--Load in the ram executable image
|
||||
if index = 0 then
|
||||
while not endfile(load_file) loop
|
||||
--The following two lines had to be commented out for synthesis
|
||||
readline(load_file, hex_file_line);
|
||||
hread(hex_file_line, data);
|
||||
storage(index) := data;
|
||||
index := index + 1;
|
||||
end loop;
|
||||
end if;
|
||||
|
||||
if rising_edge(clk) then
|
||||
index := conv_integer(address(ADDRESS_WIDTH-1 downto 2));
|
||||
data := storage(index);
|
||||
|
||||
if enable = '1' then
|
||||
if write_byte_enable(0) = '1' then
|
||||
data(7 downto 0) := data_write(7 downto 0);
|
||||
end if;
|
||||
if write_byte_enable(1) = '1' then
|
||||
data(15 downto 8) := data_write(15 downto 8);
|
||||
end if;
|
||||
if write_byte_enable(2) = '1' then
|
||||
data(23 downto 16) := data_write(23 downto 16);
|
||||
end if;
|
||||
if write_byte_enable(3) = '1' then
|
||||
data(31 downto 24) := data_write(31 downto 24);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if write_byte_enable /= "0000" then
|
||||
storage(index) := data;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
data_read <= data;
|
||||
end process;
|
||||
end generate; --generic_ram
|
||||
|
||||
|
||||
altera_ram:
|
||||
if memory_type = "ALTERA_LPM" generate
|
||||
signal byte_we : std_logic_vector(3 downto 0);
|
||||
begin
|
||||
byte_we <= write_byte_enable when enable = '1' else "0000";
|
||||
lpm_ram_io_component0 : lpm_ram_dq
|
||||
GENERIC MAP (
|
||||
intended_device_family => "UNUSED",
|
||||
lpm_width => 8,
|
||||
lpm_widthad => ADDRESS_WIDTH-2,
|
||||
lpm_indata => "REGISTERED",
|
||||
lpm_address_control => "REGISTERED",
|
||||
lpm_outdata => "UNREGISTERED",
|
||||
lpm_file => "code0.hex",
|
||||
use_eab => "ON",
|
||||
lpm_type => "LPM_RAM_DQ")
|
||||
PORT MAP (
|
||||
data => data_write(31 downto 24),
|
||||
address => address(ADDRESS_WIDTH-1 downto 2),
|
||||
inclock => clk,
|
||||
we => byte_we(3),
|
||||
q => data_read(31 downto 24));
|
||||
|
||||
lpm_ram_io_component1 : lpm_ram_dq
|
||||
GENERIC MAP (
|
||||
intended_device_family => "UNUSED",
|
||||
lpm_width => 8,
|
||||
lpm_widthad => ADDRESS_WIDTH-2,
|
||||
lpm_indata => "REGISTERED",
|
||||
lpm_address_control => "REGISTERED",
|
||||
lpm_outdata => "UNREGISTERED",
|
||||
lpm_file => "code1.hex",
|
||||
use_eab => "ON",
|
||||
lpm_type => "LPM_RAM_DQ")
|
||||
PORT MAP (
|
||||
data => data_write(23 downto 16),
|
||||
address => address(ADDRESS_WIDTH-1 downto 2),
|
||||
inclock => clk,
|
||||
we => byte_we(2),
|
||||
q => data_read(23 downto 16));
|
||||
|
||||
lpm_ram_io_component2 : lpm_ram_dq
|
||||
GENERIC MAP (
|
||||
intended_device_family => "UNUSED",
|
||||
lpm_width => 8,
|
||||
lpm_widthad => ADDRESS_WIDTH-2,
|
||||
lpm_indata => "REGISTERED",
|
||||
lpm_address_control => "REGISTERED",
|
||||
lpm_outdata => "UNREGISTERED",
|
||||
lpm_file => "code2.hex",
|
||||
use_eab => "ON",
|
||||
lpm_type => "LPM_RAM_DQ")
|
||||
PORT MAP (
|
||||
data => data_write(15 downto 8),
|
||||
address => address(ADDRESS_WIDTH-1 downto 2),
|
||||
inclock => clk,
|
||||
we => byte_we(1),
|
||||
q => data_read(15 downto 8));
|
||||
|
||||
lpm_ram_io_component3 : lpm_ram_dq
|
||||
GENERIC MAP (
|
||||
intended_device_family => "UNUSED",
|
||||
lpm_width => 8,
|
||||
lpm_widthad => ADDRESS_WIDTH-2,
|
||||
lpm_indata => "REGISTERED",
|
||||
lpm_address_control => "REGISTERED",
|
||||
lpm_outdata => "UNREGISTERED",
|
||||
lpm_file => "code3.hex",
|
||||
use_eab => "ON",
|
||||
lpm_type => "LPM_RAM_DQ")
|
||||
PORT MAP (
|
||||
data => data_write(7 downto 0),
|
||||
address => address(ADDRESS_WIDTH-1 downto 2),
|
||||
inclock => clk,
|
||||
we => byte_we(0),
|
||||
q => data_read(7 downto 0));
|
||||
|
||||
end generate; --altera_ram
|
||||
|
||||
|
||||
--For XILINX see ram_xilinx.vhd
|
||||
|
||||
end; --architecture logic
|
||||
@@ -27,11 +27,10 @@ library UNISIM;
|
||||
use UNISIM.vcomponents.all;
|
||||
|
||||
entity ram is
|
||||
generic(memory_type : string := "DEFAULT");
|
||||
port(clk : in std_logic;
|
||||
enable : in std_logic;
|
||||
write_byte_enable : in std_logic_vector(3 downto 0);
|
||||
address : in std_logic_vector(31 downto 2);
|
||||
address : in std_logic_vector(10 downto 0);
|
||||
data_write : in std_logic_vector(31 downto 0);
|
||||
data_read : out std_logic_vector(31 downto 0));
|
||||
end; --entity ram
|
||||
@@ -45,12 +44,12 @@ INIT_00 => X"afafafafafafafafafafafafafafafaf2308000c241400ac273c243c243c273c",
|
||||
INIT_01 => X"8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f230c008c8c3caf00af00af2340afaf",
|
||||
INIT_02 => X"acacacac0003373cac038cac8cac8cac8c243c40034040033423038f038f8f8f",
|
||||
INIT_03 => X"000300ac0300000034038c8c8c8c8c8c8c8c8c8c8c8c3403acacacacacacacac",
|
||||
INIT_04 => X"ad343434343c3ca5a5242434a534a1242434a134a0242434a034a0242434343c",
|
||||
INIT_05 => X"0080afafaf270003ac001030008c343c0003ac8c34943c908d349434913434ad",
|
||||
INIT_06 => X"afaf272703008f8f8f00140082000c2682000c241400100082260c0024080010",
|
||||
INIT_07 => X"000caf2730038c343c240827038f8f8f8f0216260c2424142c3002242400afaf",
|
||||
INIT_08 => X"000000000000000000000024038c0014ac00248c3c24243c3c2703008f8c3c10",
|
||||
INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_04 => X"3c34ac343c34a42434a42434a42434a02434a02434a02434a02434a024343c27",
|
||||
INIT_05 => X"8cac343caf008c34a730009434a330009034af008ca730009434a3300090ac34",
|
||||
INIT_06 => X"82240c00142400100080afafaf270003ac3c1030008c343c0008af008c34af00",
|
||||
INIT_07 => X"26240c2608240c00102c3002242400afafafaf2727038f8f8f0000140082260c",
|
||||
INIT_08 => X"2703008f8c3c10000caf2730038c343c2703008f240caf2727038f8f8f8f0216",
|
||||
INIT_09 => X"000000000000000000000000000000000024038c001424ac00008c243c3c243c",
|
||||
INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
@@ -108,7 +107,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(31 downto 24),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(31 downto 24),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -122,12 +121,12 @@ INIT_00 => X"b8afaeadacabaaa9a8a7a6a5a4a3a2a1bd000000a560a4a0bd1d8404a5059c1c",
|
||||
INIT_01 => X"b9b8afaeadacabaaa9a8a7a6a5a4a3a2a1a50086c6c406bb00bb00ba5a1abfb9",
|
||||
INIT_02 => X"9392919000405a1a06e0a606a606a606a6a50584e0029b401bbd60bb60bbbabf",
|
||||
INIT_03 => X"00e000c4e0000085a2e09f9d9c9e979695949392919002e09f9d9c9e97969594",
|
||||
INIT_04 => X"8263428c8e0302634203028b238aa2030289038de2030288c387a20302868504",
|
||||
INIT_05 => X"0082b1bfb0bd00e0a40040420062a30500e0a2a342860262c6844785a68382c3",
|
||||
INIT_06 => X"b1b2bdbde000b0b1bf0040000240001002000004510040000210004011008040",
|
||||
INIT_07 => X"0000bfbd42e06263030400bde0b0b1b2bf12111000646440624312111080bfb0",
|
||||
INIT_08 => X"000000040000802400800042e0a20083404584820563440302bde000bf620340",
|
||||
INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_04 => X"026482420264820264820264820264a2026582026482026482026482026403bd",
|
||||
INIT_05 => X"62624202a2004262a242004262a242004262a20082a242004262a24200a28242",
|
||||
INIT_06 => X"04040000511180400082b0b1bfbd00e044024042006243020000a2006263a200",
|
||||
INIT_07 => X"108400100084000040824412111080b0b1b2bfbdbde0b0b1bf00004000021000",
|
||||
INIT_08 => X"bde000bf4202400000bfbd42e0424202bde000bf0400bfbdbde0b0b1b2bf1211",
|
||||
INIT_09 => X"000000000000000000040000802400800042e0a2006463404500624402054302",
|
||||
INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
@@ -185,7 +184,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(23 downto 16),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(23 downto 16),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -196,15 +195,15 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
RAMB16_S9_inst2 : RAMB16_S9
|
||||
generic map (
|
||||
INIT_00 => X"00000000000000000000000000000000ff00000000ff18000600060004008400",
|
||||
INIT_01 => X"000000000000000000000000000000000000002000002000d800d800ff700000",
|
||||
INIT_01 => X"000000000000000000000000000000000000012000002000d800d800ff700000",
|
||||
INIT_02 => X"0000000000000010000000000000000000010060006060000000000000000000",
|
||||
INIT_03 => X"0000000000201000000000000000000000000000000000000000000000000000",
|
||||
INIT_04 => X"0031303030313000002221200020002000200010000000100010000000101020",
|
||||
INIT_05 => X"0000000000ff00000010ff000000002010000000aa00aa000020003000102000",
|
||||
INIT_06 => X"0000ff00001000000000ff000020000000000000ff0000000000002000008000",
|
||||
INIT_07 => X"000000ff0000000020000000000000000010ffff00000000000010ff00900000",
|
||||
INIT_08 => X"000000200000002028000000000000ff001000001004040000000000000020ff",
|
||||
INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_04 => X"31030030300300220200210200200200000400000400000400000400000420ff",
|
||||
INIT_05 => X"000055550000000300ff000002000000000400000000ff000002000000000031",
|
||||
INIT_06 => X"00000000000080000000000000ff10000020ff00000000200000000000000000",
|
||||
INIT_07 => X"ff0000ff0100000000000010ff009000000000ff00000000001000ff00000000",
|
||||
INIT_08 => X"000000000020ff000100ff000000002000000000000000ff00000000000010ff",
|
||||
INIT_09 => X"000000000000000000200000002028000000000000ff00001000000400100400",
|
||||
INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
@@ -262,7 +261,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(15 downto 8),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(15 downto 8),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -272,16 +271,16 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
|
||||
RAMB16_S9_inst3 : RAMB16_S9
|
||||
generic map (
|
||||
INIT_00 => X"4c4844403c3834302c2824201c181410980e008004fd2a006800800074007001",
|
||||
INIT_01 => X"504c4844403c3834302c2824201c18141000f52410200060125c1058fc005450",
|
||||
INIT_00 => X"4c4844403c3834302c2824201c181410980e008004fd2a00c800e000dc00d001",
|
||||
INIT_01 => X"504c4844403c3834302c2824201c18141000082410200060125c1058fc005450",
|
||||
INIT_02 => X"0c08040000083c0048080c440840043c006000000800000801681360115c5854",
|
||||
INIT_03 => X"00080c000810121900082c2824201c1814100c08040000082c2824201c181410",
|
||||
INIT_04 => X"0031300004313000002221040002002014000004001312030002001110010000",
|
||||
INIT_05 => X"0000141810e000080021fc020000200021080000aa00aa000008000800080600",
|
||||
INIT_06 => X"1418e020082110141800f5000021b0010000b00df8000d000001b0210acb2116",
|
||||
INIT_07 => X"00f710e8010800200049b020081014181c06f8fcb05730020a0f06fc1c211c10",
|
||||
INIT_08 => X"000000001010200000207084080000fb002104000074540000180800100000fd",
|
||||
INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_04 => X"31340030303000221400211200201000141400131300121200111100101000f8",
|
||||
INIT_05 => X"000055550400003802ff00001800ff00001804000002ff00001600ff00000031",
|
||||
INIT_06 => X"000dc800030a210d0000101418e021080000fc020000200000c6040000200400",
|
||||
INIT_07 => X"fc57c8fc0030c800050a0f06fc1c211014181ce020081014182100f6000001c8",
|
||||
INIT_08 => X"180800100000fd001010e801080020001808001049c810e820081014181c06f4",
|
||||
INIT_09 => X"000000000000000000001010200000207084080000fa0400210000dc0000bc00",
|
||||
INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
@@ -339,7 +338,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(7 downto 0),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(7 downto 0),
|
||||
DIP => ZERO(0 downto 0),
|
||||
|
||||
@@ -27,11 +27,10 @@ library UNISIM;
|
||||
use UNISIM.vcomponents.all;
|
||||
|
||||
entity ram is
|
||||
generic(memory_type : string := "DEFAULT");
|
||||
port(clk : in std_logic;
|
||||
enable : in std_logic;
|
||||
write_byte_enable : in std_logic_vector(3 downto 0);
|
||||
address : in std_logic_vector(31 downto 2);
|
||||
address : in std_logic_vector(10 downto 0);
|
||||
data_write : in std_logic_vector(31 downto 0);
|
||||
data_read : out std_logic_vector(31 downto 0));
|
||||
end; --entity ram
|
||||
@@ -108,7 +107,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(31 downto 24),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(31 downto 24),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -185,7 +184,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(23 downto 16),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(23 downto 16),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -262,7 +261,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(15 downto 8),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(15 downto 8),
|
||||
DIP => ZERO(0 downto 0),
|
||||
@@ -339,7 +338,7 @@ INIT_3F => X"0000000000000000000000000000000000000000000000000000000000000000")
|
||||
port map (
|
||||
DO => data_read(7 downto 0),
|
||||
DOP => open,
|
||||
ADDR => address(12 downto 2),
|
||||
ADDR => address(10 downto 0),
|
||||
CLK => clk,
|
||||
DI => data_write(7 downto 0),
|
||||
DIP => ZERO(0 downto 0),
|
||||
|
||||
@@ -235,89 +235,4 @@ end process;
|
||||
data_out2 <= data_out2A when addr_read2(4)='0' else data_out2B;
|
||||
end generate; --xilinx_16x1d
|
||||
|
||||
|
||||
-- Option #4
|
||||
-- Altera LPM_RAM_DP
|
||||
altera_mem:
|
||||
if memory_type = "ALTERA_LPM" generate
|
||||
signal clk_delayed : std_logic;
|
||||
signal addr_reg : std_logic_vector(4 downto 0);
|
||||
signal data_reg : std_logic_vector(31 downto 0);
|
||||
signal q1 : std_logic_vector(31 downto 0);
|
||||
signal q2 : std_logic_vector(31 downto 0);
|
||||
begin
|
||||
-- Altera dual port RAMs must have the addresses registered (sampled
|
||||
-- at the rising edge). This is very unfortunate.
|
||||
-- Therefore, the dual port RAM read clock must delayed so that
|
||||
-- the read address signal can be sent from the mem_ctrl block.
|
||||
-- This solution also delays the how fast the registers are read so the
|
||||
-- maximum clock speed is cut in half (12.5 MHz instead of 25 MHz).
|
||||
|
||||
clk_delayed <= not clk; --Could be delayed by 1/4 clock cycle instead
|
||||
dpram_bypass: process(clk, addr_write, reg_dest_new)
|
||||
begin
|
||||
if rising_edge(clk) and write_enable = '1' then
|
||||
addr_reg <= addr_write;
|
||||
data_reg <= reg_dest_new;
|
||||
end if;
|
||||
end process; --dpram_bypass
|
||||
|
||||
-- Bypass dpram if reading what was just written (Altera limitation)
|
||||
data_out1 <= q1 when addr_read1 /= addr_reg else data_reg;
|
||||
data_out2 <= q2 when addr_read2 /= addr_reg else data_reg;
|
||||
|
||||
lpm_ram_dp_component1 : lpm_ram_dp
|
||||
generic map (
|
||||
LPM_WIDTH => 32,
|
||||
LPM_WIDTHAD => 5,
|
||||
--LPM_NUMWORDS => 0,
|
||||
LPM_INDATA => "REGISTERED",
|
||||
LPM_OUTDATA => "UNREGISTERED",
|
||||
LPM_RDADDRESS_CONTROL => "REGISTERED",
|
||||
LPM_WRADDRESS_CONTROL => "REGISTERED",
|
||||
LPM_FILE => "UNUSED",
|
||||
LPM_TYPE => "LPM_RAM_DP",
|
||||
USE_EAB => "ON",
|
||||
INTENDED_DEVICE_FAMILY => "UNUSED",
|
||||
RDEN_USED => "FALSE",
|
||||
LPM_HINT => "UNUSED")
|
||||
port map (
|
||||
RDCLOCK => clk_delayed,
|
||||
RDCLKEN => '1',
|
||||
RDADDRESS => addr_read1,
|
||||
RDEN => '1',
|
||||
DATA => reg_dest_new,
|
||||
WRADDRESS => addr_write,
|
||||
WREN => write_enable,
|
||||
WRCLOCK => clk,
|
||||
WRCLKEN => '1',
|
||||
Q => q1);
|
||||
lpm_ram_dp_component2 : lpm_ram_dp
|
||||
generic map (
|
||||
LPM_WIDTH => 32,
|
||||
LPM_WIDTHAD => 5,
|
||||
--LPM_NUMWORDS => 0,
|
||||
LPM_INDATA => "REGISTERED",
|
||||
LPM_OUTDATA => "UNREGISTERED",
|
||||
LPM_RDADDRESS_CONTROL => "REGISTERED",
|
||||
LPM_WRADDRESS_CONTROL => "REGISTERED",
|
||||
LPM_FILE => "UNUSED",
|
||||
LPM_TYPE => "LPM_RAM_DP",
|
||||
USE_EAB => "ON",
|
||||
INTENDED_DEVICE_FAMILY => "UNUSED",
|
||||
RDEN_USED => "FALSE",
|
||||
LPM_HINT => "UNUSED")
|
||||
port map (
|
||||
RDCLOCK => clk_delayed,
|
||||
RDCLKEN => '1',
|
||||
RDADDRESS => addr_read2,
|
||||
RDEN => '1',
|
||||
DATA => reg_dest_new,
|
||||
WRADDRESS => addr_write,
|
||||
WREN => write_enable,
|
||||
WRCLOCK => clk,
|
||||
WRCLKEN => '1',
|
||||
Q => q2);
|
||||
end generate; --altera_mem
|
||||
|
||||
end; --architecture ram_block
|
||||
|
||||
@@ -2,25 +2,30 @@ onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /tbench/clk
|
||||
add wave -noupdate -format Logic /tbench/reset
|
||||
add wave -noupdate -format Logic /tbench/interrupt
|
||||
add wave -noupdate -format Logic /tbench/mem_write
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/data_read
|
||||
add wave -noupdate -format Logic /tbench/pause1
|
||||
add wave -noupdate -format Logic /tbench/pause2
|
||||
add wave -noupdate -format Logic /tbench/pause
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/enable_misc
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/enable_uart
|
||||
add wave -noupdate -format Logic /tbench/uart_write
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/cpu_data_w
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/cpu_data_r
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/address_next
|
||||
add wave -noupdate -format Literal /tbench/gpioa_in
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/write_enable
|
||||
add wave -noupdate -format Literal /tbench/u1_plasma/cpu_byte_we
|
||||
add wave -noupdate -format Literal -expand /tbench/u1_plasma/byte_we_next
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/cpu_address
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/address_next
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/cpu_data_w
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/cpu_data_r
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/cs_ram
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/cs_uart
|
||||
add wave -noupdate -format Literal /tbench/u1_plasma/u3_uart/addr
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u3_uart/enable_read
|
||||
add wave -noupdate -format Literal /tbench/u1_plasma/u3_uart/addr
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u3_uart/enable_write
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u_txd
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u3_uart/busy_write
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u_rxd
|
||||
add wave -noupdate -format Logic /tbench/u1_plasma/u3_uart/data_avail
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/u3_uart/data_in
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tbench/u1_plasma/u3_uart/data_out
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {75144797 ps} 0}
|
||||
configure wave -namecolwidth 269
|
||||
WaveRestoreCursors {{Cursor 1} {999785196 ps} 0}
|
||||
configure wave -namecolwidth 285
|
||||
configure wave -valuecolwidth 40
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 0
|
||||
@@ -33,4 +38,4 @@ configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {71704646 ps} {72130128 ps}
|
||||
WaveRestoreZoom {0 ps} {1050 us}
|
||||
|
||||
@@ -2,16 +2,14 @@ onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /plasma_TB_v/clk
|
||||
add wave -noupdate -format Logic /plasma_TB_v/reset
|
||||
add wave -noupdate -format Literal /plasma_TB_v/data_tx
|
||||
add wave -noupdate -format Event /plasma_TB_v/reset_trigger
|
||||
add wave -noupdate -format Event /plasma_TB_v/reset_done_trigger
|
||||
add wave -noupdate -format Literal /plasma_TB_v/uut/data_read
|
||||
add wave -noupdate -format Logic /plasma_TB_v/uut/ram_enable
|
||||
add wave -noupdate -format Literal -radix hexadecimal /plasma_TB_v/uut/cpu_data_w
|
||||
add wave -noupdate -format Literal -radix hexadecimal /plasma_TB_v/uut/cpu_data_r
|
||||
add wave -noupdate -format Literal /plasma_TB_v/uut/byte_we_next
|
||||
add wave -noupdate -format Literal -radix binary -expand /plasma_TB_v/uut/byte_we_next
|
||||
add wave -noupdate -format Logic /plasma_TB_v/uut/U_RxD
|
||||
add wave -noupdate -format Logic /plasma_TB_v/uut/U_TxD
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {3952754 ps} 0}
|
||||
WaveRestoreCursors {{Cursor 1} {138039444 ps} 0}
|
||||
configure wave -namecolwidth 240
|
||||
configure wave -valuecolwidth 100
|
||||
configure wave -justifyvalue left
|
||||
@@ -25,4 +23,4 @@ configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {3946113 ps} {4013617 ps}
|
||||
WaveRestoreZoom {132508776 ps} {136643152 ps}
|
||||
|
||||
@@ -19,17 +19,16 @@ use std.textio.all;
|
||||
use work.mlite_pack.all;
|
||||
|
||||
entity uart is
|
||||
generic(log_file : string := "UNUSED");
|
||||
port(clk : in std_logic;
|
||||
reset : in std_logic;
|
||||
enable_read : in std_logic;
|
||||
enable_write : in std_logic;
|
||||
cs : in std_logic;
|
||||
nRdWr : in std_logic;
|
||||
data_in : in std_logic_vector(7 downto 0);
|
||||
data_out : out std_logic_vector(7 downto 0);
|
||||
uart_read : in std_logic;
|
||||
uart_write : out std_logic;
|
||||
busy_write : out std_logic;
|
||||
data_avail : out std_logic);
|
||||
addr : in std_logic_vector(3 downto 0)
|
||||
);
|
||||
end; --entity uart
|
||||
|
||||
architecture logic of uart is
|
||||
@@ -43,9 +42,43 @@ architecture logic of uart is
|
||||
signal busy_write_sig : std_logic;
|
||||
signal read_value_reg : std_logic_vector(6 downto 0);
|
||||
signal uart_read2 : std_logic;
|
||||
signal enable_read : std_logic;
|
||||
signal enable_write : std_logic;
|
||||
signal busy_write : std_logic;
|
||||
signal data_avail : std_logic;
|
||||
signal data_out_sig : std_logic_vector(7 downto 0);
|
||||
|
||||
|
||||
begin
|
||||
|
||||
interface_proc: process(cs, nRdWr, addr, data_out_sig, busy_write, data_avail, data_save_reg)
|
||||
begin
|
||||
if cs = '1' then
|
||||
if nRdWr = '1' then
|
||||
enable_read <= '0';
|
||||
enable_write <= '1';
|
||||
data_out_sig <= "00000000";
|
||||
else
|
||||
enable_read <= '1';
|
||||
enable_write <= '0';
|
||||
case addr(3 downto 0) is
|
||||
when "0000" =>
|
||||
data_out_sig <= data_save_reg(7 downto 0);
|
||||
when "0010" =>
|
||||
data_out_sig(7 downto 0) <= "000000" & busy_write & data_avail;
|
||||
when others =>
|
||||
data_out_sig <= "00000000";
|
||||
end case;
|
||||
end if;
|
||||
else
|
||||
enable_read <= '0';
|
||||
enable_write <= '0';
|
||||
data_out_sig <= "00000000";
|
||||
end if;
|
||||
data_out <= data_out_sig;
|
||||
end process;
|
||||
|
||||
|
||||
uart_proc: process(clk, reset, enable_read, enable_write, data_in,
|
||||
data_write_reg, bits_write_reg, delay_write_reg,
|
||||
data_read_reg, bits_read_reg, delay_read_reg,
|
||||
@@ -53,8 +86,8 @@ uart_proc: process(clk, reset, enable_read, enable_write, data_in,
|
||||
busy_write_sig, uart_read)
|
||||
constant COUNT_VALUE : std_logic_vector(9 downto 0) :=
|
||||
-- "0100011110"; --33MHz/2/57600Hz = 0x11e
|
||||
-- "1101100100"; --50MHz/57600Hz = 0x364
|
||||
"0110110010"; --25MHz/57600Hz = 0x1b2 -- Plasma IF uses div2
|
||||
"1101100100"; --50MHz/57600Hz = 0x364
|
||||
-- "0110110010"; --25MHz/57600Hz = 0x1b2 -- Plasma IF uses div2
|
||||
-- "0011011001"; --12.5MHz/57600Hz = 0xd9
|
||||
-- "0000000100"; --for debug (shorten read_value_reg)
|
||||
begin
|
||||
@@ -72,72 +105,67 @@ begin
|
||||
elsif rising_edge(clk) then
|
||||
|
||||
--Write UART
|
||||
if bits_write_reg = "0000" then --nothing left to write?
|
||||
if enable_write = '1' then
|
||||
delay_write_reg <= ZERO(9 downto 0); --delay before next bit
|
||||
bits_write_reg <= "1010"; --number of bits to write
|
||||
data_write_reg <= data_in & '0'; --remember data & start bit
|
||||
end if;
|
||||
else
|
||||
if delay_write_reg /= COUNT_VALUE then
|
||||
delay_write_reg <= delay_write_reg + 1; --delay before next bit
|
||||
else
|
||||
delay_write_reg <= ZERO(9 downto 0); --reset delay
|
||||
bits_write_reg <= bits_write_reg - 1; --bits left to write
|
||||
data_write_reg <= '1' & data_write_reg(8 downto 1);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
--Average uart_read signal
|
||||
if uart_read = '1' then
|
||||
if read_value_reg /= ONES(read_value_reg'length - 1 downto 0) then
|
||||
read_value_reg <= read_value_reg + 1;
|
||||
end if;
|
||||
else
|
||||
if read_value_reg /= ZERO(read_value_reg'length - 1 downto 0) then
|
||||
read_value_reg <= read_value_reg - 1;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
--Read UART
|
||||
if delay_read_reg = ZERO(9 downto 0) then --done delay for read?
|
||||
if bits_read_reg = "0000" then --nothing left to read?
|
||||
if uart_read2 = '0' then --wait for start bit
|
||||
delay_read_reg <= '0' & COUNT_VALUE(9 downto 1); --half period
|
||||
bits_read_reg <= "1001"; --bits left to read
|
||||
end if;
|
||||
else
|
||||
delay_read_reg <= COUNT_VALUE; --initialize delay
|
||||
bits_read_reg <= bits_read_reg - 1; --bits left to read
|
||||
data_read_reg <= uart_read2 & data_read_reg(7 downto 1);
|
||||
end if;
|
||||
else
|
||||
delay_read_reg <= delay_read_reg - 1; --delay
|
||||
end if;
|
||||
|
||||
--Control character buffer
|
||||
if bits_read_reg = "0000" and delay_read_reg = COUNT_VALUE then
|
||||
if data_save_reg(8) = '0' or
|
||||
(enable_read = '1' and data_save_reg(17) = '0') then
|
||||
--Empty buffer
|
||||
data_save_reg(8 downto 0) <= '1' & data_read_reg;
|
||||
else
|
||||
--Second character in buffer
|
||||
data_save_reg(17 downto 9) <= '1' & data_read_reg;
|
||||
if enable_read = '1' then
|
||||
data_save_reg(8 downto 0) <= data_save_reg(17 downto 9);
|
||||
end if;
|
||||
end if;
|
||||
elsif enable_read = '1' then
|
||||
data_save_reg(17) <= '0'; --data_available
|
||||
data_save_reg(8 downto 0) <= data_save_reg(17 downto 9);
|
||||
end if;
|
||||
end if; --rising_edge(clk)
|
||||
if bits_write_reg = "0000" then --nothing left to write?
|
||||
if enable_write = '1' then
|
||||
delay_write_reg <= ZERO(9 downto 0); --delay before next bit
|
||||
bits_write_reg <= "1010"; --number of bits to write
|
||||
data_write_reg <= data_in & '0'; --remember data & start bit
|
||||
end if;
|
||||
else
|
||||
if delay_write_reg /= COUNT_VALUE then
|
||||
delay_write_reg <= delay_write_reg + 1; --delay before next bit
|
||||
else
|
||||
delay_write_reg <= ZERO(9 downto 0); --reset delay
|
||||
bits_write_reg <= bits_write_reg - 1; --bits left to write
|
||||
data_write_reg <= '1' & data_write_reg(8 downto 1);
|
||||
end if;
|
||||
end if;
|
||||
--Average uart_read signal
|
||||
if uart_read = '1' then
|
||||
if read_value_reg /= ONES(read_value_reg'length - 1 downto 0) then
|
||||
read_value_reg <= read_value_reg + 1;
|
||||
end if;
|
||||
else
|
||||
if read_value_reg /= ZERO(read_value_reg'length - 1 downto 0) then
|
||||
read_value_reg <= read_value_reg - 1;
|
||||
end if;
|
||||
end if;
|
||||
--Read UART
|
||||
if delay_read_reg = ZERO(9 downto 0) then --done delay for read?
|
||||
if bits_read_reg = "0000" then --nothing left to read?
|
||||
if uart_read2 = '0' then --wait for start bit
|
||||
delay_read_reg <= '0' & COUNT_VALUE(9 downto 1); --half period
|
||||
bits_read_reg <= "1001"; --bits left to read
|
||||
end if;
|
||||
else
|
||||
delay_read_reg <= COUNT_VALUE; --initialize delay
|
||||
bits_read_reg <= bits_read_reg - 1; --bits left to read
|
||||
data_read_reg <= uart_read2 & data_read_reg(7 downto 1);
|
||||
end if;
|
||||
else
|
||||
delay_read_reg <= delay_read_reg - 1; --delay
|
||||
end if;
|
||||
--Control character buffer
|
||||
if bits_read_reg = "0000" and delay_read_reg = COUNT_VALUE then
|
||||
if data_save_reg(8) = '0' or
|
||||
(enable_read = '1' and data_save_reg(17) = '0') then
|
||||
--Empty buffer
|
||||
data_save_reg(8 downto 0) <= '1' & data_read_reg;
|
||||
else
|
||||
--Second character in buffer
|
||||
data_save_reg(17 downto 9) <= '1' & data_read_reg;
|
||||
if enable_read = '1' then
|
||||
data_save_reg(8 downto 0) <= data_save_reg(17 downto 9);
|
||||
end if;
|
||||
end if;
|
||||
elsif enable_read = '1' then
|
||||
data_save_reg(17) <= '0'; --data_available
|
||||
data_save_reg(8 downto 0) <= data_save_reg(17 downto 9);
|
||||
end if;
|
||||
end if; --rising_edge(clk)
|
||||
|
||||
uart_write <= data_write_reg(0);
|
||||
if bits_write_reg /= "0000"
|
||||
-- Comment out the following line for full UART simulation (much slower)
|
||||
and log_file = "UNUSED"
|
||||
then
|
||||
busy_write_sig <= '1';
|
||||
else
|
||||
@@ -145,37 +173,6 @@ begin
|
||||
end if;
|
||||
busy_write <= busy_write_sig;
|
||||
data_avail <= data_save_reg(8);
|
||||
data_out <= data_save_reg(7 downto 0);
|
||||
|
||||
end process; --uart_proc
|
||||
|
||||
-- synthesis_off
|
||||
uart_logger:
|
||||
if log_file /= "UNUSED" generate
|
||||
uart_proc: process(clk, enable_write, data_in)
|
||||
file store_file : text open write_mode is log_file;
|
||||
variable hex_file_line : line;
|
||||
variable c : character;
|
||||
variable index : natural;
|
||||
variable line_length : natural := 0;
|
||||
begin
|
||||
if rising_edge(clk) and busy_write_sig = '0' then
|
||||
if enable_write = '1' then
|
||||
index := conv_integer(data_in(6 downto 0));
|
||||
if index /= 10 then
|
||||
c := character'val(index);
|
||||
write(hex_file_line, c);
|
||||
line_length := line_length + 1;
|
||||
end if;
|
||||
if index = 10 or line_length >= 72 then
|
||||
--The following line may have to be commented out for synthesis
|
||||
writeline(store_file, hex_file_line);
|
||||
line_length := 0;
|
||||
end if;
|
||||
end if; --uart_sel
|
||||
end if; --rising_edge(clk)
|
||||
end process; --uart_proc
|
||||
end generate; --uart_logger
|
||||
-- synthesis_on
|
||||
|
||||
end; --architecture logic
|
||||
|
||||
Reference in New Issue
Block a user