Commit fbfe9bc0 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

Merge branch 'wishbonized' of ohwr.org:hdl-core-lib/wr-cores into wishbonized

parents ae55b0a0 17dd408d
......@@ -9,6 +9,7 @@ modules = {"local" :
"modules/wr_softpll_ng",
"modules/wr_endpoint",
"modules/wr_pps_gen",
"modules/wr_dacs",
"modules/wrc_core" ],
"git" : "git://ohwr.org/hdl-core-lib/general-cores.git"
}
files = [
"lpc_peripheral.vhd",
"lpc_uart.vhd",
"lpc_uart_pkg.vhd",
"postcode.vhd",
"serirq_defines.v",
"serirq_slave.v"
]
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
package lpc_uart_pkg is
component lpc_uart is
port (
lpc_clk: in std_logic;
lpc_serirq: inout std_logic;
lpc_ad: inout std_logic_vector(3 downto 0);
lpc_frame_n: in std_logic;
lpc_reset_n: in std_logic;
serial_rxd: in std_logic;
serial_txd: out std_logic;
serial_dtr: out std_logic;
serial_dcd: in std_logic;
serial_dsr: in std_logic;
serial_ri: in std_logic;
serial_cts: in std_logic;
serial_rts: out std_logic;
seven_seg_L: out std_logic_vector(7 downto 0); -- SSeg Data output
seven_seg_H: out std_logic_vector(7 downto 0) -- SSeg Data output
);
end component;
end lpc_uart_pkg;
files = [
"slib_clock_div.vhd",
"slib_counter.vhd",
"slib_edge_detect.vhd",
"slib_fifo_cyclone2.vhd",
"slib_fifo.vhd",
"slib_input_filter.vhd",
"slib_input_sync.vhd",
"slib_mv_filter.vhd",
"uart_16750.vhd",
"uart_baudgen.vhd",
"uart_interrupt.vhd",
"uart_receiver.vhd",
"uart_transmitter.vhd"
]
files = [
"spec_serial_dac_arb.vhd",
"spec_serial_dac.vhd"
]
......@@ -153,8 +153,9 @@ entity wr_core is
-----------------------------------------
-- 1-wire
-----------------------------------------
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0);
owr_pwren_o : out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0);
-----------------------------------------
--External WB interface
......@@ -409,7 +410,9 @@ architecture struct of wr_core is
signal dac_dpll_data : std_logic_vector(15 downto 0);
signal dac_dpll_sel : std_logic_vector(3 downto 0);
signal dac_dpll_load_p1 : std_logic;
signal clk_fb : std_logic_vector(g_aux_clks downto 0);
signal out_enable : std_logic_vector(g_aux_clks downto 0);
--component chipscope_ila
-- port (
......@@ -496,8 +499,7 @@ begin
-- Reference inputs (i.e. the RX clocks recovered by the PHYs)
clk_ref_i(0) => phy_rx_rbclk_i,
-- Feedback clocks (i.e. the outputs of the main or aux oscillator)
clk_fb_i(0) => clk_ref_i,
clk_fb_i(1) => clk_aux_i(0),
clk_fb_i => clk_fb,
-- DMTD Offset clock
clk_dmtd_i => clk_dmtd_i,
......@@ -514,8 +516,7 @@ begin
dac_out_sel_o => dac_dpll_sel, --for now use only one output
dac_out_load_o => dac_dpll_load_p1,
out_enable_i(0) => '1',
out_enable_i(1) => tm_clk_aux_lock_en_i,
out_enable_i => out_enable,
out_locked_o => spll_out_locked,
......@@ -525,13 +526,20 @@ begin
debug_o => dio_o
);
clk_fb(0) <= clk_ref_i;
clk_fb(g_aux_clks downto 1) <= clk_aux_i;
out_enable(0) <= '1';
out_enable(g_aux_clks downto 1) <= (others => tm_clk_aux_lock_en_i);
dac_dpll_data_o <= dac_dpll_data;
dac_dpll_load_p1_o <= '1' when (dac_dpll_load_p1 = '1' and dac_dpll_sel= x"0") else '0';
tm_dac_value_o <= x"00" & dac_dpll_data;
tm_dac_wr_o <= '1' when (dac_dpll_load_p1 = '1' and dac_dpll_sel = x"1") else '0';
tm_clk_aux_locked_o <= spll_out_locked(1);
locked_spll : if g_aux_clks > 0 generate
tm_clk_aux_locked_o <= spll_out_locked(1); -- !!! what if more than one clock?! FIXME
end generate;
softpll_irq <= spll_wb_out.int;
......@@ -719,6 +727,7 @@ begin
uart_rxd_i => uart_rxd_i,
uart_txd_o => uart_txd_o,
owr_pwren_o => owr_pwren_o,
owr_en_o => owr_en_o,
owr_i => owr_i
);
......
......@@ -67,6 +67,7 @@ entity wrc_periph is
uart_txd_o : out std_logic;
-- 1-Wire
owr_pwren_o: out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0)
);
......@@ -322,6 +323,7 @@ begin
slave_o => slave_o(2),
desc_o => open,
owr_pwren_o => owr_pwren_o,
owr_en_o => owr_en_o,
owr_i => owr_i
);
......
......@@ -219,6 +219,7 @@ constant c_wrc_periph3_sdb : t_sdb_device := (
slave_o : out t_wishbone_slave_out_array(0 to 2);
uart_rxd_i : in std_logic;
uart_txd_o : out std_logic;
owr_pwren_o : out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0)
);
......@@ -306,4 +307,117 @@ constant c_wrc_periph3_sdb : t_sdb_device := (
);
end component;
-----------------------------------------------------------------------------
-- Public WR component definitions
-----------------------------------------------------------------------------
component xwr_core is
generic(
g_simulation : integer := 0;
g_phys_uart : boolean := true;
g_virtual_uart : boolean := false;
g_with_external_clock_input : boolean := false;
g_aux_clks : integer := 1;
g_ep_rxbuf_size : integer := 1024;
g_dpram_initf : string := "";
g_dpram_initv : t_xwb_dpram_init := c_xwb_dpram_init_nothing;
g_dpram_size : integer := 20480; --in 32-bit words
g_interface_mode : t_wishbone_interface_mode := CLASSIC;
g_address_granularity : t_wishbone_address_granularity := WORD
);
port(
clk_sys_i : in std_logic;
clk_dmtd_i : in std_logic;
clk_ref_i : in std_logic;
clk_aux_i : in std_logic_vector(g_aux_clks-1 downto 0) := (others => '0');
clk_ext_i : in std_logic := '0';
pps_ext_i : in std_logic := '0';
rst_n_i : in std_logic;
dac_hpll_load_p1_o : out std_logic;
dac_hpll_data_o : out std_logic_vector(15 downto 0);
dac_dpll_load_p1_o : out std_logic;
dac_dpll_data_o : out std_logic_vector(15 downto 0);
phy_ref_clk_i : in std_logic;
phy_tx_data_o : out std_logic_vector(7 downto 0);
phy_tx_k_o : out std_logic;
phy_tx_disparity_i : in std_logic;
phy_tx_enc_err_i : in std_logic;
phy_rx_data_i : in std_logic_vector(7 downto 0);
phy_rx_rbclk_i : in std_logic;
phy_rx_k_i : in std_logic;
phy_rx_enc_err_i : in std_logic;
phy_rx_bitslide_i : in std_logic_vector(3 downto 0);
phy_rst_o : out std_logic;
phy_loopen_o : out std_logic;
led_red_o : out std_logic;
led_green_o : out std_logic;
scl_o : out std_logic;
scl_i : in std_logic;
sda_o : out std_logic;
sda_i : in std_logic;
sfp_scl_o : out std_logic;
sfp_scl_i : in std_logic;
sfp_sda_o : out std_logic;
sfp_sda_i : in std_logic;
sfp_det_i : in std_logic;
btn1_i : in std_logic;
btn2_i : in std_logic;
uart_rxd_i : in std_logic;
uart_txd_o : out std_logic;
owr_pwren_o : out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0);
slave_i : in t_wishbone_slave_in;
slave_o : out t_wishbone_slave_out;
aux_master_o : out t_wishbone_master_out;
aux_master_i : in t_wishbone_master_in := cc_dummy_master_in;
wrf_src_o : out t_wrf_source_out;
wrf_src_i : in t_wrf_source_in := c_dummy_src_in;
wrf_snk_o : out t_wrf_sink_out;
wrf_snk_i : in t_wrf_sink_in := c_dummy_snk_in;
timestamps_o : out t_txtsu_timestamp;
timestamps_ack_i : in std_logic := '1';
tm_link_up_o : out std_logic;
tm_dac_value_o : out std_logic_vector(23 downto 0);
tm_dac_wr_o : out std_logic;
tm_clk_aux_lock_en_i : in std_logic;
tm_clk_aux_locked_o : out std_logic;
tm_time_valid_o : out std_logic;
tm_utc_o : out std_logic_vector(39 downto 0);
tm_cycles_o : out std_logic_vector(27 downto 0);
pps_p_o : out std_logic;
dio_o : out std_logic_vector(3 downto 0);
rst_aux_n_o : out std_logic;
link_ok_o : out std_logic
);
end component;
component spec_serial_dac_arb
generic(
g_invert_sclk : boolean;
g_num_extra_bits : integer);
port (
clk_i : in std_logic;
rst_n_i : in std_logic;
val1_i : in std_logic_vector(15 downto 0);
load1_i : in std_logic;
val2_i : in std_logic_vector(15 downto 0);
load2_i : in std_logic;
dac_cs_n_o : out std_logic_vector(1 downto 0);
dac_clr_n_o : out std_logic;
dac_sclk_o : out std_logic;
dac_din_o : out std_logic);
end component;
end wrcore_pkg;
......@@ -134,6 +134,7 @@ entity xwr_core is
-----------------------------------------
-- 1-wire
-----------------------------------------
owr_pwren_o: out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0);
......@@ -245,6 +246,7 @@ architecture struct of xwr_core is
uart_rxd_i : in std_logic;
uart_txd_o : out std_logic;
owr_pwren_o: out std_logic_vector(1 downto 0);
owr_en_o : out std_logic_vector(1 downto 0);
owr_i : in std_logic_vector(1 downto 0);
......@@ -324,6 +326,7 @@ begin
g_virtual_uart => g_virtual_uart,
g_rx_buffer_size => g_ep_rxbuf_size,
g_with_external_clock_input => g_with_external_clock_input,
g_aux_clks => g_aux_clks,
g_dpram_initf => g_dpram_initf,
g_dpram_initv => g_dpram_initv,
g_dpram_size => g_dpram_size,
......@@ -372,6 +375,7 @@ begin
uart_rxd_i => uart_rxd_i,
uart_txd_o => uart_txd_o,
owr_pwren_o => owr_pwren_o,
owr_en_o => owr_en_o,
owr_i => owr_i,
......
files = [ "altera_pkg.vhd", "flash_loader.vhd", "pow_reset.vhd" ]
modules = {"local":"wr_gxb_phy_arria2"}
\ No newline at end of file
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.genram_pkg.all;
use work.wishbone_pkg.all;
use work.sysc_wbgen2_pkg.all;
use work.wr_fabric_pkg.all;
package wr_altera_pkg is
component flash_loader
port (
noe_in : in std_logic
);
end component;
component pow_reset is
port (
clk : in std_logic; -- 125Mhz
nreset : buffer std_logic
);
end component;
component dmtd_clk_pll
port
(
inclk0 : in std_logic := '0';
c0 : out std_logic
);
end component;
component sys_pll
port
(
inclk0 : in std_logic := '0';
c0 : out std_logic;
c1 : out std_logic;
locked : out std_logic
);
end component;
component wr_gxb_phy_arriaii
generic (
g_simulation : integer;
g_force_disparity : integer);
port (
clk_reconf_i : in std_logic;
clk_ref_i : in std_logic;
tx_clk_o : out std_logic;
tx_data_i : in std_logic_vector(7 downto 0);
tx_k_i : in std_logic;
tx_disparity_o : out std_logic;
tx_enc_err_o : out std_logic;
rx_rbclk_o : out std_logic;
rx_data_o : out std_logic_vector(7 downto 0);
rx_k_o : out std_logic;
rx_enc_err_o : out std_logic;
rx_bitslide_o : out std_logic_vector(3 downto 0);
rst_i : in std_logic;
loopen_i : in std_logic;
pad_txp_o : out std_logic;
pad_rxp_i : in std_logic := '0');
end component;
end wr_altera_pkg;
<?xml version="1.0" encoding="UTF-8"?>
<preset name="Micron MT41J64M16LA-15E">
<parameter name="mem_if_memtype" value="DDR3 SDRAM" />
<parameter name="vendor" value="Micron" />
<parameter name="chip_or_dimm" value="Discrete Device" />
<parameter name="mem_fmax" value="666.666" />
<parameter name="mem_if_coladdr_width" value="10" />
<parameter name="mem_if_rowaddr_width" value="13" />
<parameter name="mem_if_bankaddr_width" value="3" />
<parameter name="mem_if_clk_pair_count" value="1" />
<parameter name="mem_if_cs_per_dimm" value="1" />
<parameter name="mem_if_cs_per_rank" value="1" />
<parameter name="mem_if_cs_width" value="1" />
<parameter name="mirror_addressing" value="0" />
<parameter name="register_control_word_size" value="4" />
<parameter name="register_control_word_0" value="0000" />
<parameter name="register_control_word_1" value="0000" />
<parameter name="register_control_word_2" value="0000" />
<parameter name="register_control_word_3" value="0000" />
<parameter name="register_control_word_4" value="0000" />
<parameter name="register_control_word_5" value="0000" />
<parameter name="register_control_word_6" value="0000" />
<parameter name="register_control_word_7" value="0000" />
<parameter name="register_control_word_8" value="0000" />
<parameter name="register_control_word_9" value="0000" />
<parameter name="register_control_word_10" value="0000" />
<parameter name="register_control_word_11" value="0000" />
<parameter name="register_control_word_12" value="0000" />
<parameter name="register_control_word_13" value="0000" />
<parameter name="register_control_word_14" value="0000" />
<parameter name="register_control_word_15" value="0000" />
<parameter name="mem_if_dq_per_dqs" value="8" />
<parameter name="mem_if_dwidth" value="8" />
<parameter name="mem_if_dm_pins_en" value="Yes" />
<parameter name="mem_if_tinit_us" value="500.0" />
<parameter name="dss_tinit_rst_us" value="200.0" />
<parameter name="mem_if_tmrd_ns" value="6.0" />
<parameter name="mem_if_tras_ns" value="36.0" />
<parameter name="mem_if_trcd_ns" value="13.5" />
<parameter name="mem_if_trp_ns" value="13.5" />
<parameter name="mem_if_trefi_us" value="7.8" />
<parameter name="mem_if_trfc_ns" value="110.0" />
<parameter name="mem_if_twr_ns" value="15.0" />
<parameter name="mem_if_twtr_ck" value="4" />
<parameter name="mem_tdqsck_ps" value="255" />
<parameter name="mem_tdqsq_ps" value="125" />
<parameter name="mem_tdqss_ck" value="0.25" />
<parameter name="mem_tdha_ps" value="165" />
<parameter name="mem_tdsa_ps" value="180" />
<parameter name="mem_tdsh_ck" value="0.2" />
<parameter name="mem_tdss_ck" value="0.2" />
<parameter name="mem_tiha_ps" value="240" />
<parameter name="mem_tisa_ps" value="340" />
<parameter name="mem_tqh_ck" value="0.38" />
<parameter name="mem_tfaw_ns" value="30.0" />
<parameter name="mem_trrd_ns" value="6.0" />
<parameter name="mem_trtp_ns" value="7.5" />
<parameter name="mem_bl" value="On the fly" />
<parameter name="mem_btype" value="Sequential" />
<parameter name="mem_dll_pch" value="Fast exit" />
<parameter name="mem_dll_en" value="Yes" />
<parameter name="mem_rtt_nom" value="ODT Disabled" />
<parameter name="mem_rtt_wr" value="Dynamic ODT off" />
<parameter name="mem_drv_impedance" value="RZQ/7" />
<parameter name="mem_tcl" value="9.0" />
<parameter name="mem_atcl" value="Disabled" />
<parameter name="mem_wtcl" value="7.0" />
<parameter name="mem_pasr" value="Full Array" />
<parameter name="mem_asrm" value="Manual SR Reference (SRT)" />
<parameter name="mem_srtr" value="Normal" />
<parameter name="mem_tcl_50_fmax" value="333.333" />
<parameter name="mem_tcl_60_fmax" value="400.0" />
<parameter name="mem_tcl_70_fmax" value="533.333" />
<parameter name="mem_tcl_80_fmax" value="533.333" />
<parameter name="mem_tcl_90_fmax" value="666.666" />
<parameter name="mem_tcl_100_fmax" value="666.666" />
</preset>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
module alt_mem_ddrx_buffer
# (
// module parameter port list
parameter
ADDR_WIDTH = 3,
DATA_WIDTH = 8
)
(
// port list
ctl_clk,
ctl_reset_n,
// write interface
write_valid,
write_address,
write_data,
// read interface
read_valid,
read_address,
read_data
);
// -----------------------------
// local parameter declaration
// -----------------------------
localparam BUFFER_DEPTH = two_pow_N(ADDR_WIDTH);
// -----------------------------
// port declaration
// -----------------------------
input ctl_clk;
input ctl_reset_n;
// write interface
input write_valid;
input [ADDR_WIDTH-1:0] write_address;
input [DATA_WIDTH-1:0] write_data;
// read interface
input read_valid;
input [ADDR_WIDTH-1:0] read_address;
output [DATA_WIDTH-1:0] read_data;
// -----------------------------
// port type declaration
// -----------------------------
wire ctl_clk;
wire ctl_reset_n;
// write interface
wire write_valid;
wire [ADDR_WIDTH-1:0] write_address;
wire [DATA_WIDTH-1:0] write_data;
// read interface
wire read_valid;
wire [ADDR_WIDTH-1:0] read_address;
wire [DATA_WIDTH-1:0] read_data;
// -----------------------------
// module definition
// -----------------------------
altsyncram altsyncram_component
(
.wren_a (write_valid),
.clock0 (ctl_clk),
.address_a (write_address),
.address_b (read_address),
.data_a (write_data),
.q_b (read_data),
.aclr0 (1'b0),
.aclr1 (1'b0),
.addressstall_a (1'b0),
.addressstall_b (1'b0),
.byteena_a (1'b1),
.byteena_b (1'b1),
.clock1 (1'b1),
.clocken0 (1'b1),
.clocken1 (1'b1),
.clocken2 (1'b1),
.clocken3 (1'b1),
.data_b ({DATA_WIDTH{1'b1}}),
.eccstatus (),
.q_a (),
.rden_a (1'b1),
.rden_b (1'b1),
.wren_b (1'b0)
);
defparam
altsyncram_component.address_aclr_a = "NONE",
altsyncram_component.address_aclr_b = "NONE",
altsyncram_component.address_reg_b = "CLOCK0",
altsyncram_component.indata_aclr_a = "NONE",
altsyncram_component.intended_device_family = "Stratix",
altsyncram_component.lpm_type = "altsyncram",
altsyncram_component.numwords_a = BUFFER_DEPTH,
altsyncram_component.numwords_b = BUFFER_DEPTH,
altsyncram_component.operation_mode = "DUAL_PORT",
altsyncram_component.outdata_aclr_b = "NONE",
altsyncram_component.outdata_reg_b = "UNREGISTERED",
altsyncram_component.power_up_uninitialized = "FALSE",
altsyncram_component.read_during_write_mode_mixed_ports = "DONT_CARE",
altsyncram_component.widthad_a = ADDR_WIDTH,
altsyncram_component.widthad_b = ADDR_WIDTH,
altsyncram_component.width_a = DATA_WIDTH,
altsyncram_component.width_b = DATA_WIDTH,
altsyncram_component.width_byteena_a = 1,
altsyncram_component.wrcontrol_aclr_a = "NONE";
// alt_ddrx_ram_2port
// ram_inst
// (
// .clock (ctl_clk),
// .wren (write_valid),
// .wraddress (write_address),
// .data (write_data),
// .rdaddress (read_address),
// .q (read_data)
// );
function integer two_pow_N;
input integer value;
begin
two_pow_N = 2 << (value-1);
end
endfunction
endmodule
module alt_mem_ddrx_buffer_manager
# (
parameter
CFG_BUFFER_ADDR_WIDTH = 6
)
(
// port list
ctl_clk,
ctl_reset_n,
// write interface
writeif_ready,
writeif_valid,
writeif_address,
writeif_address_blocked,
// buffer write interface
buffwrite_valid,
buffwrite_address,
// read interface
readif_valid,
readif_address,
// buffer read interface
buffread_valid,
buffread_datavalid,
buffread_address
);
// -----------------------------
// local parameter declarations
// -----------------------------
localparam CTL_BUFFER_DEPTH = two_pow_N(CFG_BUFFER_ADDR_WIDTH);
// -----------------------------
// port declaration
// -----------------------------
input ctl_clk;
input ctl_reset_n;
// write interface
output writeif_ready;
input writeif_valid;
input [CFG_BUFFER_ADDR_WIDTH-1:0] writeif_address;
input writeif_address_blocked;
// buffer write interface
output buffwrite_valid;
output [CFG_BUFFER_ADDR_WIDTH-1:0] buffwrite_address;
// read data interface
input readif_valid;
input [CFG_BUFFER_ADDR_WIDTH-1:0] readif_address;
// buffer read interface
output buffread_valid;
output buffread_datavalid;
output [CFG_BUFFER_ADDR_WIDTH-1:0] buffread_address;
// -----------------------------
// port type declaration
// -----------------------------
wire ctl_clk;
wire ctl_reset_n;
// write interface
reg writeif_ready;
wire writeif_valid;
wire [CFG_BUFFER_ADDR_WIDTH-1:0] writeif_address;
wire writeif_address_blocked;
// buffer write interface
wire buffwrite_valid;
wire [CFG_BUFFER_ADDR_WIDTH-1:0] buffwrite_address;
// read data interface
wire readif_valid;
wire [CFG_BUFFER_ADDR_WIDTH-1:0] readif_address;
// buffer read interface
wire buffread_valid;
reg buffread_datavalid;
wire [CFG_BUFFER_ADDR_WIDTH-1:0] buffread_address;
// -----------------------------
// signal declaration
// -----------------------------
wire writeif_accepted;
reg [CTL_BUFFER_DEPTH-1:0] mux_writeif_ready;
reg [CTL_BUFFER_DEPTH-1:0] buffer_valid_array;
reg [CFG_BUFFER_ADDR_WIDTH-1:0] buffer_valid_counter;
reg err_buffer_valid_counter_overflow;
// -----------------------------
// module definition
// -----------------------------
assign writeif_accepted = writeif_ready & writeif_valid;
assign buffwrite_address = writeif_address;
assign buffwrite_valid = writeif_accepted;
assign buffread_address = readif_address;
assign buffread_valid = readif_valid;
always @ (*)
begin
if (writeif_address_blocked)
begin
// can't write ahead of lowest address currently tracked by dataid array
writeif_ready = 1'b0;
end
else
begin
// buffer is full when every location has been written
writeif_ready = ~&buffer_valid_counter;
end
end
// generate buffread_datavalid.
// data is valid one cycle after adddress is presented to the buffer
always @ (posedge ctl_clk or negedge ctl_reset_n)
begin
if (~ctl_reset_n)
begin
buffread_datavalid <= 0;
end
else
begin
buffread_datavalid <= buffread_valid;
end
end
// genvar i;
// generate
// for (i = 0; i < CTL_BUFFER_DEPTH; i = i + 1)
// begin : gen_mux_buffer_valid_array_signals
// wire [CFG_BUFFER_ADDR_WIDTH-1:0] gen_buffer_address = i;
// always @ (posedge ctl_clk or negedge ctl_reset_n)
// begin
// if (~ctl_reset_n)
// begin
// //reset state ...
// buffer_valid_array [i] <= 0;
// end
// else
// begin
// //active state ...
// // write & read to same location won't happen on same time
// // write
// if ( (writeif_address == gen_buffer_address) & writeif_accepted)
// begin
// buffer_valid_array[i] <= 1;
// end
// // read
// if ( (readif_address== gen_buffer_address) & readif_valid)
// begin
// buffer_valid_array[i] <= 0;
// end
// end
// end
// always @ (*)
// begin
// // mano - fmax !
// if ( (writeif_address == gen_buffer_address) & buffer_valid_array[i] )
// begin
// mux_writeif_ready[i] = 0;
// end
// else
// begin
// mux_writeif_ready[i] = 1;
// end
// end
// end
// endgenerate
always @ (posedge ctl_clk or negedge ctl_reset_n)
begin
if (~ctl_reset_n)
begin
buffer_valid_counter <= 0;
err_buffer_valid_counter_overflow <= 0;
end
else
begin
if (writeif_accepted & readif_valid)
begin
// write & read at same time
buffer_valid_counter <= buffer_valid_counter;
end
else if (writeif_accepted)
begin
// write only
{err_buffer_valid_counter_overflow, buffer_valid_counter} <= buffer_valid_counter + 1;
end
else if (readif_valid)
begin
// read only
buffer_valid_counter <= buffer_valid_counter - 1;
end
else
begin
buffer_valid_counter <= buffer_valid_counter;
end
end
end
function integer two_pow_N;
input integer value;
begin
two_pow_N = 2 << (value-1);
end
endfunction
endmodule
//
// assert
//
// - write & read to same location happen on same time
This diff is collapsed.
//altera message_off 10230
module alt_mem_ddrx_burst_tracking
# (
// module parameter port list
parameter
CFG_BURSTCOUNT_TRACKING_WIDTH = 7,
CFG_BUFFER_ADDR_WIDTH = 6,
CFG_INT_SIZE_WIDTH = 4
)
(
// port list
ctl_clk,
ctl_reset_n,
// data burst interface
burst_ready,
burst_valid,
// burstcount counter sent to data_id_manager
burst_pending_burstcount,
burst_next_pending_burstcount,
// burstcount consumed by data_id_manager
burst_consumed_valid,
burst_counsumed_burstcount
);
// -----------------------------
// local parameter declarations
// -----------------------------
// -----------------------------
// port declaration
// -----------------------------
input ctl_clk;
input ctl_reset_n;
// data burst interface
input burst_ready;
input burst_valid;
// burstcount counter sent to data_id_manager
output [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_pending_burstcount;
output [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_next_pending_burstcount;
// burstcount consumed by data_id_manager
input burst_consumed_valid;
input [CFG_INT_SIZE_WIDTH-1:0] burst_counsumed_burstcount;
// -----------------------------
// port type declaration
// -----------------------------
wire ctl_clk;
wire ctl_reset_n;
// data burst interface
wire burst_ready;
wire burst_valid;
// burstcount counter sent to data_id_manager
wire [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_pending_burstcount;
wire [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_next_pending_burstcount;
//wire [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_count_accepted;
// burstcount consumed by data_id_manager
wire burst_consumed_valid;
wire [CFG_INT_SIZE_WIDTH-1:0] burst_counsumed_burstcount;
// -----------------------------
// signal declaration
// -----------------------------
reg [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_counter;
reg [CFG_BURSTCOUNT_TRACKING_WIDTH-1:0] burst_counter_next;
wire burst_accepted;
// -----------------------------
// module definition
// -----------------------------
assign burst_pending_burstcount = burst_counter;
assign burst_next_pending_burstcount = burst_counter_next;
assign burst_accepted = burst_ready & burst_valid;
always @ (*)
begin
if (burst_accepted & burst_consumed_valid)
begin
burst_counter_next = burst_counter + 1 - burst_counsumed_burstcount;
end
else if (burst_accepted)
begin
burst_counter_next = burst_counter + 1;
end
else if (burst_consumed_valid)
begin
burst_counter_next = burst_counter - burst_counsumed_burstcount;
end
else
begin
burst_counter_next = burst_counter;
end
end
always @ (posedge ctl_clk or negedge ctl_reset_n)
begin
if (~ctl_reset_n)
begin
burst_counter <= 0;
end
else
begin
burst_counter <= burst_counter_next;
end
end
endmodule
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//--------------------------------------------------------------------------------------------------------
//
// [START] MMR - Memory Mapped Register Definition
//
//--------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
// Generic Signals
//----------------------------------------------------------------------------------------------------
// cfg_type
`define MMR_TYPE_DDR1 3'b000
`define MMR_TYPE_DDR2 3'b001
`define MMR_TYPE_DDR3 3'b010
`define MMR_TYPE_LPDDR1 3'b011
`define MMR_TYPE_LPDDR2 3'b100
//----------------------------------------------------------------------------------------------------
// Address Mapping Signals
//----------------------------------------------------------------------------------------------------
// cfg_addr_order
`define MMR_ADDR_ORDER_CS_ROW_BA_COL 2'b00
`define MMR_ADDR_ORDER_CS_BA_ROW_COL 2'b01
`define MMR_ADDR_ORDER_ROW_CS_BA_COL 2'b10
//--------------------------------------------------------------------------------------------------------
//
// [END] MMR - Memory Mapped Register Definition
//
//--------------------------------------------------------------------------------------------------------
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
-- Generated by DDR3 High Performance Controller 11.1 [Altera, IP Toolbench 1.3.0 Build 259]
-- ************************************************************
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
-- ************************************************************
-- Copyright (C) 1991-2012 Altera Corporation
-- Any megafunction design, and related net list (encrypted or decrypted),
-- support information, device programming or simulation file, and any other
-- associated documentation or information provided by Altera or a partner
-- under Altera's Megafunction Partnership Program may be used only to
-- program PLD devices (but not masked PLD devices) from Altera. Any other
-- use of such megafunction design, net list, support information, device
-- programming or simulation file, or any other related documentation or
-- information is prohibited for any other purpose, including, but not
-- limited to modification, reverse engineering, de-compiling, or use with
-- any other silicon devices, unless such use is explicitly licensed under
-- a separate agreement with Altera or a megafunction partner. Title to
-- the intellectual property, including patents, copyrights, trademarks,
-- trade secrets, or maskworks, embodied in any such megafunction design,
-- net list, support information, device programming or simulation file, or
-- any other related documentation or information provided by Altera or a
-- megafunction partner, remains with Altera, the megafunction partner, or
-- their respective licensors. No other licenses, including any licenses
-- needed under any third party's intellectual property, are provided herein.
component ddr3_mem
PORT (
local_address : IN STD_LOGIC_VECTOR (23 DOWNTO 0);
local_write_req : IN STD_LOGIC;
local_read_req : IN STD_LOGIC;
local_burstbegin : IN STD_LOGIC;
local_wdata : IN STD_LOGIC_VECTOR (63 DOWNTO 0);
local_be : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
local_size : IN STD_LOGIC_VECTOR (2 DOWNTO 0);
dbg_addr : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
dbg_wr : IN STD_LOGIC;
dbg_rd : IN STD_LOGIC;
dbg_cs : IN STD_LOGIC;
dbg_wr_data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
global_reset_n : IN STD_LOGIC;
pll_ref_clk : IN STD_LOGIC;
soft_reset_n : IN STD_LOGIC;
local_ready : OUT STD_LOGIC;
local_rdata : OUT STD_LOGIC_VECTOR (63 DOWNTO 0);
local_rdata_valid : OUT STD_LOGIC;
local_refresh_ack : OUT STD_LOGIC;
local_init_done : OUT STD_LOGIC;
reset_phy_clk_n : OUT STD_LOGIC;
dbg_rd_data : OUT STD_LOGIC_VECTOR (31 DOWNTO 0);
dbg_waitrequest : OUT STD_LOGIC;
dll_reference_clk : OUT STD_LOGIC;
dqs_delay_ctrl_export : OUT STD_LOGIC_VECTOR (5 DOWNTO 0);
mem_odt : OUT STD_LOGIC_VECTOR (0 DOWNTO 0);
mem_cs_n : OUT STD_LOGIC_VECTOR (0 DOWNTO 0);
mem_cke : OUT STD_LOGIC_VECTOR (0 DOWNTO 0);
mem_addr : OUT STD_LOGIC_VECTOR (12 DOWNTO 0);
mem_ba : OUT STD_LOGIC_VECTOR (2 DOWNTO 0);
mem_ras_n : OUT STD_LOGIC;
mem_cas_n : OUT STD_LOGIC;
mem_we_n : OUT STD_LOGIC;
mem_dm : OUT STD_LOGIC_VECTOR (1 DOWNTO 0);
mem_reset_n : OUT STD_LOGIC;
phy_clk : OUT STD_LOGIC;
aux_full_rate_clk : OUT STD_LOGIC;
aux_half_rate_clk : OUT STD_LOGIC;
reset_request_n : OUT STD_LOGIC;
mem_clk : INOUT STD_LOGIC_VECTOR (0 DOWNTO 0);
mem_clk_n : INOUT STD_LOGIC_VECTOR (0 DOWNTO 0);
mem_dq : INOUT STD_LOGIC_VECTOR (15 DOWNTO 0);
mem_dqs : INOUT STD_LOGIC_VECTOR (1 DOWNTO 0);
mem_dqsn : INOUT STD_LOGIC_VECTOR (1 DOWNTO 0)
);
end component;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD>
<STYLE type="text/css">
A.h:hover { color: "#FF0000"; }
A.menu:link { text-decoration: none}
A.menu:visited{ text-decoration: none}
A.menu:hover {color: #EE9B06;}
A.submenu:link { text-decoration: none;}
A.submenu:visited { text-decoration: none}
A.submenu:hover {color: #EE9B06;}
div.category { border-bottom: 5px, solid, black; }
br.submenu { line-height: 1em;}
br.submenu { line-height: 7px;}
BODY, H1, H2, H3, H4, TD, TH, UL, OL, LI, P, DD, DT, DL, INPUT, SELECT, SPAN { font-family : SansSerif, Verdana, Helvetica, Arial, San-sarif; }
BODY { background-color : #e0e0e0; }
TD, UL, OL, LI, P, DD, DT, DL, SPAN { font-size: 11pt; color : black; }
BLOCKQUOTE { font-size: 10pt; color : #000099; }
TH { font-size : 11pt; font-weight : bold; font-style : normal; color : black; }
H1 { font-size : 18pt; color : black; }
H2 { font-size : 14pt; color : black; }
H3 { font-size : 12pt; color : black; }
H4 { font-size : 11pt; font-weight : bold; color : black; }
</style></HEAD><BODY align="left" style='background-color: #ffffff;'><DIV align="left"><TABLE width="95%" border=0 cellpadding=2><TR><TD><TABLE cellpadding=2 border=0 ><TR><WIZARD></WIZARD><TD><H1>Generation Report - DDR3 SDRAM Controller with ALTMEMPHY v11.1</H1></TD></TR></TABLE></TD></TR><TR><TD><TABLE cellpadding=2 border=1 width="60%"><TR><TD><B>Entity Name</B></TD><TD>ddr3_mem_controller_phy</TD></TR><TR><TD><B>Variation Name</B></TD><TD>ddr3_mem</TD></TR><TR><TD><B>Variation HDL</B></TD><TD>VHDL</TD></TR><TR><TD><B>Output Directory</B></TD><TD>/home/stefan/quartus_projects/wr-hdl/platform/altera/ddr3</TD></TR></TABLE></TD></TR><TR><TD><h2>File Summary</h2>The MegaWizard interface is creating the following files in the output directory:</TD></TR><TR><TD><TABLE cellspacing=2 cellpadding=2 border=1 width="100%"><TR align="left"><TH align="left" align="top" width="25%"><B>File</B></TH><TH align="left"><B>Description</B></TH></TR><TR><TD>ddr3_mem.vhd</TD><TD>A MegaCore<small><sup>&reg</sup></small> function variation file, which defines a VHDL top-level description of the custom MegaCore function. Instantiate the entity defined by this file inside of your design. Include this file when compiling your design in the Quartus II software.</TD></TR><TR><TD>ddr3_mem.cmp</TD><TD>A VHDL component declaration for the MegaCore function variation. Add the contents of this file to any VHDL architecture that instantiates the MegaCore function.</TD></TR><TR><TD>ddr3_mem.qip</TD><TD>Contains Quartus II project information for your MegaCore function variation.</TD></TR><TR><TD>ddr3_mem.html</TD><TD>The MegaCore function report file.</TD></TR><TR><TD>ddr3_mem_example_driver.vhdl</TD><TD>Example self-checking test generator that matches your variation.</TD></TR><TR><TD>ddr3_mem_example_top.vhdl</TD><TD>Example top level design file that you should set as your Quartus II project top level. Instantiates the example driver and the controller.</TD></TR><TR><TD>ddr3_mem_example_top.sdc</TD><TD>Example Synopsys Design Constraints file for paths in the example top level.</TD></TR><TR><TD>ddr3_mem_ex_lfsr8.vhdl</TD><TD>Example linear feedback shift register that is used to generate the pseudo-random test data for the example driver.</TD></TR><TR><TD>testbench | ddr3_mem_example_top_tb.vhdl</TD><TD>Example testbench that instantiates the example top level design file and the example memory model.</TD></TR><TR><TD>testbench | ddr3_mem_mem_model.vhdl</TD><TD>A simple example memory model that matches your variation.</TD></TR><TR><TD>testbench | ddr3_mem_full_mem_model.vhdl</TD><TD>Memory model that allocates memory for all available addresses.</TD></TR><TR><TD>ddr3_mem_pin_assignments.tcl</TD><TD>TCL script</TD></TR><TR><TD>ddr3_mem_advisor.ipa</TD><TD>IP Advisor file that matches your variation. Used by the IP Advisor feature in the Quartus II software.</TD></TR><TR><TD>ddr3_mem_phy.qip</TD><TD>Generated ALTMEMPHY QIP file.</TD></TR></TABLE></TD></TR><TR><TD><h2>MegaCore Function Variation File Ports</h2><TABLE border=1 cellpadding=2 cellspacing=0 width="75%"><TR align="left"><TH align="left"><B>Name</B></TH><TH align="left"><B>Direction</B></TH><TH align="left"><B>Width</B></TH></TR><TR><TD>local_address</TD><TD>INPUT</TD><TD>24</TD></TR><TR><TD>local_write_req</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>local_read_req</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>local_burstbegin</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>local_ready</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>local_rdata</TD><TD>OUTPUT</TD><TD>64</TD></TR><TR><TD>local_rdata_valid</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>local_wdata</TD><TD>INPUT</TD><TD>64</TD></TR><TR><TD>local_be</TD><TD>INPUT</TD><TD>8</TD></TR><TR><TD>local_size</TD><TD>INPUT</TD><TD>3</TD></TR><TR><TD>local_refresh_ack</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>local_init_done</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>reset_phy_clk_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>dbg_addr</TD><TD>INPUT</TD><TD>13</TD></TR><TR><TD>dbg_wr</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>dbg_rd</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>dbg_cs</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>dbg_wr_data</TD><TD>INPUT</TD><TD>32</TD></TR><TR><TD>dbg_rd_data</TD><TD>OUTPUT</TD><TD>32</TD></TR><TR><TD>dbg_waitrequest</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>dll_reference_clk</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>dqs_delay_ctrl_export</TD><TD>OUTPUT</TD><TD>6</TD></TR><TR><TD>mem_odt</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_clk</TD><TD>BIDIR</TD><TD>1</TD></TR><TR><TD>mem_clk_n</TD><TD>BIDIR</TD><TD>1</TD></TR><TR><TD>mem_cs_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_cke</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_addr</TD><TD>OUTPUT</TD><TD>13</TD></TR><TR><TD>mem_ba</TD><TD>OUTPUT</TD><TD>3</TD></TR><TR><TD>mem_ras_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_cas_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_we_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>mem_dq</TD><TD>BIDIR</TD><TD>16</TD></TR><TR><TD>mem_dqs</TD><TD>BIDIR</TD><TD>2</TD></TR><TR><TD>mem_dqsn</TD><TD>BIDIR</TD><TD>2</TD></TR><TR><TD>mem_dm</TD><TD>OUTPUT</TD><TD>2</TD></TR><TR><TD>mem_reset_n</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>global_reset_n</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>pll_ref_clk</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>phy_clk</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>aux_full_rate_clk</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>aux_half_rate_clk</TD><TD>OUTPUT</TD><TD>1</TD></TR><TR><TD>soft_reset_n</TD><TD>INPUT</TD><TD>1</TD></TR><TR><TD>reset_request_n</TD><TD>OUTPUT</TD><TD>1</TD></TR></TABLE></TD></TR></TD></TR></TABLE></DIV></BODY></HTML>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
set_false_path -from * -to [get_ports "pnf"]
set_false_path -from * -to [get_ports "test_complete"]
set_false_path -from * -to [get_ports "pnf_per_byte\[*\]"]
set_false_path -from * -to [get_ports "mem_reset_n"]
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment