mirror of
https://github.com/marqs85/ossc.git
synced 2024-06-11 07:29:32 +00:00
Compare commits
270 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e1fbd4ad36 | ||
|
101a23bdb5 | ||
|
cbe2611471 | ||
|
20a5696977 | ||
|
dfedb850a3 | ||
|
8b7258fa9e | ||
|
f37f0e706e | ||
|
73dd1963b9 | ||
|
20ac572baf | ||
|
1ab1636619 | ||
|
0abb7e9bb3 | ||
|
58d81cbc5f | ||
|
6542ecaae1 | ||
|
709187bb43 | ||
|
760be1738e | ||
|
12436a3d3f | ||
|
c5c3d28b48 | ||
|
67a64693c1 | ||
|
8068542da1 | ||
|
2e7141c3b2 | ||
|
015f63ddff | ||
|
6666db3ea2 | ||
|
238cf0b285 | ||
|
89bc3f35e7 | ||
|
b68b586ec8 | ||
|
8df33bb364 | ||
|
2a24eb8dd7 | ||
|
32bbc49bf0 | ||
|
b890446e3d | ||
|
53eedc9d08 | ||
|
0b495b234c | ||
|
af1f8a20d4 | ||
|
598705c7fa | ||
|
556140dd62 | ||
|
cd77713255 | ||
|
124bcc8df8 | ||
|
9c5e7b5b83 | ||
|
b26b213ead | ||
|
299ac4a24c | ||
|
8f65defb49 | ||
|
45b093d768 | ||
|
4b179d2077 | ||
|
aa7a92e130 | ||
|
daf9ec1611 | ||
|
2823ab9f8b | ||
|
2995f43728 | ||
|
c2b0687e7b | ||
|
a6d8c51ddd | ||
|
7afd0faaaf | ||
|
71147c44dd | ||
|
d80a9fbb0c | ||
|
b1892079d8 | ||
|
2319a6f8bd | ||
|
4dab90a651 | ||
|
3c9ed1edf8 | ||
|
bab85e713b | ||
|
0c55cc03bb | ||
|
a076c6d2db | ||
|
8006cad1f2 | ||
|
aa1e9eb60c | ||
|
28d9e40c2f | ||
|
286c9a94d1 | ||
|
aeb164dd2f | ||
|
70dc68d504 | ||
|
85c295c5e2 | ||
|
8e7236dc00 | ||
|
b8c80c7425 | ||
|
9feb96888b | ||
|
3771d5cb14 | ||
|
ba4614a4f8 | ||
|
b22365af20 | ||
|
3a12592c53 | ||
|
9d496383c3 | ||
|
d1fd30019f | ||
|
a6bdd8cfab | ||
|
6266976114 | ||
|
aa43991534 | ||
|
c7fc62c038 | ||
|
077ce8afdc | ||
|
1d7f512172 | ||
|
52e8493873 | ||
|
0fc1a4707b | ||
|
4a686da462 | ||
|
df07eece10 | ||
|
b24e6c6366 | ||
|
5e0277fb48 | ||
|
1ba8d68aab | ||
|
5d39e2b752 | ||
|
d4696271c9 | ||
|
f0a14679d9 | ||
|
550e57a22b | ||
|
96d33a12b5 | ||
|
3d49b74667 | ||
|
125814225f | ||
|
9e81fb5922 | ||
|
f561f4586e | ||
|
2bac00fd82 | ||
|
687905780e | ||
|
4c1b211641 | ||
|
9533428a92 | ||
|
978ac04a43 | ||
|
97247d1f33 | ||
|
3e618cae2c | ||
|
76d69d19bf | ||
|
f2405989e9 | ||
|
d03e0658a0 | ||
|
c250042cdb | ||
|
ad056f249f | ||
|
7d9d419a8b | ||
|
c4114c3883 | ||
|
525c08a777 | ||
|
f7075a0846 | ||
|
f276cda190 | ||
|
4e4f5749ea | ||
|
0905620b4d | ||
|
055a794b5e | ||
|
9777fe8e66 | ||
|
4984ecf418 | ||
|
a5b329584e | ||
|
7914a2ee83 | ||
|
e8d5097ecb | ||
|
0a747cbce6 | ||
|
4676cbd2f0 | ||
|
e1d8446752 | ||
|
530df663b6 | ||
|
22e49300df | ||
|
c91988e5fb | ||
|
183b0fa78f | ||
|
5dd9f65bc6 | ||
|
70ab55c1fa | ||
|
dcd3d14a53 | ||
|
37650ca22b | ||
|
5422953f30 | ||
|
e6e970227a | ||
|
b464a9224b | ||
|
0bb490faa0 | ||
|
5852eb3465 | ||
|
f337852e19 | ||
|
6278e1026d | ||
|
9ad696dbc3 | ||
|
77d122940b | ||
|
ba648dd5fe | ||
|
f3e9489856 | ||
|
6877faa0b6 | ||
|
a58255b8d1 | ||
|
852054cdd0 | ||
|
985aeb1a93 | ||
|
45ca4e9268 | ||
|
0828addc83 | ||
|
0ab31b30b4 | ||
|
bd1d58660c | ||
|
d89c06b987 | ||
|
5922e64f55 | ||
|
209130b167 | ||
|
9ba41ec240 | ||
|
10eff56f28 | ||
|
d7ee965d89 | ||
|
670f515141 | ||
|
b10d7f3762 | ||
|
3154a83847 | ||
|
ba8ad6ce4c | ||
|
0b51fd7758 | ||
|
1a405c1e2e | ||
|
bc1b7419f2 | ||
|
990bc1563e | ||
|
1cc42b808d | ||
|
500a22f316 | ||
|
5249d313d8 | ||
|
9a2c9bb020 | ||
|
a39888845a | ||
|
bee64c6fbc | ||
|
8caa4c1952 | ||
|
09c735bd5f | ||
|
dd4ffde231 | ||
|
04c9137e29 | ||
|
d638b6a650 | ||
|
571b588da7 | ||
|
ab61fd0c67 | ||
|
1979bdb333 | ||
|
af4f7e17c7 | ||
|
3b8b200d6f | ||
|
a24d6b0e3a | ||
|
4ae3423acb | ||
|
2925ca389b | ||
|
1bf279b2a7 | ||
|
a8d1fad24a | ||
|
817012e23e | ||
|
75e072d622 | ||
|
76623292a9 | ||
|
4b21a354b4 | ||
|
535d3bce44 | ||
|
0ab713a870 | ||
|
c7e6719b24 | ||
|
f5f95fe8c3 | ||
|
a0c0620022 | ||
|
2ff14280e5 | ||
|
ac16008076 | ||
|
9d14cc776e | ||
|
2cd36cdd37 | ||
|
a8887ce47d | ||
|
fb8751da1e | ||
|
30af6b72f2 | ||
|
7ad04917ed | ||
|
e9fbf2a1b9 | ||
|
cabc04b3b0 | ||
|
5b5c8bc373 | ||
|
161d32077b | ||
|
b471589ae1 | ||
|
2aee3294e3 | ||
|
2577470abe | ||
|
d98c23c8c1 | ||
|
4f36278cb7 | ||
|
01b5fe20ee | ||
|
eafa7556d7 | ||
|
eeb83a12bc | ||
|
460599e748 | ||
|
339454bb8a | ||
|
39fefe2adc | ||
|
5771aa80ec | ||
|
f2910305ee | ||
|
0f9e224888 | ||
|
cdad09cbcd | ||
|
3ab34c00e0 | ||
|
97428ba3ad | ||
|
2c934c9dd0 | ||
|
6e043ef577 | ||
|
3b19b2843c | ||
|
25489dc303 | ||
|
d41c7522a0 | ||
|
434186d64e | ||
|
a03c01ca4d | ||
|
d77c293b70 | ||
|
0f8439abf3 | ||
|
79f215d41e | ||
|
03bf4c2c9a | ||
|
a4faf2c1ab | ||
|
108ea17604 | ||
|
fac88b348e | ||
|
d548d53272 | ||
|
d8d7950268 | ||
|
0e964b739c | ||
|
57314e9093 | ||
|
6dfd2be3ed | ||
|
5d3e3bbe33 | ||
|
611c8763c2 | ||
|
f55e9a877e | ||
|
16162499e4 | ||
|
71d60144e8 | ||
|
51691a168b | ||
|
7007906f02 | ||
|
9f086828ac | ||
|
c9012c2d84 | ||
|
9f7a30bea9 | ||
|
2dee0a2eb5 | ||
|
827df7930f | ||
|
a488422089 | ||
|
c8b542b917 | ||
|
a2e10637bd | ||
|
bab00679df | ||
|
6c5f753245 | ||
|
51c43a7c10 | ||
|
dceec5f197 | ||
|
74abbed1a8 | ||
|
4548bf0b8c | ||
|
9c2cdd64cf | ||
|
64b661c7e2 | ||
|
2de05ca742 | ||
|
e8c8347496 | ||
|
c4bb809c3c | ||
|
119d2fee15 |
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
.DS_Store
|
||||
software/sys_controller/.cproject
|
||||
software/sys_controller/.force_relink
|
||||
software/sys_controller/.project
|
||||
software/sys_controller/.settings/*
|
||||
software/sys_controller/obj/*
|
||||
db/*
|
||||
sys/*
|
||||
software/sys_controller_bsp/obj/*
|
||||
output_files/*
|
||||
incremental_db/*
|
||||
.cproject
|
||||
software/*/.settings/*
|
||||
software/sys_controller/mem_init/hdl_sim/*
|
||||
software/sys_controller_bsp/summary.html
|
||||
software/sys_controller/sys_controller.objdump
|
||||
software/sys_controller/sys_controller.map
|
||||
software/sys_controller/sys_controller.elf
|
||||
.qsys_edit/*
|
||||
PLLJ_PLLSPE_INFO.txt
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "ip/pulpino_qsys"]
|
||||
path = ip/pulpino_qsys
|
||||
url = https://github.com/marqs85/pulpino_qsys.git
|
28
CREDITS
Normal file
28
CREDITS
Normal file
|
@ -0,0 +1,28 @@
|
|||
Original design and code
|
||||
* marqs
|
||||
|
||||
Audio add-on board, scanline improvements
|
||||
* borti4938
|
||||
|
||||
Reverse LPF, scanline improvements
|
||||
* paulb_nl
|
||||
|
||||
Technical advisory, testing
|
||||
* Fudoh
|
||||
|
||||
Sales & support, testing
|
||||
* BuckoA51
|
||||
|
||||
Profile improvements
|
||||
* megari
|
||||
|
||||
Japanese translation
|
||||
* 511141 / lui
|
||||
|
||||
Early testing
|
||||
* juji82
|
||||
* Konsolkongen
|
||||
* Edenal
|
||||
* NYYRIKKI
|
||||
* stt
|
||||
* oasiz
|
123
README.md
123
README.md
|
@ -1,4 +1,125 @@
|
|||
Open Source Scan Converter
|
||||
==============
|
||||
|
||||
Documentation coming soon...
|
||||
Open Source Scan Converter is a low-latency video digitizer and scan conversion board designed mainly for connecting retro video game consoles and home computers into modern displays. Please check the [wikipage](http://junkerhq.net/xrgb/index.php?title=OSSC) for more detailed description and latest features.
|
||||
|
||||
Requirements for building and debugging firmware
|
||||
---------------------------------------------------
|
||||
* Hardware
|
||||
* OSSC board
|
||||
* USB Blaster compatible JTAG debugger, e.g. Terasic Blaster (for FW installation and debugging)
|
||||
* micro SD/SDHC card (for FW update via SD card)
|
||||
|
||||
* Software
|
||||
* [Altera Quartus II + Cyclone IV support](http://dl.altera.com/?edition=lite) (v 16.1 or higher - free Lite Edition suffices)
|
||||
* [RISC-V GNU Compiler Toolchain](https://github.com/riscv/riscv-gnu-toolchain)
|
||||
* GCC (or another C compiler) for host architecture (for building a SD card image)
|
||||
* Make
|
||||
* [iconv](https://en.wikipedia.org/wiki/Iconv) (for building with JP lang menu)
|
||||
|
||||
|
||||
Architecture
|
||||
------------------------------
|
||||
* [Reference board schematics](https://github.com/marqs85/ossc_pcb/raw/v1.6/ossc_board.pdf)
|
||||
* [Reference PCB project](https://github.com/marqs85/ossc_pcb)
|
||||
|
||||
|
||||
SW toolchain build procedure
|
||||
--------------------------
|
||||
1. Download, configure, build and install RISC-V toolchain with Newlib + RV32EMC support:
|
||||
~~~~
|
||||
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
|
||||
cd riscv-gnu-toolchain
|
||||
./configure --prefix=/opt/riscv --with-arch=rv32emc --with-abi=ilp32e
|
||||
sudo make # sudo needed if installing under default /opt/riscv location
|
||||
~~~~
|
||||
2. Compile custom binary to IHEX converter:
|
||||
~~~~
|
||||
gcc tools/bin2hex.c -o tools/bin2hex
|
||||
~~~~
|
||||
|
||||
|
||||
Building RTL (bitstream)
|
||||
--------------------------
|
||||
1. Initialize pulpino submodules (once after cloning ossc project or when submoduled have been updated)
|
||||
~~~~
|
||||
git submodule update --init --recursive ip/pulpino_qsys
|
||||
~~~~
|
||||
2. Load the project (ossc.qpf) in Quartus
|
||||
3. Generate QSYS output files (only needed before first compilation or when QSYS structure has been modified)
|
||||
* Open Platform Designer (Tools -> Platform Designer)
|
||||
* Load platform configuration (sys.qsys)
|
||||
* Generate output (Generate -> Generate HDL, Generate)
|
||||
* Close Platform Designer
|
||||
* Run "touch software/sys_controller_bsp/bsp_timestamp" to acknowledge QSYS update
|
||||
3. Generate the FPGA bitstream (Processing -> Start Compilation)
|
||||
4. Ensure that there are no severe timing violations by looking into Timing Analyzer report
|
||||
|
||||
NOTE: If the software image (software/sys_controller/mem_init/sys_onchip_memory2_0.hex) was not up to date at the time of compilation, bitstream can be quickly rebuilt with updated hex by running "Processing->Update Memory Initialization File" and "Processing->Start->Start Assembler" in Quartus.
|
||||
|
||||
|
||||
Building software image
|
||||
--------------------------
|
||||
1. Enter software root directory:
|
||||
~~~~
|
||||
cd software/sys_controller
|
||||
~~~~
|
||||
2. Build SW for target configuration:
|
||||
~~~~
|
||||
make [OPTIONS] [TARGET]
|
||||
~~~~
|
||||
OPTIONS may include following definitions:
|
||||
* OSDLANG=JP (Japanese language menu)
|
||||
* ENABLE_AUDIO=y (Includes audio setup code for v1.6 PCB / DIY audio add-on board)
|
||||
|
||||
TARGET is typically one of the following:
|
||||
* all (Default target. Compiles an ELF file)
|
||||
* generate_hex (Generates a memory initialization file required for bitstream and direct download)
|
||||
* clean (cleans ELF and intermediate files. Should be invoked every time OPTIONS are changed between compilations, expect with generate_hex where it is done automatically)
|
||||
|
||||
3. Optionally test updated SW by directly downloading memory image to block RAM via JTAG
|
||||
~~~~
|
||||
make rv-reprogram
|
||||
~~~~
|
||||
|
||||
|
||||
Installing firmware via JTAG
|
||||
--------------------------
|
||||
The bitstream can be either directly programmed into FPGA (volatile method, suitable for quick testing), or into serial flash chip where it is automatically loaded every time FPGA is subsequently powered on (nonvolatile method, suitable for long-term use).
|
||||
|
||||
To program FPGA, open Programmer in Quartus, select your USB Blaster device, add configuration file (output_files/ossc.sof) and press Start
|
||||
|
||||
To program flash, FPGA configuration file must be first converted into JTAG indirect Configuration file (.jic). Open conversion tool ("File->Convert Programming Files") in Quartus, click "Open Conversion Setup Data", select "ossc.cof" and press Generate. Then open Programmer, add generated file (output_files/ossc.jic) and press Start after which flash is programmed. Installed/updated firmware is activated after power-cycling the board.
|
||||
|
||||
|
||||
Generating SD card image
|
||||
--------------------------
|
||||
Bitstream file (Altera propiertary format) must be wrapped with custom header structure (including checksums) so that it can be processed reliably on the CPU. This can be done with included helper application which generates a disk image which can written to a SD card and subsequently loaded on OSSC:
|
||||
|
||||
1. Compile tools/create_fw_img.c
|
||||
~~~~
|
||||
cd tools && gcc create_fw_img.c -o create_fw_img
|
||||
~~~~
|
||||
2. Generate the firmware image:
|
||||
~~~~
|
||||
./create_fw_img <rbf> <version> [version_suffix]
|
||||
~~~~
|
||||
where
|
||||
* \<rbf\> is RBF format bitstream file (typically ../output_files/ossc.rbf)
|
||||
* \<version\> is version string (e.g. 0.78)
|
||||
* \[version_suffix\] is optional max. 8 character suffix name (e.g. "mytest")
|
||||
|
||||
|
||||
Debugging
|
||||
--------------------------
|
||||
1. Rebuild the software in debug mode:
|
||||
~~~~
|
||||
make clean && make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex
|
||||
~~~~
|
||||
NOTE: Fw update functionality via SD card is disabled in debug builds due to code space limitations. If audio support is enabled on debug build, other functionality needs to be disabled as well.
|
||||
|
||||
2. Download memory image via JTAG and open terminal for UART
|
||||
~~~~
|
||||
make rv-reprogram && nios2-terminal
|
||||
~~~~
|
||||
Remember to close nios2-terminal after debug session, otherwise any JTAG transactions will hang/fail.
|
||||
|
|
|
@ -1,611 +0,0 @@
|
|||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
|
||||
`timescale 1ps / 1ps
|
||||
|
||||
module altera_epcq_controller #(
|
||||
parameter CS_WIDTH = 1,
|
||||
parameter ENABLE_4BYTE_ADDR = 1,
|
||||
parameter ADDR_WIDTH = 22,
|
||||
parameter ASI_WIDTH = 1,
|
||||
parameter DEVICE_FAMILY = "CYCLONE V",
|
||||
parameter ASMI_ADDR_WIDTH = 22,
|
||||
parameter CHIP_SELS = 1
|
||||
)(
|
||||
input wire clk,
|
||||
input wire reset_n,
|
||||
|
||||
// ports to access csr
|
||||
input wire avl_csr_write,
|
||||
input wire avl_csr_read,
|
||||
input wire [2:0] avl_csr_addr,
|
||||
input wire [31:0] avl_csr_wrdata,
|
||||
output reg [31:0] avl_csr_rddata,
|
||||
output reg avl_csr_rddata_valid,
|
||||
output reg avl_csr_waitrequest,
|
||||
|
||||
// ports to access memory
|
||||
input wire avl_mem_write,
|
||||
input wire avl_mem_read,
|
||||
input wire [ADDR_WIDTH-1:0] avl_mem_addr,
|
||||
input wire [31:0] avl_mem_wrdata,
|
||||
input wire [3:0] avl_mem_byteenable,
|
||||
input wire [6:0] avl_mem_burstcount,
|
||||
output wire [31:0] avl_mem_rddata,
|
||||
output reg avl_mem_rddata_valid,
|
||||
output reg avl_mem_waitrequest,
|
||||
|
||||
// interrupt signal
|
||||
output reg irq,
|
||||
|
||||
// Disable dedicated active serial interface
|
||||
input wire [ASI_WIDTH-1:0] epcq_dataout,
|
||||
output reg epcq_dclk,
|
||||
output reg [CS_WIDTH-1:0] epcq_scein,
|
||||
output reg [ASI_WIDTH-1:0] epcq_sdoin,
|
||||
output reg [ASI_WIDTH-1:0] epcq_dataoe,
|
||||
|
||||
// ASMI PARALLEL interface
|
||||
input wire [ASI_WIDTH-1:0] ddasi_dataoe,
|
||||
output reg [ASI_WIDTH-1:0] ddasi_dataout,
|
||||
input wire ddasi_dclk,
|
||||
input wire [CS_WIDTH-1:0] ddasi_scein,
|
||||
input reg [ASI_WIDTH-1:0] ddasi_sdoin,
|
||||
|
||||
input wire asmi_busy,
|
||||
input wire asmi_data_valid,
|
||||
input wire [7:0] asmi_dataout,
|
||||
output reg asmi_clkin,
|
||||
output reg asmi_reset,
|
||||
output reg [CS_WIDTH-1:0] asmi_sce,
|
||||
output reg [ASMI_ADDR_WIDTH-1:0] asmi_addr,
|
||||
output reg [7:0] asmi_datain,
|
||||
output reg asmi_fast_read,
|
||||
output wire asmi_rden,
|
||||
output reg asmi_shift_bytes,
|
||||
output reg asmi_en4b_addr,
|
||||
output wire asmi_wren,
|
||||
output reg asmi_write,
|
||||
|
||||
input wire asmi_illegal_erase,
|
||||
input wire asmi_illegal_write,
|
||||
input wire [7:0] asmi_rdid_out,
|
||||
input wire [7:0] asmi_status_out,
|
||||
input wire [7:0] asmi_epcs_id,
|
||||
output reg asmi_read_rdid,
|
||||
output reg asmi_read_status,
|
||||
output reg asmi_read_sid,
|
||||
output reg asmi_bulk_erase,
|
||||
output reg asmi_sector_erase,
|
||||
output reg asmi_sector_protect
|
||||
);
|
||||
localparam LOCAL_ADDR_WIDTH = ADDR_WIDTH+2;
|
||||
localparam CSR_DATA_WIDTH = 32;
|
||||
localparam LAST_ADDR_BIT = (ASMI_ADDR_WIDTH == 24) ? 15 :
|
||||
(ASMI_ADDR_WIDTH == 32) ? 23 : 15;
|
||||
|
||||
reg [8:0] wr_burstcount_cnt, rd_burstcount_cnt;
|
||||
reg [8:0] rd_mem_burstcount, wr_mem_burstcount;
|
||||
|
||||
wire last_wr_byte;
|
||||
wire access_csr_status, access_csr_sid, access_csr_rdid, access_csr_mem_op, access_isr, access_imr, access_sce;
|
||||
wire read_status_combi, read_sid_combi, read_rdid_combi, read_isr_combi, read_imr_combi, write_isr_combi, write_imr_combi, write_sce_combi;
|
||||
wire bulk_erase_combi, sector_erase_combi, sector_protect_combi;
|
||||
wire wren_combi, illegal_write_combi, illegal_erase_combi;
|
||||
wire m_illegal_write_combi, m_illegal_erase_combi;
|
||||
wire read_mem_combi, write_mem_combi;
|
||||
wire data_valid_combi, pending_wr_data;
|
||||
wire detect_addroffset;
|
||||
wire [8:0] wfifo_data_in_0, wfifo_data_in_1, wfifo_data_in_2, wfifo_data_in_3;
|
||||
wire [ADDR_WIDTH-1:0] temp_mem_addr;
|
||||
|
||||
reg reset_n_reg;
|
||||
reg wr_mem_waitrequest, local_waitrequest;
|
||||
reg illegal_write_reg, illegal_erase_reg, m_illegal_write_reg, m_illegal_erase_reg;
|
||||
reg read_status_valid, read_sid_valid, read_rdid_valid, read_isr_valid, read_imr_valid;
|
||||
reg read_status_en, read_sid_en, read_rdid_en;
|
||||
reg wren_internal;
|
||||
reg [LOCAL_ADDR_WIDTH-1:0] wr_mem_addr;
|
||||
reg [7:0] rd_data_reg [4];
|
||||
reg [3:0][8:0] wr_data_reg;
|
||||
reg [1:0] rd_cnt;
|
||||
reg [1:0] wr_cnt;
|
||||
reg [3:0] wr_data_reg_full;
|
||||
reg detect_addroffset_reg, asmi_busy_reg;
|
||||
reg [2:0] temp_sce;
|
||||
|
||||
// Direct connection
|
||||
assign asmi_clkin = clk;
|
||||
assign asmi_reset = ~reset_n;
|
||||
assign ddasi_dataout = epcq_dataout;
|
||||
assign epcq_dclk = ddasi_dclk;
|
||||
assign epcq_scein = ddasi_scein;
|
||||
assign epcq_sdoin = ddasi_sdoin;
|
||||
assign epcq_dataoe = ddasi_dataoe;
|
||||
|
||||
// chip select
|
||||
generate if (DEVICE_FAMILY == "Arria 10") begin
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
asmi_sce <= {CS_WIDTH{1'b0}};
|
||||
end
|
||||
// to pack the address space this is needed
|
||||
else if (write_mem_combi || read_mem_combi) begin
|
||||
if (CHIP_SELS == 1 )
|
||||
asmi_sce <= 3'b001;
|
||||
else if (CHIP_SELS == 2 && avl_mem_addr[ADDR_WIDTH-1] == 0)
|
||||
asmi_sce <= 3'b001;
|
||||
else if (CHIP_SELS == 2 && avl_mem_addr[ADDR_WIDTH-1] == 1)
|
||||
asmi_sce <= 3'b010;
|
||||
else if (CHIP_SELS == 3 && avl_mem_addr[ADDR_WIDTH-1] == 1)
|
||||
asmi_sce <= 3'b100;
|
||||
else if (CHIP_SELS == 3 && avl_mem_addr[ADDR_WIDTH-1:ADDR_WIDTH-2] == 0)
|
||||
asmi_sce <= 3'b001;
|
||||
else if (CHIP_SELS == 3 && avl_mem_addr[ADDR_WIDTH-1:ADDR_WIDTH-2] == 1)
|
||||
asmi_sce <= 3'b010;
|
||||
else
|
||||
asmi_sce <= {CS_WIDTH{1'b0}};
|
||||
end
|
||||
else if (write_sce_combi) begin
|
||||
asmi_sce <= avl_csr_wrdata[2:0];
|
||||
end
|
||||
else if (asmi_en4b_addr) begin
|
||||
asmi_sce <= temp_sce;
|
||||
end
|
||||
end
|
||||
// decoder ring if the CHIP_SEL is only 1 then avalon address is the temp address
|
||||
// if the chipsele is 2 then need to remove top address bit
|
||||
// if the chipelect is 3 then remove the top 2 address bits.
|
||||
assign temp_mem_addr = CHIP_SELS == 1 ? avl_mem_addr:( CHIP_SELS == 2 ? {1'b0,avl_mem_addr[ADDR_WIDTH-2:0]}:{2'b00,avl_mem_addr[ADDR_WIDTH-3:0]});
|
||||
end
|
||||
else begin
|
||||
always @(posedge clk) begin
|
||||
asmi_sce <= {CS_WIDTH{1'b0}};
|
||||
end
|
||||
assign temp_mem_addr = avl_mem_addr;
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// wait_request generation logic
|
||||
assign avl_mem_waitrequest = (asmi_busy || asmi_busy_reg) ? 1'b1 : (local_waitrequest || wr_mem_waitrequest);
|
||||
assign avl_csr_waitrequest = (asmi_busy || asmi_busy_reg) ? 1'b1 : (local_waitrequest || wr_mem_waitrequest);
|
||||
|
||||
// access CSR decoding logic
|
||||
assign access_csr_status = (avl_csr_addr == 3'b000);
|
||||
assign access_csr_sid = (avl_csr_addr == 3'b001);
|
||||
assign access_csr_rdid = (avl_csr_addr == 3'b010);
|
||||
assign access_csr_mem_op = (avl_csr_addr == 3'b011);
|
||||
assign access_isr = (avl_csr_addr == 3'b100);
|
||||
assign access_imr = (avl_csr_addr == 3'b101);
|
||||
assign access_sce = (avl_csr_addr == 3'b110);
|
||||
|
||||
// read/write memory combi logic
|
||||
assign read_mem_combi = (avl_mem_read && ~avl_mem_waitrequest);
|
||||
assign write_mem_combi = (avl_mem_write && ~avl_mem_waitrequest);
|
||||
|
||||
// read csr logic
|
||||
assign read_status_combi = (avl_csr_read && access_csr_status && ~avl_csr_waitrequest);
|
||||
assign read_sid_combi = (avl_csr_read && access_csr_sid && ~avl_csr_waitrequest);
|
||||
assign read_rdid_combi = (avl_csr_read && access_csr_rdid && ~avl_csr_waitrequest);
|
||||
assign read_isr_combi = (avl_csr_read && access_isr && ~avl_csr_waitrequest);
|
||||
assign read_imr_combi = (avl_csr_read && access_imr && ~avl_csr_waitrequest);
|
||||
assign write_isr_combi = (avl_csr_write && access_isr && ~avl_csr_waitrequest);
|
||||
assign write_imr_combi = (avl_csr_write && access_imr && ~avl_csr_waitrequest);
|
||||
assign write_sce_combi = (avl_csr_write && access_sce && ~avl_csr_waitrequest);
|
||||
|
||||
// write csr logic
|
||||
assign bulk_erase_combi = (avl_csr_write && access_csr_mem_op && ~avl_csr_waitrequest && avl_csr_wrdata[1:0] == 2'b01);
|
||||
assign sector_erase_combi = (avl_csr_write && access_csr_mem_op && ~avl_csr_waitrequest && avl_csr_wrdata[1:0] == 2'b10);
|
||||
assign sector_protect_combi = (avl_csr_write && access_csr_mem_op && ~avl_csr_waitrequest && avl_csr_wrdata[1:0] == 2'b11);
|
||||
assign illegal_write_combi = (asmi_illegal_write) ? 1'b1 :
|
||||
(write_isr_combi && avl_csr_wrdata[1]) ? 1'b0 :
|
||||
illegal_write_reg;
|
||||
assign illegal_erase_combi = (asmi_illegal_erase) ? 1'b1 :
|
||||
(write_isr_combi && avl_csr_wrdata[0]) ? 1'b0 :
|
||||
illegal_erase_reg;
|
||||
assign m_illegal_write_combi= (write_imr_combi) ? avl_csr_wrdata[1] : m_illegal_write_reg;
|
||||
assign m_illegal_erase_combi= (write_imr_combi) ? avl_csr_wrdata[0] : m_illegal_erase_reg;
|
||||
assign wren_combi = (sector_protect_combi || sector_erase_combi || bulk_erase_combi);
|
||||
|
||||
assign asmi_rden = (rd_burstcount_cnt > 9'd0); // deasserted at the last 2 byte - refer to ASMI_PARALLEL UG
|
||||
|
||||
// interrupt signal
|
||||
assign irq = (illegal_write_reg && m_illegal_write_reg) || (illegal_erase_reg && m_illegal_erase_reg);
|
||||
|
||||
assign last_wr_byte = (wr_burstcount_cnt == wr_mem_burstcount - 9'd1) ? 1'b1 : 1'b0;
|
||||
|
||||
assign asmi_wren = wren_internal || asmi_en4b_addr || asmi_shift_bytes || asmi_write;
|
||||
|
||||
assign data_valid_combi = (rd_burstcount_cnt[1:0] == 2'b00) ? asmi_data_valid : 1'b0;
|
||||
|
||||
assign wfifo_data_in_0 = {avl_mem_byteenable[0], avl_mem_wrdata[7:0] };
|
||||
assign wfifo_data_in_1 = {avl_mem_byteenable[1], avl_mem_wrdata[15:8] };
|
||||
assign wfifo_data_in_2 = {avl_mem_byteenable[2], avl_mem_wrdata[23:16] };
|
||||
assign wfifo_data_in_3 = {avl_mem_byteenable[3], avl_mem_wrdata[31:24] };
|
||||
|
||||
assign avl_mem_rddata = {rd_data_reg[3], rd_data_reg[2], rd_data_reg[1], rd_data_reg[0]};
|
||||
assign pending_wr_data = (|wr_data_reg_full) ? 1'b1 : 1'b0;
|
||||
assign detect_addroffset = (pending_wr_data && wr_data_reg[wr_cnt][8]) ? 1'b1 :
|
||||
(wr_burstcount_cnt == {9{1'b0}}) ? 1'b0 : detect_addroffset_reg;
|
||||
|
||||
//-------------------------------- array to store write data -------------------------------------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
wr_data_reg <= '{{9{1'b0}}, {9{1'b0}}, {9{1'b0}}, {9{1'b0}}};
|
||||
wr_data_reg_full <= {4{1'b0}};
|
||||
end
|
||||
else if (write_mem_combi) begin
|
||||
wr_data_reg <= {wfifo_data_in_3, wfifo_data_in_2, wfifo_data_in_1, wfifo_data_in_0};
|
||||
wr_data_reg_full <= {4{1'b1}};
|
||||
end
|
||||
else if (wr_data_reg_full > 4'b0000) begin
|
||||
wr_data_reg_full <= wr_data_reg_full << 1;
|
||||
end
|
||||
end
|
||||
|
||||
//-------------------------------- array to store read data -------------------------------------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
rd_data_reg <= '{{8{1'b0}}, {8{1'b0}}, {8{1'b0}}, {8{1'b0}}};
|
||||
rd_cnt <= {2{1'b0}};
|
||||
end
|
||||
else if (asmi_data_valid) begin
|
||||
rd_data_reg[rd_cnt] <= asmi_dataout;
|
||||
rd_cnt <= rd_cnt + 2'b01;
|
||||
end
|
||||
end
|
||||
|
||||
//------------------------------- Enable 4-byte addressing out of reset ----------------------
|
||||
generate
|
||||
if (ENABLE_4BYTE_ADDR) begin
|
||||
typedef enum logic[1:0] {EN4B_CHIP1, EN4B_CHIP2, EN4B_CHIP3, IDLE} state_t;
|
||||
state_t state;
|
||||
|
||||
always @(posedge clk or negedge reset_n_reg) begin // use reset_n_reg because user is allow to send cmd to ASMI_PARALLEL 2 clock cycles after reset
|
||||
if (~reset_n_reg) begin
|
||||
state <= EN4B_CHIP1;
|
||||
asmi_en4b_addr <= 1'b1;
|
||||
temp_sce <= 3'b001;
|
||||
end
|
||||
else begin
|
||||
case (state)
|
||||
EN4B_CHIP1 : begin
|
||||
asmi_en4b_addr <= 1'b1;
|
||||
if (~asmi_busy) begin
|
||||
if (CHIP_SELS > 1) begin
|
||||
state <= EN4B_CHIP2;
|
||||
temp_sce <= 3'b010;
|
||||
end
|
||||
else begin
|
||||
state <= IDLE;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
end
|
||||
end
|
||||
EN4B_CHIP2 : begin
|
||||
asmi_en4b_addr <= 1'b1;
|
||||
if (~asmi_busy) begin
|
||||
if (CHIP_SELS > 2) begin
|
||||
state <= EN4B_CHIP3;
|
||||
temp_sce <= 3'b100;
|
||||
end
|
||||
else begin
|
||||
state <= IDLE;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
end
|
||||
end
|
||||
EN4B_CHIP3 : begin
|
||||
asmi_en4b_addr <= 1'b1;
|
||||
if (~asmi_busy) begin
|
||||
state <= IDLE;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
end
|
||||
IDLE : begin
|
||||
asmi_en4b_addr <= 1'b0;
|
||||
state <= IDLE;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
default : begin
|
||||
asmi_en4b_addr <= 1'b0;
|
||||
state <= IDLE;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
end
|
||||
end
|
||||
else begin
|
||||
always @(posedge clk) begin
|
||||
asmi_en4b_addr <= 1'b0;
|
||||
temp_sce <= 3'b000;
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
//--------------------------------------- Waitrequest logic ----------------------------------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
wr_mem_waitrequest <= 1'b0;
|
||||
local_waitrequest <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
if (read_mem_combi || read_status_combi || read_sid_combi || read_rdid_combi || bulk_erase_combi || sector_erase_combi || sector_protect_combi || asmi_en4b_addr) begin // no back pressure during imr & isr access
|
||||
local_waitrequest <= 1'b1;
|
||||
end
|
||||
else if (asmi_busy_reg && ~asmi_busy) begin
|
||||
local_waitrequest <= 1'b0;
|
||||
end
|
||||
|
||||
if (write_mem_combi) begin
|
||||
wr_mem_waitrequest <= 1'b1;
|
||||
end
|
||||
else if ((~pending_wr_data && ~asmi_write) || asmi_busy_reg && ~asmi_busy) begin
|
||||
wr_mem_waitrequest <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// -------------------------------------- MEM ACCESS -----------------------------------------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
rd_mem_burstcount <= {9{1'b0}};
|
||||
wr_mem_burstcount <= {9{1'b0}};
|
||||
wr_mem_addr <= {LOCAL_ADDR_WIDTH{1'b0}};
|
||||
end
|
||||
else begin
|
||||
if (read_mem_combi) begin
|
||||
rd_mem_burstcount <= {avl_mem_burstcount, 2'b00};
|
||||
end
|
||||
if (write_mem_combi && (wr_burstcount_cnt == {9{1'b0}})) begin
|
||||
wr_mem_addr <= {temp_mem_addr, 2'b00};
|
||||
wr_mem_burstcount <= {avl_mem_burstcount, 2'b00};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
wr_burstcount_cnt <= {9{1'b0}};
|
||||
end
|
||||
else begin
|
||||
if (pending_wr_data) begin
|
||||
wr_burstcount_cnt <= wr_burstcount_cnt + 9'd1;
|
||||
end
|
||||
else if (wr_burstcount_cnt == wr_mem_burstcount) begin
|
||||
wr_burstcount_cnt <= {9{1'b0}};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
rd_burstcount_cnt <= {9{1'b0}};
|
||||
end
|
||||
else begin
|
||||
if (read_mem_combi) begin
|
||||
rd_burstcount_cnt <= 9'd1;
|
||||
end
|
||||
else if (rd_burstcount_cnt == rd_mem_burstcount) begin // each rd 4 burst
|
||||
rd_burstcount_cnt <= {9{1'b0}};
|
||||
end
|
||||
else if (asmi_data_valid && rd_burstcount_cnt > 0) begin
|
||||
rd_burstcount_cnt <= rd_burstcount_cnt + 9'd1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
asmi_addr <= {ASMI_ADDR_WIDTH{1'b0}};
|
||||
end
|
||||
else begin
|
||||
if (sector_erase_combi) begin // set lower 16 bits to zero so that erase at starting address of each sector
|
||||
asmi_addr <= {avl_csr_wrdata[LAST_ADDR_BIT : 8], {16{1'b0}}};
|
||||
end
|
||||
if (read_mem_combi) begin
|
||||
asmi_addr <= {temp_mem_addr, 2'b00};
|
||||
end
|
||||
|
||||
if (detect_addroffset && ~detect_addroffset_reg) begin
|
||||
asmi_addr <= wr_mem_addr + {{LOCAL_ADDR_WIDTH-9{1'b0}}, wr_burstcount_cnt};
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
asmi_datain <= {8{1'b0}};
|
||||
wr_cnt <= {2{1'b0}};
|
||||
asmi_shift_bytes <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
if (sector_protect_combi) begin
|
||||
asmi_datain <= {{1{1'b0}}, avl_csr_wrdata[11], avl_csr_wrdata[12], avl_csr_wrdata[10:8], {2{1'b0}}}; // BP3, TB, BP2, BP1, BP0
|
||||
end
|
||||
if (pending_wr_data) begin
|
||||
asmi_datain <= wr_data_reg[wr_cnt][7:0];
|
||||
wr_cnt <= wr_cnt + 2'd1;
|
||||
end
|
||||
if (pending_wr_data && wr_data_reg[wr_cnt][8]) begin
|
||||
asmi_shift_bytes <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
asmi_shift_bytes <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
asmi_read_status <= 1'b0;
|
||||
asmi_read_sid <= 1'b0;
|
||||
asmi_read_rdid <= 1'b0;
|
||||
asmi_bulk_erase <= 1'b0;
|
||||
asmi_sector_erase <= 1'b0;
|
||||
asmi_sector_protect <= 1'b0;
|
||||
wren_internal <= 1'b0;
|
||||
asmi_write <= 1'b0;
|
||||
asmi_fast_read <= 1'b0;
|
||||
asmi_busy_reg <= 1'b0;
|
||||
avl_mem_rddata_valid <= 1'b0;
|
||||
detect_addroffset_reg <= 1'b0;
|
||||
reset_n_reg <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
asmi_read_status <= read_status_combi;
|
||||
asmi_read_sid <= read_sid_combi;
|
||||
asmi_read_rdid <= read_rdid_combi;
|
||||
asmi_bulk_erase <= bulk_erase_combi;
|
||||
asmi_sector_erase <= sector_erase_combi;
|
||||
asmi_sector_protect <= sector_protect_combi;
|
||||
wren_internal <= wren_combi;
|
||||
asmi_write <= last_wr_byte;
|
||||
asmi_fast_read <= read_mem_combi;
|
||||
asmi_busy_reg <= asmi_busy;
|
||||
avl_mem_rddata_valid <= data_valid_combi;
|
||||
detect_addroffset_reg <= detect_addroffset;
|
||||
reset_n_reg <= 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
// --------------------------------------------- CSR ACCESS -------------------------------------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
illegal_write_reg <= 1'b0;
|
||||
illegal_erase_reg <= 1'b0;
|
||||
m_illegal_write_reg <= 1'b0;
|
||||
m_illegal_erase_reg <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
illegal_write_reg <= illegal_write_combi;
|
||||
illegal_erase_reg <= illegal_erase_combi;
|
||||
m_illegal_write_reg <= m_illegal_write_combi;
|
||||
m_illegal_erase_reg <= m_illegal_erase_combi;
|
||||
end
|
||||
end
|
||||
|
||||
// csr read only registers enable logic
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
read_status_en <= 1'b0;
|
||||
read_sid_en <= 1'b0;
|
||||
read_rdid_en <= 1'b0;
|
||||
end
|
||||
else if (asmi_read_status) begin
|
||||
read_status_en <= 1'b1;
|
||||
end
|
||||
else if (asmi_read_sid) begin
|
||||
read_sid_en <= 1'b1;
|
||||
end
|
||||
else if (asmi_read_rdid) begin
|
||||
read_rdid_en <= 1'b1;
|
||||
end
|
||||
else if (asmi_busy == 0) begin
|
||||
read_status_en <= 1'b0;
|
||||
read_sid_en <= 1'b0;
|
||||
read_rdid_en <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
// generation logic for avl csr read data valid
|
||||
assign avl_csr_rddata_valid = read_status_valid || read_sid_valid || read_rdid_valid || read_isr_valid || read_imr_valid;
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
read_status_valid <= 1'b0;
|
||||
read_sid_valid <= 1'b0;
|
||||
read_rdid_valid <= 1'b0;
|
||||
read_isr_valid <= 1'b0;
|
||||
read_imr_valid <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
if (read_status_en && asmi_busy == 0) begin
|
||||
read_status_valid <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
read_status_valid <= 1'b0;
|
||||
end
|
||||
|
||||
if (read_sid_en && asmi_busy == 0) begin
|
||||
read_sid_valid <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
read_sid_valid <= 1'b0;
|
||||
end
|
||||
|
||||
if (read_rdid_en && asmi_busy == 0) begin
|
||||
read_rdid_valid <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
read_rdid_valid <= 1'b0;
|
||||
end
|
||||
|
||||
if (read_isr_combi) begin
|
||||
read_isr_valid <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
read_isr_valid <= 1'b0;
|
||||
end
|
||||
|
||||
if (read_imr_combi) begin
|
||||
read_imr_valid <= 1'b1;
|
||||
end
|
||||
else begin
|
||||
read_imr_valid <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// generation logic for avl csr read data
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
avl_csr_rddata <= {CSR_DATA_WIDTH{1'b0}};
|
||||
end
|
||||
else begin
|
||||
if (read_status_en && asmi_busy == 0) begin
|
||||
avl_csr_rddata <= {{CSR_DATA_WIDTH-8{1'b0}}, asmi_status_out};
|
||||
end
|
||||
if (read_sid_en && asmi_busy == 0) begin
|
||||
avl_csr_rddata <= {{CSR_DATA_WIDTH-8{1'b0}}, asmi_epcs_id};
|
||||
end
|
||||
if (read_rdid_en && asmi_busy == 0) begin
|
||||
avl_csr_rddata <= {{CSR_DATA_WIDTH-8{1'b0}}, asmi_rdid_out};
|
||||
end
|
||||
if (read_isr_combi) begin
|
||||
avl_csr_rddata <= {{CSR_DATA_WIDTH-2{1'b0}}, illegal_write_reg, illegal_erase_reg};
|
||||
end
|
||||
if (read_imr_combi) begin
|
||||
avl_csr_rddata <= {{CSR_DATA_WIDTH-2{1'b0}}, m_illegal_write_reg, m_illegal_erase_reg};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,230 +0,0 @@
|
|||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// (C) 2001-2014 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
`timescale 1ps / 1ps
|
||||
|
||||
module altera_epcq_controller_arb #(
|
||||
parameter CS_WIDTH = 1,
|
||||
parameter ENABLE_4BYTE_ADDR = 1,
|
||||
parameter ADDR_WIDTH = 22,
|
||||
parameter ASI_WIDTH = 1,
|
||||
parameter DEVICE_FAMILY = "CYCLONE V",
|
||||
parameter ASMI_ADDR_WIDTH = 22,
|
||||
parameter CHIP_SELS = 1
|
||||
)(
|
||||
input wire clk,
|
||||
input wire reset_n,
|
||||
|
||||
// ports to access csr
|
||||
input wire avl_csr_write,
|
||||
input wire avl_csr_read,
|
||||
input wire [2:0] avl_csr_addr,
|
||||
input wire [31:0] avl_csr_wrdata,
|
||||
output reg [31:0] avl_csr_rddata,
|
||||
output reg avl_csr_rddata_valid,
|
||||
output reg avl_csr_waitrequest,
|
||||
|
||||
// ports to access memory
|
||||
input wire avl_mem_write,
|
||||
input wire avl_mem_read,
|
||||
input wire [ADDR_WIDTH-1:0] avl_mem_addr,
|
||||
input wire [31:0] avl_mem_wrdata,
|
||||
input wire [3:0] avl_mem_byteenable,
|
||||
input wire [6:0] avl_mem_burstcount,
|
||||
output wire [31:0] avl_mem_rddata,
|
||||
output reg avl_mem_rddata_valid,
|
||||
output reg avl_mem_waitrequest,
|
||||
|
||||
// interrupt signal
|
||||
output reg irq,
|
||||
|
||||
// Disable dedicated active serial interface
|
||||
input wire [ASI_WIDTH-1:0] epcq_dataout,
|
||||
output reg epcq_dclk,
|
||||
output reg [CS_WIDTH-1:0] epcq_scein,
|
||||
output reg [ASI_WIDTH-1:0] epcq_sdoin,
|
||||
output reg [ASI_WIDTH-1:0] epcq_dataoe,
|
||||
|
||||
// ASMI PARALLEL interface
|
||||
input wire [ASI_WIDTH-1:0] ddasi_dataoe,
|
||||
output reg [ASI_WIDTH-1:0] ddasi_dataout,
|
||||
input wire ddasi_dclk,
|
||||
input wire [CS_WIDTH-1:0] ddasi_scein,
|
||||
input reg [ASI_WIDTH-1:0] ddasi_sdoin,
|
||||
|
||||
input wire asmi_busy,
|
||||
input wire asmi_data_valid,
|
||||
input wire [7:0] asmi_dataout,
|
||||
output reg asmi_clkin,
|
||||
output reg asmi_reset,
|
||||
output reg [CS_WIDTH-1:0] asmi_sce,
|
||||
output reg [ASMI_ADDR_WIDTH-1:0] asmi_addr,
|
||||
output reg [7:0] asmi_datain,
|
||||
output reg asmi_fast_read,
|
||||
output wire asmi_rden,
|
||||
output reg asmi_shift_bytes,
|
||||
output reg asmi_en4b_addr,
|
||||
output wire asmi_wren,
|
||||
output reg asmi_write,
|
||||
|
||||
input wire asmi_illegal_erase,
|
||||
input wire asmi_illegal_write,
|
||||
input wire [7:0] asmi_rdid_out,
|
||||
input wire [7:0] asmi_status_out,
|
||||
input wire [7:0] asmi_epcs_id,
|
||||
output reg asmi_read_rdid,
|
||||
output reg asmi_read_status,
|
||||
output reg asmi_read_sid,
|
||||
output reg asmi_bulk_erase,
|
||||
output reg asmi_sector_erase,
|
||||
output reg asmi_sector_protect
|
||||
);
|
||||
|
||||
reg temp_mem_write, temp_mem_read, mem_write, mem_read, back_pressured_ctrl;
|
||||
reg [ADDR_WIDTH-1:0] temp_mem_addr, mem_addr;
|
||||
reg [31:0] temp_mem_wrdata, mem_wrdata;
|
||||
reg [3:0] temp_mem_byteenable, mem_byteenable;
|
||||
reg [6:0] temp_mem_burstcount, mem_burstcount;
|
||||
|
||||
wire back_pressured, temp_csr_waitrequest, temp_mem_waitrequest;
|
||||
|
||||
//-------------------- Arbitration logic between avalon csr and mem interface -----------
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
back_pressured_ctrl <= 1'b0;
|
||||
end
|
||||
else if (back_pressured) begin
|
||||
back_pressured_ctrl <= 1'b1;
|
||||
end
|
||||
else if (~temp_csr_waitrequest) begin
|
||||
back_pressured_ctrl <= 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk or negedge reset_n) begin
|
||||
if (~reset_n) begin
|
||||
mem_write <= 1'b0;
|
||||
mem_read <= 1'b0;
|
||||
mem_addr <= {ADDR_WIDTH{1'b0}};
|
||||
mem_wrdata <= {32{1'b0}};
|
||||
mem_byteenable <= {4{1'b0}};
|
||||
mem_burstcount <= {7{1'b0}};
|
||||
end
|
||||
else if ((avl_csr_write || avl_csr_read) && ~avl_csr_waitrequest && (avl_mem_write || avl_mem_read) && ~avl_mem_waitrequest) begin
|
||||
// to back pressure master
|
||||
mem_write <= avl_mem_write;
|
||||
mem_read <= avl_mem_read;
|
||||
mem_addr <= avl_mem_addr;
|
||||
mem_wrdata <= avl_mem_wrdata;
|
||||
mem_byteenable <= avl_mem_byteenable;
|
||||
mem_burstcount <= avl_mem_burstcount;
|
||||
end
|
||||
end
|
||||
|
||||
assign back_pressured = ((avl_csr_write || avl_csr_read) && ~temp_csr_waitrequest && (avl_mem_write || avl_mem_read)) ? 1'b1 : 1'b0; // to back pressure controller
|
||||
assign avl_csr_waitrequest = (~avl_csr_write && ~avl_csr_read && back_pressured_ctrl) ? 1'b1 : temp_csr_waitrequest;
|
||||
assign avl_mem_waitrequest = (back_pressured_ctrl) ? 1'b1 : temp_mem_waitrequest;
|
||||
assign temp_mem_write = (back_pressured) ? 1'b0 :
|
||||
(back_pressured_ctrl) ? mem_write : avl_mem_write;
|
||||
assign temp_mem_read = (back_pressured) ? 1'b0 :
|
||||
(back_pressured_ctrl) ? mem_read : avl_mem_read;
|
||||
assign temp_mem_addr = (back_pressured) ? {ADDR_WIDTH{1'b0}} :
|
||||
(back_pressured_ctrl) ? mem_addr : avl_mem_addr;
|
||||
assign temp_mem_wrdata = (back_pressured) ? {32{1'b0}} :
|
||||
(back_pressured_ctrl) ? mem_wrdata : avl_mem_wrdata;
|
||||
assign temp_mem_byteenable = (back_pressured) ? {4{1'b0}} :
|
||||
(back_pressured_ctrl) ? mem_byteenable : avl_mem_byteenable;
|
||||
assign temp_mem_burstcount = (back_pressured) ? {7{1'b0}} :
|
||||
(back_pressured_ctrl) ? mem_burstcount : avl_mem_burstcount;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------//
|
||||
|
||||
altera_epcq_controller #(
|
||||
.CS_WIDTH (CS_WIDTH),
|
||||
.DEVICE_FAMILY (DEVICE_FAMILY),
|
||||
.ADDR_WIDTH (ADDR_WIDTH),
|
||||
.ASMI_ADDR_WIDTH (ASMI_ADDR_WIDTH),
|
||||
.ASI_WIDTH (ASI_WIDTH),
|
||||
.CHIP_SELS (CHIP_SELS),
|
||||
.ENABLE_4BYTE_ADDR (ENABLE_4BYTE_ADDR)
|
||||
) controller (
|
||||
.clk (clk),
|
||||
.reset_n (reset_n),
|
||||
.avl_csr_read (avl_csr_read),
|
||||
.avl_csr_waitrequest (temp_csr_waitrequest),
|
||||
.avl_csr_write (avl_csr_write),
|
||||
.avl_csr_addr (avl_csr_addr),
|
||||
.avl_csr_wrdata (avl_csr_wrdata),
|
||||
.avl_csr_rddata (avl_csr_rddata),
|
||||
.avl_csr_rddata_valid (avl_csr_rddata_valid),
|
||||
.avl_mem_write (temp_mem_write),
|
||||
.avl_mem_burstcount (temp_mem_burstcount),
|
||||
.avl_mem_waitrequest (temp_mem_waitrequest),
|
||||
.avl_mem_read (temp_mem_read),
|
||||
.avl_mem_addr (temp_mem_addr),
|
||||
.avl_mem_wrdata (temp_mem_wrdata),
|
||||
.avl_mem_byteenable (temp_mem_byteenable),
|
||||
.avl_mem_rddata (avl_mem_rddata),
|
||||
.avl_mem_rddata_valid (avl_mem_rddata_valid),
|
||||
.asmi_status_out (asmi_status_out),
|
||||
.asmi_epcs_id (asmi_epcs_id),
|
||||
.asmi_illegal_erase (asmi_illegal_erase),
|
||||
.asmi_illegal_write (asmi_illegal_write),
|
||||
.ddasi_dataoe (ddasi_dataoe),
|
||||
.ddasi_dclk (ddasi_dclk),
|
||||
.ddasi_scein (ddasi_scein),
|
||||
.ddasi_sdoin (ddasi_sdoin),
|
||||
.asmi_busy (asmi_busy),
|
||||
.asmi_data_valid (asmi_data_valid),
|
||||
.asmi_dataout (asmi_dataout),
|
||||
.epcq_dataout (epcq_dataout),
|
||||
.ddasi_dataout (ddasi_dataout),
|
||||
.asmi_read_rdid (asmi_read_rdid),
|
||||
.asmi_read_status (asmi_read_status),
|
||||
.asmi_read_sid (asmi_read_sid),
|
||||
.asmi_bulk_erase (asmi_bulk_erase),
|
||||
.asmi_sector_erase (asmi_sector_erase),
|
||||
.asmi_sector_protect (asmi_sector_protect),
|
||||
.epcq_dclk (epcq_dclk),
|
||||
.epcq_scein (epcq_scein),
|
||||
.epcq_sdoin (epcq_sdoin),
|
||||
.epcq_dataoe (epcq_dataoe),
|
||||
.asmi_clkin (asmi_clkin),
|
||||
.asmi_reset (asmi_reset),
|
||||
.asmi_sce (asmi_sce),
|
||||
.asmi_addr (asmi_addr),
|
||||
.asmi_datain (asmi_datain),
|
||||
.asmi_fast_read (asmi_fast_read),
|
||||
.asmi_rden (asmi_rden),
|
||||
.asmi_shift_bytes (asmi_shift_bytes),
|
||||
.asmi_wren (asmi_wren),
|
||||
.asmi_write (asmi_write),
|
||||
.asmi_rdid_out (asmi_rdid_out),
|
||||
.asmi_en4b_addr (asmi_en4b_addr),
|
||||
.irq (irq)
|
||||
);
|
||||
|
||||
endmodule
|
|
@ -1,176 +0,0 @@
|
|||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
// megafunction wizard: %FIFO%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: scfifo
|
||||
|
||||
// ============================================================
|
||||
// File Name: altera_epcq_controller_fifo.v
|
||||
// Megafunction Name(s):
|
||||
// scfifo
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// altera_mf
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 14.1.0 Internal Build 64 05/14/2014 PN Full Version
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 1991-2014 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and its AMPP partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
//the Altera MegaCore Function License Agreement, or other
|
||||
//applicable license agreement, including, without limitation,
|
||||
//that your use is for the sole purpose of programming logic
|
||||
//devices manufactured by Altera and sold by Altera or its
|
||||
//authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module altera_epcq_controller_fifo #(
|
||||
parameter DEVICE_FAMILY = "CYCLONE V",
|
||||
parameter MEMORY_TYPE = "RAM_BLOCK_TYPE=MLAB"
|
||||
)(
|
||||
clock,
|
||||
data,
|
||||
rdreq,
|
||||
wrreq,
|
||||
empty,
|
||||
full,
|
||||
q);
|
||||
|
||||
input clock;
|
||||
input [35:0] data;
|
||||
input rdreq;
|
||||
input wrreq;
|
||||
output empty;
|
||||
output full;
|
||||
output [35:0] q;
|
||||
|
||||
wire sub_wire0;
|
||||
wire sub_wire1;
|
||||
wire [35:0] sub_wire2;
|
||||
wire empty = sub_wire0;
|
||||
wire full = sub_wire1;
|
||||
wire [35:0] q = sub_wire2[35:0];
|
||||
|
||||
scfifo scfifo_component (
|
||||
.clock (clock),
|
||||
.data (data),
|
||||
.rdreq (rdreq),
|
||||
.wrreq (wrreq),
|
||||
.empty (sub_wire0),
|
||||
.full (sub_wire1),
|
||||
.q (sub_wire2),
|
||||
.aclr (),
|
||||
.almost_empty (),
|
||||
.almost_full (),
|
||||
.sclr (),
|
||||
.usedw ());
|
||||
defparam
|
||||
scfifo_component.add_ram_output_register = "OFF",
|
||||
scfifo_component.intended_device_family = DEVICE_FAMILY,
|
||||
scfifo_component.lpm_hint = MEMORY_TYPE,
|
||||
scfifo_component.lpm_numwords = 1024,
|
||||
scfifo_component.lpm_showahead = "ON",
|
||||
scfifo_component.lpm_type = "scfifo",
|
||||
scfifo_component.lpm_width = 36,
|
||||
scfifo_component.lpm_widthu = 10,
|
||||
scfifo_component.overflow_checking = "ON",
|
||||
scfifo_component.underflow_checking = "ON",
|
||||
scfifo_component.use_eab = "ON";
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: AlmostEmpty NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1"
|
||||
// Retrieval info: PRIVATE: AlmostFull NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1"
|
||||
// Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Clock NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Depth NUMERIC "1024"
|
||||
// Retrieval info: PRIVATE: Empty NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Full NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV GX"
|
||||
// Retrieval info: PRIVATE: LE_BasedFIFO NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: LegacyRREQ NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: MAX_DEPTH_BY_9 NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: OVERFLOW_CHECKING NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Optimize NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "2"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: UNDERFLOW_CHECKING NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: UsedW NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Width NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: dc_aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: diff_widths NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: msb_usedw NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: output_width NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: rsEmpty NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: rsFull NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: rsUsedW NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: sc_aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: sc_sclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: wsEmpty NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: wsFull NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: wsUsedW NUMERIC "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: ADD_RAM_OUTPUT_REGISTER STRING "OFF"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV GX"
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "RAM_BLOCK_TYPE=M9K"
|
||||
// Retrieval info: CONSTANT: LPM_NUMWORDS NUMERIC "1024"
|
||||
// Retrieval info: CONSTANT: LPM_SHOWAHEAD STRING "ON"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "scfifo"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTH NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHU NUMERIC "10"
|
||||
// Retrieval info: CONSTANT: OVERFLOW_CHECKING STRING "ON"
|
||||
// Retrieval info: CONSTANT: UNDERFLOW_CHECKING STRING "ON"
|
||||
// Retrieval info: CONSTANT: USE_EAB STRING "ON"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
// Retrieval info: USED_PORT: data 0 0 8 0 INPUT NODEFVAL "data[7..0]"
|
||||
// Retrieval info: USED_PORT: empty 0 0 0 0 OUTPUT NODEFVAL "empty"
|
||||
// Retrieval info: USED_PORT: full 0 0 0 0 OUTPUT NODEFVAL "full"
|
||||
// Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
|
||||
// Retrieval info: USED_PORT: rdreq 0 0 0 0 INPUT NODEFVAL "rdreq"
|
||||
// Retrieval info: USED_PORT: wrreq 0 0 0 0 INPUT NODEFVAL "wrreq"
|
||||
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @data 0 0 8 0 data 0 0 8 0
|
||||
// Retrieval info: CONNECT: @rdreq 0 0 0 0 rdreq 0 0 0 0
|
||||
// Retrieval info: CONNECT: @wrreq 0 0 0 0 wrreq 0 0 0 0
|
||||
// Retrieval info: CONNECT: empty 0 0 0 0 @empty 0 0 0 0
|
||||
// Retrieval info: CONNECT: full 0 0 0 0 @full 0 0 0 0
|
||||
// Retrieval info: CONNECT: q 0 0 8 0 @q 0 0 8 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL fifo_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
|
@ -1,453 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
# TCL File Generated by Component Editor 14.1
|
||||
# Fri May 09 18:08:10 MYT 2014
|
||||
# DO NOT MODIFY
|
||||
|
||||
|
||||
#
|
||||
# altera_epcq_controller_core "Altera EPCQ Serial Flash controller core" v14.1
|
||||
# Altera Coorperation 2014.05.23.15:01:29
|
||||
# This component is a serial flash controller which allows user to access Altera EPCQ devices
|
||||
#
|
||||
|
||||
#
|
||||
# request TCL package from ACDS 14.1
|
||||
#
|
||||
package require -exact qsys 14.1
|
||||
|
||||
|
||||
|
||||
#
|
||||
# module altera_epcq_controller
|
||||
#
|
||||
set_module_property DESCRIPTION "This component is a serial flash controller which allows user to access Altera EPCQ devices"
|
||||
set_module_property NAME altera_epcq_controller_core
|
||||
set_module_property VERSION 15.1
|
||||
set_module_property INTERNAL true
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property AUTHOR "Altera Corporation"
|
||||
set_module_property DISPLAY_NAME "Altera EPCQ Serial Flash controller core"
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property HIDE_FROM_QUARTUS true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
set_module_property VALIDATION_CALLBACK "validate"
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL altera_epcq_controller_arb
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file altera_epcq_controller_arb.sv SYSTEM_VERILOG PATH altera_epcq_controller_arb.sv TOP_LEVEL_FILE
|
||||
add_fileset_file altera_epcq_controller.sv SYSTEM_VERILOG PATH altera_epcq_controller.sv
|
||||
|
||||
add_fileset SIM_VERILOG SIM_VERILOG "" ""
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL altera_epcq_controller_arb
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE true
|
||||
add_fileset_file altera_epcq_controller_arb.sv SYSTEM_VERILOG PATH altera_epcq_controller_arb.sv TOP_LEVEL_FILE
|
||||
add_fileset_file altera_epcq_controller.sv SYSTEM_VERILOG PATH altera_epcq_controller.sv
|
||||
|
||||
#
|
||||
# add system info parameter
|
||||
add_parameter deviceFeaturesSystemInfo STRING "None"
|
||||
set_parameter_property deviceFeaturesSystemInfo system_info "DEVICE_FEATURES"
|
||||
set_parameter_property deviceFeaturesSystemInfo VISIBLE false
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
add_parameter DEVICE_FAMILY STRING ""
|
||||
set_parameter_property DEVICE_FAMILY SYSTEM_INFO "DEVICE_FAMILY"
|
||||
set_parameter_property DEVICE_FAMILY HDL_PARAMETER true
|
||||
set_parameter_property DEVICE_FAMILY VISIBLE false
|
||||
|
||||
add_parameter ADDR_WIDTH INTEGER 19
|
||||
set_parameter_property ADDR_WIDTH DEFAULT_VALUE 19
|
||||
set_parameter_property ADDR_WIDTH DISPLAY_NAME ADDR_WIDTH
|
||||
set_parameter_property ADDR_WIDTH DERIVED true
|
||||
set_parameter_property ADDR_WIDTH TYPE INTEGER
|
||||
set_parameter_property ADDR_WIDTH VISIBLE false
|
||||
set_parameter_property ADDR_WIDTH UNITS None
|
||||
set_parameter_property ADDR_WIDTH ALLOWED_RANGES {19, 20, 21, 22, 23, 24, 25, 26, 27, 28}
|
||||
set_parameter_property ADDR_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter ASMI_ADDR_WIDTH INTEGER 24
|
||||
set_parameter_property ASMI_ADDR_WIDTH DEFAULT_VALUE 24
|
||||
set_parameter_property ASMI_ADDR_WIDTH DISPLAY_NAME ASMI_ADDR_WIDTH
|
||||
set_parameter_property ASMI_ADDR_WIDTH DERIVED true
|
||||
set_parameter_property ASMI_ADDR_WIDTH TYPE INTEGER
|
||||
set_parameter_property ASMI_ADDR_WIDTH VISIBLE false
|
||||
set_parameter_property ASMI_ADDR_WIDTH UNITS None
|
||||
set_parameter_property ASMI_ADDR_WIDTH ALLOWED_RANGES {24, 32}
|
||||
set_parameter_property ASMI_ADDR_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter ASI_WIDTH INTEGER 1
|
||||
set_parameter_property ASI_WIDTH DEFAULT_VALUE 1
|
||||
set_parameter_property ASI_WIDTH DISPLAY_NAME ASI_WIDTH
|
||||
set_parameter_property ASI_WIDTH DERIVED true
|
||||
set_parameter_property ASI_WIDTH TYPE INTEGER
|
||||
set_parameter_property ASI_WIDTH VISIBLE false
|
||||
set_parameter_property ASI_WIDTH UNITS None
|
||||
set_parameter_property ASI_WIDTH ALLOWED_RANGES {1, 4}
|
||||
set_parameter_property ASI_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter CS_WIDTH INTEGER 1
|
||||
set_parameter_property CS_WIDTH DEFAULT_VALUE 1
|
||||
set_parameter_property CS_WIDTH DISPLAY_NAME CS_WIDTH
|
||||
set_parameter_property CS_WIDTH DERIVED true
|
||||
set_parameter_property CS_WIDTH TYPE INTEGER
|
||||
set_parameter_property CS_WIDTH VISIBLE false
|
||||
set_parameter_property CS_WIDTH UNITS None
|
||||
set_parameter_property CS_WIDTH ALLOWED_RANGES {1, 3}
|
||||
set_parameter_property CS_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter CHIP_SELS INTEGER "1"
|
||||
set_parameter_property CHIP_SELS DISPLAY_NAME "Number of Chip Selects used"
|
||||
set_parameter_property CHIP_SELS ALLOWED_RANGES {1 2 3}
|
||||
set_parameter_property CHIP_SELS DESCRIPTION "Number of EPCQ(L) devices that are attached and need a CHIPSEL"
|
||||
set_parameter_property CHIP_SELS HDL_PARAMETER true
|
||||
set_parameter_property CHIP_SELS AFFECTS_GENERATION true
|
||||
|
||||
add_parameter DDASI INTEGER "0"
|
||||
set_parameter_property DDASI DISPLAY_NAME "Disable dedicated Active Serial interface"
|
||||
set_parameter_property DDASI DESCRIPTION "Check to route ASMIBLOCK signals to top level of design"
|
||||
set_parameter_property DDASI AFFECTS_GENERATION true
|
||||
set_parameter_property DDASI VISIBLE false
|
||||
set_parameter_property DDASI DERIVED false
|
||||
|
||||
add_parameter ENABLE_4BYTE_ADDR INTEGER "0"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DISPLAY_NAME "Enable 4-byte addressing mode"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DESCRIPTION "Check to enable 4-byte addressing mode for device larger than 128Mbyte"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR AFFECTS_GENERATION true
|
||||
set_parameter_property ENABLE_4BYTE_ADDR VISIBLE false
|
||||
set_parameter_property ENABLE_4BYTE_ADDR HDL_PARAMETER true
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DERIVED true
|
||||
|
||||
# SPI device selection
|
||||
add_parameter FLASH_TYPE STRING "EPCQ16"
|
||||
set_parameter_property FLASH_TYPE DISPLAY_NAME "Configuration device type"
|
||||
set_parameter_property FLASH_TYPE DESCRIPTION "Select targeted EPCS/EPCQ devices"
|
||||
set_parameter_property FLASH_TYPE AFFECTS_GENERATION true
|
||||
set_parameter_property FLASH_TYPE VISIBLE true
|
||||
set_parameter_property FLASH_TYPE DERIVED false
|
||||
|
||||
add_parameter IO_MODE STRING "STANDARD"
|
||||
set_parameter_property IO_MODE DISPLAY_NAME "Choose I/O mode"
|
||||
set_parameter_property IO_MODE ALLOWED_RANGES {"STANDARD" "QUAD"}
|
||||
set_parameter_property IO_MODE DESCRIPTION "Select extended data width when Fast Read operation is enabled"
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
set_interface_property clock_sink EXPORT_OF ""
|
||||
set_interface_property clock_sink PORT_NAME_MAP ""
|
||||
set_interface_property clock_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock_sink clk clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset
|
||||
#
|
||||
add_interface reset reset end
|
||||
set_interface_property reset associatedClock clock_sink
|
||||
set_interface_property reset synchronousEdges DEASSERT
|
||||
set_interface_property reset ENABLED true
|
||||
set_interface_property reset EXPORT_OF ""
|
||||
set_interface_property reset PORT_NAME_MAP ""
|
||||
set_interface_property reset CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset reset_n reset_n Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avl_csr
|
||||
#
|
||||
add_interface avl_csr avalon end
|
||||
set_interface_property avl_csr addressUnits WORDS
|
||||
set_interface_property avl_csr associatedClock clock_sink
|
||||
set_interface_property avl_csr associatedReset reset
|
||||
set_interface_property avl_csr bitsPerSymbol 8
|
||||
set_interface_property avl_csr burstOnBurstBoundariesOnly false
|
||||
set_interface_property avl_csr burstcountUnits WORDS
|
||||
set_interface_property avl_csr explicitAddressSpan 0
|
||||
set_interface_property avl_csr holdTime 0
|
||||
set_interface_property avl_csr linewrapBursts false
|
||||
set_interface_property avl_csr maximumPendingReadTransactions 1
|
||||
set_interface_property avl_csr maximumPendingWriteTransactions 0
|
||||
set_interface_property avl_csr readLatency 0
|
||||
set_interface_property avl_csr readWaitTime 0
|
||||
set_interface_property avl_csr setupTime 0
|
||||
set_interface_property avl_csr timingUnits Cycles
|
||||
set_interface_property avl_csr writeWaitTime 0
|
||||
set_interface_property avl_csr ENABLED true
|
||||
set_interface_property avl_csr EXPORT_OF ""
|
||||
set_interface_property avl_csr PORT_NAME_MAP ""
|
||||
set_interface_property avl_csr CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avl_csr SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avl_csr avl_csr_read read Input 1
|
||||
add_interface_port avl_csr avl_csr_waitrequest waitrequest Output 1
|
||||
add_interface_port avl_csr avl_csr_write write Input 1
|
||||
add_interface_port avl_csr avl_csr_addr address Input 3
|
||||
add_interface_port avl_csr avl_csr_wrdata writedata Input 32
|
||||
add_interface_port avl_csr avl_csr_rddata readdata Output 32
|
||||
add_interface_port avl_csr avl_csr_rddata_valid readdatavalid Output 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avl_mem
|
||||
#
|
||||
add_interface avl_mem avalon end
|
||||
set_interface_property avl_mem addressUnits WORDS
|
||||
set_interface_property avl_mem associatedClock clock_sink
|
||||
set_interface_property avl_mem associatedReset reset
|
||||
set_interface_property avl_mem bitsPerSymbol 8
|
||||
set_interface_property avl_mem burstOnBurstBoundariesOnly false
|
||||
set_interface_property avl_mem burstcountUnits WORDS
|
||||
set_interface_property avl_mem explicitAddressSpan 0
|
||||
set_interface_property avl_mem holdTime 0
|
||||
set_interface_property avl_mem linewrapBursts true
|
||||
set_interface_property avl_mem maximumPendingReadTransactions 1
|
||||
set_interface_property avl_mem maximumPendingWriteTransactions 0
|
||||
set_interface_property avl_mem constantBurstBehavior true
|
||||
set_interface_property avl_mem readLatency 0
|
||||
set_interface_property avl_mem readWaitTime 0
|
||||
set_interface_property avl_mem setupTime 0
|
||||
set_interface_property avl_mem timingUnits Cycles
|
||||
set_interface_property avl_mem writeWaitTime 0
|
||||
set_interface_property avl_mem ENABLED true
|
||||
set_interface_property avl_mem EXPORT_OF ""
|
||||
set_interface_property avl_mem PORT_NAME_MAP ""
|
||||
set_interface_property avl_mem CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avl_mem SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avl_mem avl_mem_write write Input 1
|
||||
add_interface_port avl_mem avl_mem_burstcount burstcount Input 7
|
||||
add_interface_port avl_mem avl_mem_waitrequest waitrequest Output 1
|
||||
add_interface_port avl_mem avl_mem_read read Input 1
|
||||
add_interface_port avl_mem avl_mem_addr address Input ADDR_WIDTH
|
||||
add_interface_port avl_mem avl_mem_wrdata writedata Input 32
|
||||
add_interface_port avl_mem avl_mem_rddata readdata Output 32
|
||||
add_interface_port avl_mem avl_mem_rddata_valid readdatavalid Output 1
|
||||
add_interface_port avl_mem avl_mem_byteenable byteenable Input 4
|
||||
|
||||
|
||||
#
|
||||
# connection point conduit_out
|
||||
#
|
||||
add_interface asmi_status_out conduit end
|
||||
add_interface_port asmi_status_out asmi_status_out conduit_status_out Input 8
|
||||
|
||||
add_interface asmi_epcs_id conduit end
|
||||
add_interface_port asmi_epcs_id asmi_epcs_id conduit_epcs_id Input 8
|
||||
|
||||
add_interface asmi_illegal_erase conduit end
|
||||
add_interface_port asmi_illegal_erase asmi_illegal_erase conduit_illegal_erase Input 1
|
||||
|
||||
add_interface asmi_illegal_write conduit end
|
||||
add_interface_port asmi_illegal_write asmi_illegal_write conduit_illegal_write Input 1
|
||||
|
||||
add_interface ddasi_dataoe conduit end
|
||||
add_interface_port ddasi_dataoe ddasi_dataoe conduit_ddasi_dataoe Input ASI_WIDTH
|
||||
|
||||
add_interface ddasi_dclk conduit end
|
||||
add_interface_port ddasi_dclk ddasi_dclk conduit_ddasi_dclk Input 1
|
||||
|
||||
add_interface ddasi_scein conduit end
|
||||
add_interface_port ddasi_scein ddasi_scein conduit_ddasi_scein Input CS_WIDTH
|
||||
|
||||
add_interface ddasi_sdoin conduit end
|
||||
add_interface_port ddasi_sdoin ddasi_sdoin conduit_ddasi_sdoin Input ASI_WIDTH
|
||||
|
||||
add_interface asmi_busy conduit end
|
||||
add_interface_port asmi_busy asmi_busy conduit_busy Input 1
|
||||
|
||||
add_interface asmi_data_valid conduit end
|
||||
add_interface_port asmi_data_valid asmi_data_valid conduit_data_valid Input 1
|
||||
|
||||
add_interface asmi_dataout conduit end
|
||||
add_interface_port asmi_dataout asmi_dataout conduit_dataout Input 8
|
||||
|
||||
add_interface epcq_dataout conduit end
|
||||
add_interface_port epcq_dataout epcq_dataout conduit_epcq_dataout Input ASI_WIDTH
|
||||
|
||||
add_interface ddasi_dataout conduit end
|
||||
add_interface_port ddasi_dataout ddasi_dataout conduit_ddasi_dataout Output ASI_WIDTH
|
||||
|
||||
add_interface asmi_read_rdid conduit end
|
||||
add_interface_port asmi_read_rdid asmi_read_rdid conduit_read_rdid Output 1
|
||||
|
||||
add_interface asmi_read_status conduit end
|
||||
add_interface_port asmi_read_status asmi_read_status conduit_read_status Output 1
|
||||
|
||||
add_interface asmi_read_sid conduit end
|
||||
add_interface_port asmi_read_sid asmi_read_sid conduit_read_sid Output 1
|
||||
|
||||
add_interface asmi_bulk_erase conduit end
|
||||
add_interface_port asmi_bulk_erase asmi_bulk_erase conduit_bulk_erase Output 1
|
||||
|
||||
add_interface asmi_sector_erase conduit end
|
||||
add_interface_port asmi_sector_erase asmi_sector_erase conduit_sector_erase Output 1
|
||||
|
||||
add_interface asmi_sector_protect conduit end
|
||||
add_interface_port asmi_sector_protect asmi_sector_protect conduit_sector_protect Output 1
|
||||
|
||||
add_interface epcq_dclk conduit end
|
||||
add_interface_port epcq_dclk epcq_dclk conduit_epcq_dclk Output 1
|
||||
|
||||
add_interface epcq_scein conduit end
|
||||
add_interface_port epcq_scein epcq_scein conduit_epcq_scein Output CS_WIDTH
|
||||
|
||||
add_interface epcq_sdoin conduit end
|
||||
add_interface_port epcq_sdoin epcq_sdoin conduit_epcq_sdoin Output ASI_WIDTH
|
||||
|
||||
add_interface epcq_dataoe conduit end
|
||||
add_interface_port epcq_dataoe epcq_dataoe conduit_epcq_dataoe Output ASI_WIDTH
|
||||
|
||||
add_interface asmi_clkin conduit end
|
||||
add_interface_port asmi_clkin asmi_clkin conduit_clkin Output 1
|
||||
|
||||
add_interface asmi_reset conduit end
|
||||
add_interface_port asmi_reset asmi_reset conduit_reset Output 1
|
||||
|
||||
add_interface asmi_sce conduit end
|
||||
add_interface_port asmi_sce asmi_sce conduit_asmi_sce Output CS_WIDTH
|
||||
|
||||
add_interface asmi_addr conduit end
|
||||
add_interface_port asmi_addr asmi_addr conduit_addr Output ASMI_ADDR_WIDTH
|
||||
|
||||
add_interface asmi_datain conduit end
|
||||
add_interface_port asmi_datain asmi_datain conduit_datain Output 8
|
||||
|
||||
add_interface asmi_fast_read conduit end
|
||||
add_interface_port asmi_fast_read asmi_fast_read conduit_fast_read Output 1
|
||||
|
||||
add_interface asmi_rden conduit end
|
||||
add_interface_port asmi_rden asmi_rden conduit_rden Output 1
|
||||
|
||||
add_interface asmi_shift_bytes conduit end
|
||||
add_interface_port asmi_shift_bytes asmi_shift_bytes conduit_shift_bytes Output 1
|
||||
|
||||
add_interface asmi_wren conduit end
|
||||
add_interface_port asmi_wren asmi_wren conduit_wren Output 1
|
||||
|
||||
add_interface asmi_write conduit end
|
||||
add_interface_port asmi_write asmi_write conduit_write Output 1
|
||||
|
||||
add_interface asmi_rdid_out conduit end
|
||||
add_interface_port asmi_rdid_out asmi_rdid_out conduit_rdid_out Input 8
|
||||
|
||||
add_interface asmi_en4b_addr conduit end
|
||||
add_interface_port asmi_en4b_addr asmi_en4b_addr conduit_en4b_addr Output 1
|
||||
|
||||
#
|
||||
# connection point interrupt_sender
|
||||
#
|
||||
add_interface interrupt_sender interrupt end
|
||||
set_interface_property interrupt_sender associatedAddressablePoint avl_csr
|
||||
set_interface_property interrupt_sender associatedClock clock_sink
|
||||
set_interface_property interrupt_sender associatedReset reset
|
||||
set_interface_property interrupt_sender bridgedReceiverOffset ""
|
||||
set_interface_property interrupt_sender bridgesToReceiver ""
|
||||
set_interface_property interrupt_sender ENABLED true
|
||||
set_interface_property interrupt_sender EXPORT_OF ""
|
||||
set_interface_property interrupt_sender PORT_NAME_MAP ""
|
||||
set_interface_property interrupt_sender CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property interrupt_sender SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port interrupt_sender irq irq Output 1
|
||||
|
||||
proc validate {} {
|
||||
set all_supported_SPI_list {"EPCS16" "EPCS64" "EPCS128" "EPCQ16" "EPCQ32" "EPCQ64" "EPCQ128" "EPCQ256" \
|
||||
"EPCQ512" "EPCQL256" "EPCQL512" "EPCQL1024"}
|
||||
|
||||
set_parameter_property FLASH_TYPE "ALLOWED_RANGES" $all_supported_SPI_list
|
||||
set DEVICE_FAMILY [ get_parameter_value DEVICE_FAMILY ]
|
||||
set CHIP_SELS [ get_parameter_value CHIP_SELS]
|
||||
set temp_addr_width [ proc_get_derive_addr_width [ get_parameter_value FLASH_TYPE ] ]
|
||||
set_parameter_value ENABLE_4BYTE_ADDR [ proc_get_derive_enable_2byte_addr [ get_parameter_value FLASH_TYPE ] ]
|
||||
|
||||
if { [ get_parameter_value ENABLE_4BYTE_ADDR ] } {
|
||||
set_parameter_value ASMI_ADDR_WIDTH 32
|
||||
} else {
|
||||
set_parameter_value ASMI_ADDR_WIDTH 24
|
||||
}
|
||||
|
||||
# check whether devices supporting multiple flash - only for Arria 10
|
||||
if {[check_device_family_equivalence $DEVICE_FAMILY "Arria 10"]} {
|
||||
set is_multi_flash_support "true"
|
||||
if {$CHIP_SELS eq 3 } {set_parameter_value ADDR_WIDTH [ expr $temp_addr_width + 2]}
|
||||
if {$CHIP_SELS eq 2 } {set_parameter_value ADDR_WIDTH [ expr $temp_addr_width + 1]}
|
||||
if {$CHIP_SELS eq 1 } {set_parameter_value ADDR_WIDTH $temp_addr_width }
|
||||
} else {
|
||||
set is_multi_flash_support "false"
|
||||
set_parameter_value ADDR_WIDTH $temp_addr_width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
proc proc_get_derive_enable_2byte_addr {flash_type} {
|
||||
if { [ string match "*256*" "$flash_type" ] || [ string match "*512*" "$flash_type" ] || [ string match "*1024*" "$flash_type" ]} {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
proc proc_get_derive_addr_width {flash_type} {
|
||||
switch $flash_type {
|
||||
"EPCS16" - "EPCQ16" {
|
||||
return 19
|
||||
}
|
||||
"EPCS64" - "EPCQ64" {
|
||||
return 21
|
||||
}
|
||||
"EPCS128" - "EPCQ128" {
|
||||
return 22
|
||||
}
|
||||
"EPCQ32" {
|
||||
return 20
|
||||
}
|
||||
"EPCQ256" - "EPCQL256" {
|
||||
return 23
|
||||
}
|
||||
"EPCQ512" - "EPCQL512" {
|
||||
return 24
|
||||
}
|
||||
"EPCQL1024" {
|
||||
return 25
|
||||
}
|
||||
default {
|
||||
# Should never enter this function
|
||||
send_message error "$flash_type is not a valid flash type"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
#
|
||||
# altera_epcq_controller_sw.tcl
|
||||
#
|
||||
|
||||
# Create a new driver
|
||||
create_driver altera_epcq_controller_mod_driver
|
||||
|
||||
# Associate it with some hardware known as "altera_epcq_controller"
|
||||
set_sw_property hw_class_name altera_epcq_controller_mod
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version 15.1
|
||||
|
||||
# This driver may be incompatible with versions of hardware less
|
||||
# than specified below. Updates to hardware and device drivers
|
||||
# rendering the driver incompatible with older versions of
|
||||
# hardware are noted with this property assignment.
|
||||
set_sw_property min_compatible_hw_version 14.1
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize true
|
||||
|
||||
# This driver only works when the following combinations of interfaces
|
||||
# are enabled and connected as a group of CSR interfaces.
|
||||
set_sw_property csr_interfaces "avl_mem,avl_csr"
|
||||
|
||||
# The EPCQ interrupt has an interrupt but it is not used in the driver.
|
||||
# These assignments are still required by the Nios II SBT
|
||||
set_sw_property isr_preemption_supported true
|
||||
set_sw_property supported_interrupt_apis "legacy_interrupt_api enhanced_interrupt_api"
|
||||
|
||||
# Location in generated BSP that above sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
# Header files
|
||||
add_sw_property include_source HAL/inc/altera_epcq_controller_mod.h
|
||||
add_sw_property include_source inc/altera_epcq_controller_mod_regs.h
|
||||
|
||||
# C/C++ source files
|
||||
add_sw_property c_source HAL/src/altera_epcq_controller_mod.c
|
||||
|
||||
|
||||
# This driver supports HAL & UCOSII BSP (OS) types
|
||||
add_sw_property supported_bsp_type HAL
|
||||
add_sw_property supported_bsp_type UCOSII
|
|
@ -1,248 +0,0 @@
|
|||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
|
||||
`timescale 1ps / 1ps
|
||||
|
||||
${MULTICHIP}
|
||||
${DDASI_ON}
|
||||
${SID_EN}
|
||||
${BULK_ERASE_EN}
|
||||
${4BYTE_ADDR_EN}
|
||||
|
||||
module altera_epcq_controller_wrapper #(
|
||||
parameter CS_WIDTH = 1,
|
||||
parameter DEVICE_FAMILY = "Arria V",
|
||||
parameter ADDR_WIDTH = 24,
|
||||
parameter ASI_WIDTH = 1,
|
||||
parameter ENABLE_4BYTE_ADDR = 1,
|
||||
parameter ASMI_ADDR_WIDTH = 22,
|
||||
parameter CHIP_SELS = 1
|
||||
)(
|
||||
input wire clk,
|
||||
input wire reset_n,
|
||||
|
||||
// ports to access csr
|
||||
input wire avl_csr_write,
|
||||
input wire avl_csr_read,
|
||||
input wire [2:0] avl_csr_addr,
|
||||
input wire [31:0] avl_csr_wrdata,
|
||||
output wire [31:0] avl_csr_rddata,
|
||||
output wire avl_csr_rddata_valid,
|
||||
output wire avl_csr_waitrequest,
|
||||
|
||||
// ports to access memory
|
||||
input wire avl_mem_write,
|
||||
input wire avl_mem_read,
|
||||
input wire [ADDR_WIDTH-1:0] avl_mem_addr,
|
||||
input wire [31:0] avl_mem_wrdata,
|
||||
input wire [6:0] avl_mem_burstcount,
|
||||
input wire [3:0] avl_mem_byteenable,
|
||||
output wire [31:0] avl_mem_rddata,
|
||||
output wire avl_mem_rddata_valid,
|
||||
output wire avl_mem_waitrequest,
|
||||
|
||||
`ifdef DDASI_ON
|
||||
output wire [ASI_WIDTH-1:0] epcq_dataout,
|
||||
output wire epcq_dclk,
|
||||
output wire [CS_WIDTH-1:0] epcq_scein,
|
||||
output wire [ASI_WIDTH-1:0] epcq_sdoin,
|
||||
output wire [ASI_WIDTH-1:0] epcq_dataoe,
|
||||
`endif
|
||||
|
||||
// interrupt signal
|
||||
output reg irq
|
||||
);
|
||||
|
||||
`ifdef DDASI_ON
|
||||
wire [ASI_WIDTH-1:0] ddasi_dataoe;
|
||||
wire [ASI_WIDTH-1:0] ddasi_dataout;
|
||||
wire ddasi_dclk;
|
||||
wire [CS_WIDTH-1:0] ddasi_scein;
|
||||
wire [ASI_WIDTH-1:0] ddasi_sdoin;
|
||||
`endif
|
||||
wire asmi_busy;
|
||||
wire asmi_data_valid;
|
||||
wire [7:0] asmi_dataout;
|
||||
wire asmi_clkin;
|
||||
wire asmi_reset;
|
||||
`ifdef MULTICHIP
|
||||
wire [CS_WIDTH-1:0] asmi_sce;
|
||||
`endif
|
||||
wire [ASMI_ADDR_WIDTH-1:0] asmi_addr;
|
||||
wire [7:0] asmi_datain;
|
||||
wire asmi_fast_read;
|
||||
wire asmi_rden;
|
||||
wire asmi_shift_bytes;
|
||||
wire asmi_wren;
|
||||
wire asmi_write;
|
||||
|
||||
wire asmi_illegal_erase;
|
||||
wire asmi_illegal_write;
|
||||
wire [7:0] asmi_rdid_out;
|
||||
wire [7:0] asmi_status_out;
|
||||
`ifdef ENABLE_SID
|
||||
wire [7:0] asmi_epcs_id;
|
||||
`endif
|
||||
wire asmi_read_rdid;
|
||||
wire asmi_read_status;
|
||||
wire asmi_read_sid;
|
||||
`ifdef ENABLE_4BYTE_ADDR_CODE
|
||||
wire asmi_en4b_addr;
|
||||
`endif
|
||||
`ifdef ENABLE_BULK_ERASE
|
||||
wire asmi_bulk_erase;
|
||||
`endif
|
||||
wire asmi_sector_erase;
|
||||
wire asmi_sector_protect;
|
||||
|
||||
altera_epcq_controller_core #(
|
||||
.DEVICE_FAMILY (DEVICE_FAMILY),
|
||||
.ADDR_WIDTH (ADDR_WIDTH),
|
||||
.ASI_WIDTH (ASI_WIDTH),
|
||||
.ASMI_ADDR_WIDTH (ASMI_ADDR_WIDTH),
|
||||
.CS_WIDTH (CS_WIDTH),
|
||||
.ENABLE_4BYTE_ADDR (ENABLE_4BYTE_ADDR),
|
||||
.CHIP_SELS (CHIP_SELS)
|
||||
) epcq_controller_inst (
|
||||
.clk (clk ),
|
||||
.reset_n (reset_n ),
|
||||
.avl_csr_write (avl_csr_write ),
|
||||
.avl_csr_read (avl_csr_read ),
|
||||
.avl_csr_addr (avl_csr_addr ),
|
||||
.avl_csr_wrdata (avl_csr_wrdata ),
|
||||
.avl_csr_rddata (avl_csr_rddata ),
|
||||
.avl_csr_rddata_valid (avl_csr_rddata_valid ),
|
||||
.avl_csr_waitrequest (avl_csr_waitrequest ),
|
||||
.avl_mem_write (avl_mem_write ),
|
||||
.avl_mem_read (avl_mem_read ),
|
||||
.avl_mem_addr (avl_mem_addr ),
|
||||
.avl_mem_wrdata (avl_mem_wrdata ),
|
||||
.avl_mem_burstcount (avl_mem_burstcount ),
|
||||
.avl_mem_byteenable (avl_mem_byteenable ),
|
||||
.avl_mem_rddata (avl_mem_rddata ),
|
||||
.avl_mem_rddata_valid (avl_mem_rddata_valid ),
|
||||
.avl_mem_waitrequest (avl_mem_waitrequest ),
|
||||
.irq (irq ),
|
||||
`ifdef DDASI_ON
|
||||
.epcq_dataout (epcq_dataout ),
|
||||
.epcq_dclk (epcq_dclk ),
|
||||
.epcq_scein (epcq_scein ),
|
||||
.epcq_sdoin (epcq_sdoin ),
|
||||
.epcq_dataoe (epcq_dataoe ),
|
||||
.ddasi_dataoe (ddasi_dataoe ),
|
||||
.ddasi_dataout (ddasi_dataout ),
|
||||
.ddasi_dclk (ddasi_dclk ),
|
||||
.ddasi_scein (ddasi_scein ),
|
||||
.ddasi_sdoin (ddasi_sdoin ),
|
||||
`else
|
||||
.epcq_dataout ({ASI_WIDTH{1'b0}} ),
|
||||
.epcq_dclk ( ),
|
||||
.epcq_scein ( ),
|
||||
.epcq_sdoin ( ),
|
||||
.epcq_dataoe ( ),
|
||||
.ddasi_dataoe ({ASI_WIDTH{1'b0}} ),
|
||||
.ddasi_dataout ( ),
|
||||
.ddasi_dclk (1'b0 ),
|
||||
.ddasi_scein ({CS_WIDTH{1'b0}} ),
|
||||
.ddasi_sdoin ({ASI_WIDTH{1'b0}} ),
|
||||
`endif
|
||||
.asmi_busy (asmi_busy ),
|
||||
.asmi_data_valid (asmi_data_valid ),
|
||||
.asmi_dataout (asmi_dataout ),
|
||||
.asmi_clkin (asmi_clkin ),
|
||||
.asmi_reset (asmi_reset ),
|
||||
`ifdef MULTICHIP
|
||||
.asmi_sce (asmi_sce ),
|
||||
`else
|
||||
.asmi_sce ( ),
|
||||
`endif
|
||||
.asmi_addr (asmi_addr ),
|
||||
.asmi_datain (asmi_datain ),
|
||||
.asmi_fast_read (asmi_fast_read ),
|
||||
.asmi_rden (asmi_rden ),
|
||||
.asmi_shift_bytes (asmi_shift_bytes ),
|
||||
.asmi_wren (asmi_wren ),
|
||||
.asmi_write (asmi_write ),
|
||||
.asmi_illegal_erase (asmi_illegal_erase ),
|
||||
.asmi_illegal_write (asmi_illegal_write ),
|
||||
.asmi_rdid_out (asmi_rdid_out ),
|
||||
.asmi_status_out (asmi_status_out ),
|
||||
`ifdef ENABLE_SID
|
||||
.asmi_epcs_id (asmi_epcs_id ),
|
||||
.asmi_read_sid (asmi_read_sid ),
|
||||
`else
|
||||
.asmi_epcs_id ({8{1'b0}} ),
|
||||
.asmi_read_sid ( ),
|
||||
`endif
|
||||
.asmi_read_rdid (asmi_read_rdid ),
|
||||
.asmi_read_status (asmi_read_status ),
|
||||
`ifdef ENABLE_4BYTE_ADDR_CODE
|
||||
.asmi_en4b_addr (asmi_en4b_addr ),
|
||||
`else
|
||||
.asmi_en4b_addr ( ),
|
||||
`endif
|
||||
`ifdef ENABLE_BULK_ERASE
|
||||
.asmi_bulk_erase (asmi_bulk_erase ),
|
||||
`else
|
||||
.asmi_bulk_erase ( ),
|
||||
`endif
|
||||
.asmi_sector_erase (asmi_sector_erase ),
|
||||
.asmi_sector_protect (asmi_sector_protect )
|
||||
);
|
||||
|
||||
altera_asmi_parallel asmi_parallel_inst (
|
||||
.busy (asmi_busy ),
|
||||
.data_valid (asmi_data_valid ),
|
||||
.dataout (asmi_dataout ),
|
||||
.clkin (asmi_clkin ),
|
||||
.reset (asmi_reset ),
|
||||
`ifdef MULTICHIP
|
||||
.sce (asmi_sce ),
|
||||
`endif
|
||||
.addr (asmi_addr ),
|
||||
.datain (asmi_datain ),
|
||||
.fast_read (asmi_fast_read ),
|
||||
.rden (asmi_rden ),
|
||||
.shift_bytes (asmi_shift_bytes ),
|
||||
.wren (asmi_wren ),
|
||||
.write (asmi_write ),
|
||||
.illegal_erase (asmi_illegal_erase ),
|
||||
.illegal_write (asmi_illegal_write ),
|
||||
.rdid_out (asmi_rdid_out ),
|
||||
.status_out (asmi_status_out ),
|
||||
.read_dummyclk (1'b0),
|
||||
`ifdef ENABLE_SID
|
||||
.epcs_id (asmi_epcs_id ),
|
||||
.read_sid (asmi_read_sid ),
|
||||
`endif
|
||||
.read_rdid (asmi_read_rdid ),
|
||||
.read_status (asmi_read_status ),
|
||||
`ifdef ENABLE_4BYTE_ADDR_CODE
|
||||
.en4b_addr (asmi_en4b_addr ),
|
||||
`endif
|
||||
`ifdef ENABLE_BULK_ERASE
|
||||
.bulk_erase (asmi_bulk_erase ),
|
||||
`endif
|
||||
`ifdef DDASI_ON
|
||||
.asmi_dataoe (ddasi_dataoe ),
|
||||
.asmi_dataout (ddasi_dataout ),
|
||||
.asmi_dclk (ddasi_dclk ),
|
||||
.asmi_scein (ddasi_scein ),
|
||||
.asmi_sdoin (ddasi_sdoin )
|
||||
`endif
|
||||
.sector_erase (asmi_sector_erase ),
|
||||
.sector_protect (asmi_sector_protect )
|
||||
);
|
||||
|
||||
endmodule
|
|
@ -1,648 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
package require -exact qsys 14.1
|
||||
package require -exact altera_terp 1.0
|
||||
|
||||
|
||||
#
|
||||
# module altera_trace_wrapper
|
||||
#
|
||||
set_module_property DESCRIPTION "This component is a serial flash controller which allows user to access Altera EPCQ devices"
|
||||
set_module_property NAME altera_epcq_controller_mod
|
||||
set_module_property VERSION 15.1
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Basic Functions/Configuration and Programming"
|
||||
set_module_property AUTHOR "Altera Corporation"
|
||||
set_module_property DISPLAY_NAME "Altera Serial Flash Controller"
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property HIDE_FROM_QUARTUS true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
set_module_property ELABORATION_CALLBACK elaboration
|
||||
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH add_topwrapper_fileset_proc
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL altera_epcq_controller_wrapper
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
|
||||
add_fileset SIM_VERILOG SIM_VERILOG add_topwrapper_fileset_proc
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL altera_epcq_controller_wrapper
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE true
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
# +-----------------------------------
|
||||
# | device family info
|
||||
# +-----------------------------------
|
||||
set all_supported_device_families_list {"Arria 10" "Cyclone V" "Arria V GZ" "Arria V" "Stratix V" "Stratix IV" \
|
||||
"Cyclone IV GX" "Cyclone IV E" "Cyclone III GL" "Arria II GZ" "Arria II GX"}
|
||||
|
||||
proc check_device_ini {device_families_list} {
|
||||
|
||||
set enable_max10 [get_quartus_ini enable_max10_active_serial ENABLED]
|
||||
|
||||
if {$enable_max10 == 1} {
|
||||
lappend device_families_list "MAX 10 FPGA"
|
||||
}
|
||||
return $device_families_list
|
||||
}
|
||||
|
||||
set device_list [check_device_ini $all_supported_device_families_list]
|
||||
set_module_property SUPPORTED_DEVICE_FAMILIES $device_list
|
||||
|
||||
add_parameter DEVICE_FAMILY STRING
|
||||
set_parameter_property DEVICE_FAMILY SYSTEM_INFO {DEVICE_FAMILY}
|
||||
set_parameter_property DEVICE_FAMILY VISIBLE false
|
||||
set_parameter_property DEVICE_FAMILY HDL_PARAMETER true
|
||||
|
||||
add_parameter ASI_WIDTH INTEGER 1
|
||||
set_parameter_property ASI_WIDTH DEFAULT_VALUE 1
|
||||
set_parameter_property ASI_WIDTH DISPLAY_NAME ASI_WIDTH
|
||||
set_parameter_property ASI_WIDTH DERIVED true
|
||||
set_parameter_property ASI_WIDTH TYPE INTEGER
|
||||
set_parameter_property ASI_WIDTH VISIBLE false
|
||||
set_parameter_property ASI_WIDTH UNITS None
|
||||
set_parameter_property ASI_WIDTH ALLOWED_RANGES {1, 4}
|
||||
set_parameter_property ASI_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter CS_WIDTH INTEGER 1
|
||||
set_parameter_property CS_WIDTH DEFAULT_VALUE 1
|
||||
set_parameter_property CS_WIDTH DISPLAY_NAME CS_WIDTH
|
||||
set_parameter_property CS_WIDTH DERIVED true
|
||||
set_parameter_property CS_WIDTH TYPE INTEGER
|
||||
set_parameter_property CS_WIDTH VISIBLE false
|
||||
set_parameter_property CS_WIDTH UNITS None
|
||||
set_parameter_property CS_WIDTH ALLOWED_RANGES {1, 3}
|
||||
set_parameter_property CS_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter ADDR_WIDTH INTEGER 19
|
||||
set_parameter_property ADDR_WIDTH DEFAULT_VALUE 19
|
||||
set_parameter_property ADDR_WIDTH DISPLAY_NAME ADDR_WIDTH
|
||||
set_parameter_property ADDR_WIDTH DERIVED true
|
||||
set_parameter_property ADDR_WIDTH TYPE INTEGER
|
||||
set_parameter_property ADDR_WIDTH VISIBLE false
|
||||
set_parameter_property ADDR_WIDTH UNITS None
|
||||
# 16M-19bit, 32M-20bit, 64M-21bit, 128M-22bit, 256M-23bit, 512M-24bit, 1024M-25bit, 2048M-26bit...
|
||||
set_parameter_property ADDR_WIDTH ALLOWED_RANGES {19, 20, 21, 22, 23, 24, 25, 26, 27, 28}
|
||||
set_parameter_property ADDR_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter ASMI_ADDR_WIDTH INTEGER 24
|
||||
set_parameter_property ASMI_ADDR_WIDTH DEFAULT_VALUE 24
|
||||
set_parameter_property ASMI_ADDR_WIDTH DISPLAY_NAME ASMI_ADDR_WIDTH
|
||||
set_parameter_property ASMI_ADDR_WIDTH DERIVED true
|
||||
set_parameter_property ASMI_ADDR_WIDTH TYPE INTEGER
|
||||
set_parameter_property ASMI_ADDR_WIDTH VISIBLE false
|
||||
set_parameter_property ASMI_ADDR_WIDTH UNITS None
|
||||
set_parameter_property ASMI_ADDR_WIDTH ALLOWED_RANGES {24, 32}
|
||||
set_parameter_property ASMI_ADDR_WIDTH HDL_PARAMETER true
|
||||
|
||||
add_parameter ENABLE_4BYTE_ADDR INTEGER "0"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DISPLAY_NAME "Enable 4-byte addressing mode"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DESCRIPTION "Check to enable 4-byte addressing mode for device larger than 128Mbyte"
|
||||
set_parameter_property ENABLE_4BYTE_ADDR AFFECTS_GENERATION true
|
||||
set_parameter_property ENABLE_4BYTE_ADDR VISIBLE false
|
||||
set_parameter_property ENABLE_4BYTE_ADDR HDL_PARAMETER true
|
||||
set_parameter_property ENABLE_4BYTE_ADDR DERIVED true
|
||||
|
||||
# +-----------------------------------
|
||||
|
||||
# add system info parameter
|
||||
add_parameter deviceFeaturesSystemInfo STRING "None"
|
||||
set_parameter_property deviceFeaturesSystemInfo system_info "DEVICE_FEATURES"
|
||||
set_parameter_property deviceFeaturesSystemInfo VISIBLE false
|
||||
|
||||
add_parameter DDASI INTEGER "0"
|
||||
set_parameter_property DDASI DISPLAY_NAME "Disable dedicated Active Serial interface"
|
||||
set_parameter_property DDASI DESCRIPTION "Check to route ASMIBLOCK signals to top level of design"
|
||||
set_parameter_property DDASI AFFECTS_GENERATION true
|
||||
set_parameter_property DDASI VISIBLE false
|
||||
set_parameter_property DDASI DERIVED false
|
||||
|
||||
add_parameter clkFreq LONG
|
||||
set_parameter_property clkFreq DEFAULT_VALUE {0}
|
||||
set_parameter_property clkFreq DISPLAY_NAME {clkFreq}
|
||||
set_parameter_property clkFreq VISIBLE {0}
|
||||
set_parameter_property clkFreq AFFECTS_GENERATION {1}
|
||||
set_parameter_property clkFreq HDL_PARAMETER {0}
|
||||
set_parameter_property clkFreq SYSTEM_INFO {clock_rate clk}
|
||||
set_parameter_property clkFreq SYSTEM_INFO_TYPE {CLOCK_RATE}
|
||||
set_parameter_property clkFreq SYSTEM_INFO_ARG {clock_sink}
|
||||
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
set_interface_property clock_sink EXPORT_OF ""
|
||||
set_interface_property clock_sink PORT_NAME_MAP ""
|
||||
set_interface_property clock_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock_sink clk clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset
|
||||
#
|
||||
add_interface reset reset end
|
||||
set_interface_property reset associatedClock clock_sink
|
||||
set_interface_property reset synchronousEdges DEASSERT
|
||||
set_interface_property reset ENABLED true
|
||||
set_interface_property reset EXPORT_OF ""
|
||||
set_interface_property reset PORT_NAME_MAP ""
|
||||
set_interface_property reset CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset reset_n reset_n Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avl_csr
|
||||
#
|
||||
add_interface avl_csr avalon end
|
||||
set_interface_property avl_csr addressUnits WORDS
|
||||
set_interface_property avl_csr associatedClock clock_sink
|
||||
set_interface_property avl_csr associatedReset reset
|
||||
set_interface_property avl_csr bitsPerSymbol 8
|
||||
set_interface_property avl_csr burstOnBurstBoundariesOnly false
|
||||
set_interface_property avl_csr burstcountUnits WORDS
|
||||
set_interface_property avl_csr explicitAddressSpan 0
|
||||
set_interface_property avl_csr holdTime 0
|
||||
set_interface_property avl_csr linewrapBursts false
|
||||
set_interface_property avl_csr maximumPendingReadTransactions 1
|
||||
set_interface_property avl_csr maximumPendingWriteTransactions 0
|
||||
set_interface_property avl_csr readLatency 0
|
||||
set_interface_property avl_csr readWaitTime 0
|
||||
set_interface_property avl_csr setupTime 0
|
||||
set_interface_property avl_csr timingUnits Cycles
|
||||
set_interface_property avl_csr writeWaitTime 0
|
||||
set_interface_property avl_csr ENABLED true
|
||||
set_interface_property avl_csr EXPORT_OF ""
|
||||
set_interface_property avl_csr PORT_NAME_MAP ""
|
||||
set_interface_property avl_csr CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avl_csr SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avl_csr avl_csr_read read Input 1
|
||||
add_interface_port avl_csr avl_csr_waitrequest waitrequest Output 1
|
||||
add_interface_port avl_csr avl_csr_write write Input 1
|
||||
add_interface_port avl_csr avl_csr_addr address Input 3
|
||||
add_interface_port avl_csr avl_csr_wrdata writedata Input 32
|
||||
add_interface_port avl_csr avl_csr_rddata readdata Output 32
|
||||
add_interface_port avl_csr avl_csr_rddata_valid readdatavalid Output 1
|
||||
|
||||
#
|
||||
# connection point avl_mem
|
||||
#
|
||||
add_interface avl_mem avalon end
|
||||
set_interface_property avl_mem addressUnits WORDS
|
||||
set_interface_property avl_mem associatedClock clock_sink
|
||||
set_interface_property avl_mem associatedReset reset
|
||||
set_interface_property avl_mem bitsPerSymbol 8
|
||||
set_interface_property avl_mem burstOnBurstBoundariesOnly false
|
||||
set_interface_property avl_mem burstcountUnits WORDS
|
||||
set_interface_property avl_mem explicitAddressSpan 0
|
||||
set_interface_property avl_mem holdTime 0
|
||||
set_interface_property avl_mem linewrapBursts true
|
||||
set_interface_property avl_mem maximumPendingReadTransactions 1
|
||||
set_interface_property avl_mem maximumPendingWriteTransactions 0
|
||||
set_interface_property avl_mem constantBurstBehavior true
|
||||
set_interface_property avl_mem readLatency 0
|
||||
set_interface_property avl_mem readWaitTime 0
|
||||
set_interface_property avl_mem setupTime 0
|
||||
set_interface_property avl_mem timingUnits Cycles
|
||||
set_interface_property avl_mem writeWaitTime 0
|
||||
set_interface_property avl_mem ENABLED true
|
||||
set_interface_property avl_mem EXPORT_OF ""
|
||||
set_interface_property avl_mem PORT_NAME_MAP ""
|
||||
set_interface_property avl_mem CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avl_mem SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avl_mem avl_mem_write write Input 1
|
||||
add_interface_port avl_mem avl_mem_burstcount burstcount Input 7
|
||||
add_interface_port avl_mem avl_mem_waitrequest waitrequest Output 1
|
||||
add_interface_port avl_mem avl_mem_read read Input 1
|
||||
add_interface_port avl_mem avl_mem_addr address Input ADDR_WIDTH
|
||||
add_interface_port avl_mem avl_mem_wrdata writedata Input 32
|
||||
add_interface_port avl_mem avl_mem_rddata readdata Output 32
|
||||
add_interface_port avl_mem avl_mem_rddata_valid readdatavalid Output 1
|
||||
add_interface_port avl_mem avl_mem_byteenable byteenable Input 4
|
||||
|
||||
#
|
||||
# connection point interrupt_sender
|
||||
#
|
||||
add_interface interrupt_sender interrupt end
|
||||
set_interface_property interrupt_sender associatedAddressablePoint avl_csr
|
||||
set_interface_property interrupt_sender associatedClock clock_sink
|
||||
set_interface_property interrupt_sender associatedReset reset
|
||||
set_interface_property interrupt_sender bridgedReceiverOffset ""
|
||||
set_interface_property interrupt_sender bridgesToReceiver ""
|
||||
set_interface_property interrupt_sender ENABLED true
|
||||
set_interface_property interrupt_sender EXPORT_OF ""
|
||||
set_interface_property interrupt_sender PORT_NAME_MAP ""
|
||||
set_interface_property interrupt_sender CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property interrupt_sender SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port interrupt_sender irq irq Output 1
|
||||
|
||||
proc proc_get_derive_addr_width {flash_type} {
|
||||
switch $flash_type {
|
||||
"EPCS16" - "EPCQ16" {
|
||||
return 19
|
||||
}
|
||||
"EPCS64" - "EPCQ64" {
|
||||
return 21
|
||||
}
|
||||
"EPCS128" - "EPCQ128" {
|
||||
return 22
|
||||
}
|
||||
"EPCQ32" {
|
||||
return 20
|
||||
}
|
||||
"EPCQ256" - "EPCQL256" {
|
||||
return 23
|
||||
}
|
||||
"EPCQ512" - "EPCQL512" {
|
||||
return 24
|
||||
}
|
||||
"EPCQL1024" {
|
||||
return 25
|
||||
}
|
||||
default {
|
||||
# Should never enter this function
|
||||
send_message error "$flash_type is not a valid flash type"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
set all_supported_SPI_list {"EPCS16" "EPCS64" "EPCS128" "EPCQ16" "EPCQ32" "EPCQ64" "EPCQ128" "EPCQ256" \
|
||||
"EPCQ512" "EPCQL256" "EPCQL512" "EPCQL1024"}
|
||||
|
||||
# SPI device selection
|
||||
add_parameter FLASH_TYPE STRING "EPCQ16"
|
||||
set_parameter_property FLASH_TYPE DISPLAY_NAME "Configuration device type"
|
||||
set_parameter_property FLASH_TYPE ALLOWED_RANGES $all_supported_SPI_list
|
||||
set_parameter_property FLASH_TYPE DESCRIPTION "Select targeted EPCS/EPCQ devices"
|
||||
set_parameter_property FLASH_TYPE AFFECTS_GENERATION true
|
||||
set_parameter_property FLASH_TYPE VISIBLE true
|
||||
set_parameter_property FLASH_TYPE DERIVED false
|
||||
|
||||
add_parameter IO_MODE STRING "STANDARD"
|
||||
set_parameter_property IO_MODE DISPLAY_NAME "Choose I/O mode"
|
||||
set_parameter_property IO_MODE ALLOWED_RANGES {"STANDARD" "QUAD"}
|
||||
set_parameter_property IO_MODE DESCRIPTION "Select extended data width when Fast Read operation is enabled"
|
||||
|
||||
add_parameter CHIP_SELS INTEGER "1"
|
||||
set_parameter_property CHIP_SELS DISPLAY_NAME "Number of Chip Selects used"
|
||||
set_parameter_property CHIP_SELS ALLOWED_RANGES {1 2 3}
|
||||
set_parameter_property CHIP_SELS DESCRIPTION "Number of EPCQ(L) devices that are attached and need a CHIPSEL"
|
||||
set_parameter_property CHIP_SELS HDL_PARAMETER true
|
||||
set_parameter_property CHIP_SELS AFFECTS_GENERATION true
|
||||
#
|
||||
# Add instance
|
||||
#
|
||||
proc add_topwrapper_fileset_proc {altera_epcq_controller} {
|
||||
# QSPI that supported for 4-byte addressing - en4b_addr, ex4b_addr
|
||||
set supported_4byte_addr {"EPCQ256" "EPCQ512" "EPCQL256" "EPCQL512" "EPCQL1024" "N25Q512"}
|
||||
set DDASI [ get_parameter_value DDASI ]
|
||||
set DEVICE_FAMILY [ get_parameter_value DEVICE_FAMILY ]
|
||||
set FLASH_TYPE [ get_parameter_value FLASH_TYPE ]
|
||||
set ADDR_WIDTH [ get_parameter_value ADDR_WIDTH ]
|
||||
set is_4byte_addr_support "false"
|
||||
|
||||
# check whether devices supporting multiple flash - only for Arria 10
|
||||
if {[check_device_family_equivalence $DEVICE_FAMILY "Arria 10"]} {
|
||||
set MULTICHIP 1
|
||||
} else {
|
||||
set MULTICHIP 0
|
||||
}
|
||||
|
||||
if { $DDASI eq "1" } {
|
||||
set DDASI_ON 1
|
||||
} else {
|
||||
set DDASI_ON 0
|
||||
}
|
||||
|
||||
if { $FLASH_TYPE eq "EPCS16" || $FLASH_TYPE eq "EPCS64" } {
|
||||
set ENABLE_SID 1
|
||||
} else {
|
||||
set ENABLE_SID 0
|
||||
}
|
||||
|
||||
if { $FLASH_TYPE eq "EPCQL512" || $FLASH_TYPE eq "EPCQL1024" } {
|
||||
set ENABLE_BULK_ERASE 0
|
||||
} else {
|
||||
set ENABLE_BULK_ERASE 1
|
||||
}
|
||||
|
||||
# check whether SPI device support 4-byte addressing
|
||||
foreach re_spi_1 $supported_4byte_addr {
|
||||
if {$re_spi_1 eq $FLASH_TYPE} {
|
||||
set is_4byte_addr_support "true"
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if {$is_4byte_addr_support eq "true"} {
|
||||
set ENABLE_4BYTE_ADDR_CODE 1
|
||||
} else {
|
||||
set ENABLE_4BYTE_ADDR_CODE 0
|
||||
}
|
||||
|
||||
# ---------------------------------
|
||||
# Terp for top level wrapper
|
||||
# ---------------------------------
|
||||
#Do Terp
|
||||
set template_file [ file join "./" "altera_epcq_controller_wrapper.sv.terp" ]
|
||||
set template [ read [ open $template_file r ] ]
|
||||
|
||||
if {$DDASI_ON} {
|
||||
set params(DDASI_ON) "`define DDASI_ON"
|
||||
} else {
|
||||
set params(DDASI_ON) ""
|
||||
}
|
||||
|
||||
if {$MULTICHIP} {
|
||||
set params(MULTICHIP) "`define MULTICHIP"
|
||||
} else {
|
||||
set params(MULTICHIP) ""
|
||||
}
|
||||
|
||||
if {$ENABLE_SID} {
|
||||
set params(SID_EN) "`define ENABLE_SID"
|
||||
} else {
|
||||
set params(SID_EN) ""
|
||||
}
|
||||
|
||||
if {$ENABLE_BULK_ERASE} {
|
||||
set params(BULK_ERASE_EN) "`define ENABLE_BULK_ERASE"
|
||||
} else {
|
||||
set params(BULK_ERASE_EN) ""
|
||||
}
|
||||
|
||||
if {$ENABLE_4BYTE_ADDR_CODE} {
|
||||
set params(4BYTE_ADDR_EN) "`define ENABLE_4BYTE_ADDR_CODE"
|
||||
} else {
|
||||
set params(4BYTE_ADDR_EN) ""
|
||||
}
|
||||
|
||||
set result [ altera_terp $template params ]
|
||||
|
||||
#Add top wrapper file
|
||||
add_fileset_file ./altera_epcq_controller_wrapper.sv SYSTEM_VERILOG TEXT $result
|
||||
}
|
||||
|
||||
# This proc is called by elaboration proc to set embeddedsw C Macros assignments
|
||||
# used by downstream tools
|
||||
proc set_cmacros {is_qspi flash_type} {
|
||||
if {$is_qspi eq "true"} {
|
||||
set_module_assignment embeddedsw.CMacro.IS_EPCS 0
|
||||
} else {
|
||||
set_module_assignment embeddedsw.CMacro.IS_EPCS 1
|
||||
}
|
||||
|
||||
#string name of flash
|
||||
set_module_assignment embeddedsw.CMacro.FLASH_TYPE $flash_type
|
||||
|
||||
#page size in bytes
|
||||
set_module_assignment embeddedsw.CMacro.PAGE_SIZE 256
|
||||
|
||||
#sector and subsector size in bytes
|
||||
set_module_assignment embeddedsw.CMacro.SUBSECTOR_SIZE 4096
|
||||
set_module_assignment embeddedsw.CMacro.SECTOR_SIZE 65536
|
||||
|
||||
#set number of sectors
|
||||
switch $flash_type {
|
||||
"EPCS16" - "EPCQ16" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 32
|
||||
}
|
||||
"EPCQ32" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 64
|
||||
}
|
||||
"EPCS64" - "EPCQ64" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 128
|
||||
}
|
||||
"EPCS128" - "EPCQ128" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 256
|
||||
}
|
||||
"EPCQ256" - "EPCQL256" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 512
|
||||
}
|
||||
"EPCQ512" - "EPCQL512" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 1024
|
||||
}
|
||||
"EPCQL1024" {
|
||||
set_module_assignment embeddedsw.CMacro.NUMBER_OF_SECTORS 2048
|
||||
}
|
||||
default {
|
||||
# Should never enter this function
|
||||
send_message error "$flash_type is not a valid flash type"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc elaboration {} {
|
||||
# QSPI that supported for 4-byte addressing - en4b_addr, ex4b_addr
|
||||
set supported_4byte_addr {"EPCQ256" "EPCQ512" "EPCQL256" "EPCQL512" "EPCQL1024" "N25Q512"}
|
||||
set DDASI_ON [ get_parameter_value DDASI ]
|
||||
set FLASH_TYPE [ get_parameter_value FLASH_TYPE ]
|
||||
set IO_MODE [ get_parameter_value IO_MODE ]
|
||||
set DEVICE_FAMILY [ get_parameter_value DEVICE_FAMILY ]
|
||||
set ASI_WIDTH [ get_parameter_value ASI_WIDTH ]
|
||||
set CS_WIDTH [ get_parameter_value CS_WIDTH ]
|
||||
set ASMI_ADDR_WIDTH [ get_parameter_value ASMI_ADDR_WIDTH ]
|
||||
set CHIP_SELS [ get_parameter_value CHIP_SELS]
|
||||
set temp_addr_width [ proc_get_derive_addr_width [ get_parameter_value FLASH_TYPE ] ]
|
||||
set clkFreq [ get_parameter_value clkFreq ]
|
||||
set is_4byte_addr_support "false"
|
||||
set is_qspi "false"
|
||||
|
||||
# we're not using slow and expensive EPCS flash, thus higher frequency allowed
|
||||
if { $clkFreq > 50000000 } {
|
||||
send_message error "The maximum input clock frequency for Altera Serial Flash controller is 25Mhz."
|
||||
}
|
||||
|
||||
# check whether SPI device support 4-byte addressing
|
||||
foreach re_spi_1 $supported_4byte_addr {
|
||||
if {$re_spi_1 eq $FLASH_TYPE} {
|
||||
set is_4byte_addr_support "true"
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if {$is_4byte_addr_support eq "true"} {
|
||||
set_parameter_value ENABLE_4BYTE_ADDR "1"
|
||||
set_parameter_value ASMI_ADDR_WIDTH 32
|
||||
} else {
|
||||
set_parameter_value ENABLE_4BYTE_ADDR "0"
|
||||
set_parameter_value ASMI_ADDR_WIDTH 24
|
||||
}
|
||||
|
||||
# check whether devices supporting multiple flash - only for Arria 10
|
||||
if {[check_device_family_equivalence $DEVICE_FAMILY "Arria 10"]} {
|
||||
set is_multi_flash_support "true"
|
||||
if {$CHIP_SELS eq 3 } {set_parameter_value ADDR_WIDTH [ expr $temp_addr_width + 2]}
|
||||
if {$CHIP_SELS eq 2 } {set_parameter_value ADDR_WIDTH [ expr $temp_addr_width + 1]}
|
||||
if {$CHIP_SELS eq 1 } {set_parameter_value ADDR_WIDTH $temp_addr_width }
|
||||
} else {
|
||||
set is_multi_flash_support "false"
|
||||
set_parameter_value ADDR_WIDTH $temp_addr_width
|
||||
}
|
||||
|
||||
|
||||
set_instance_parameter_value altera_epcq_controller_core DDASI $DDASI_ON
|
||||
set_instance_parameter_value altera_epcq_controller_core FLASH_TYPE $FLASH_TYPE
|
||||
set_instance_parameter_value altera_epcq_controller_core IO_MODE $IO_MODE
|
||||
set_instance_parameter_value altera_epcq_controller_core ASI_WIDTH $ASI_WIDTH
|
||||
set_instance_parameter_value altera_epcq_controller_core CS_WIDTH $CS_WIDTH
|
||||
set_instance_parameter_value altera_epcq_controller_core CHIP_SELS $CHIP_SELS
|
||||
set_instance_parameter_value altera_epcq_controller_core ASMI_ADDR_WIDTH [ get_parameter_value ASMI_ADDR_WIDTH ]
|
||||
set_instance_parameter_value altera_epcq_controller_core ADDR_WIDTH [ get_parameter_value ADDR_WIDTH ]
|
||||
set_instance_parameter_value altera_epcq_controller_core ENABLE_4BYTE_ADDR [ get_parameter_value ENABLE_4BYTE_ADDR ]
|
||||
|
||||
set QSPI_list {"EPCQ16" "EPCQ32" "EPCQ64" "EPCQ128" "EPCQ256" "EPCQ512" "EPCQL256" "EPCQL512" "EPCQL1024" \
|
||||
"N25Q512" "S25FL127S"}
|
||||
|
||||
# devices that supported QSPI - Quad/Dual data width, asmi_dataout, asmi_sdoin, asmi_dataoe
|
||||
set supported_QSPI_devices_list {"Arria 10" "Cyclone V" "Arria V GZ" "Arria V" "Stratix V"}
|
||||
|
||||
# devices that supported simulation
|
||||
set supported_sim_devices_list {"Arria 10" "Cyclone V" "Arria V GZ" "Arria V" "Stratix V" "MAX 10 FPGA"}
|
||||
|
||||
# check whether is QSPI devices
|
||||
foreach re_spi_0 $QSPI_list {
|
||||
if {$re_spi_0 eq $FLASH_TYPE} {
|
||||
set is_qspi "true"
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if {[check_device_family_equivalence $DEVICE_FAMILY $supported_QSPI_devices_list]} {
|
||||
set is_qspi_devices_list "true"
|
||||
} else {
|
||||
set is_qspi_devices_list "false"
|
||||
}
|
||||
|
||||
if {[check_device_family_equivalence $DEVICE_FAMILY $supported_sim_devices_list]} {
|
||||
set is_sim_devices_list "true"
|
||||
} else {
|
||||
set is_sim_devices_list "false"
|
||||
}
|
||||
|
||||
if {$is_qspi_devices_list eq "true" && $is_qspi eq "true"} {
|
||||
set_parameter_property IO_MODE ENABLED true
|
||||
set_instance_parameter_value altera_asmi_parallel DATA_WIDTH $IO_MODE
|
||||
set_parameter_value ASI_WIDTH 4
|
||||
} else {
|
||||
set_parameter_property IO_MODE ENABLED false
|
||||
set_parameter_value ASI_WIDTH 1
|
||||
}
|
||||
|
||||
if { $FLASH_TYPE eq "EPCQL512" || $FLASH_TYPE eq "EPCQL1024" } {
|
||||
set_instance_parameter_value altera_asmi_parallel gui_bulk_erase false
|
||||
set ENABLE_BULK_ERASE 0
|
||||
} else {
|
||||
set_instance_parameter_value altera_asmi_parallel gui_bulk_erase true
|
||||
set ENABLE_BULK_ERASE 1
|
||||
}
|
||||
|
||||
if { $is_multi_flash_support eq "true"} {
|
||||
set_parameter_value CS_WIDTH 3
|
||||
set_parameter_property CHIP_SELS ENABLED true
|
||||
} else {
|
||||
set_parameter_value CS_WIDTH 1
|
||||
set_parameter_property CHIP_SELS ENABLED false
|
||||
}
|
||||
|
||||
set_instance_parameter_value altera_asmi_parallel EPCS_TYPE $FLASH_TYPE
|
||||
set_instance_parameter_value altera_asmi_parallel gui_fast_read true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_page_write true
|
||||
|
||||
if { $FLASH_TYPE eq "EPCS16" || $FLASH_TYPE eq "EPCS64" } {
|
||||
set_instance_parameter_value altera_asmi_parallel gui_read_sid true
|
||||
} else {
|
||||
set_instance_parameter_value altera_asmi_parallel gui_read_sid false
|
||||
}
|
||||
|
||||
set_instance_parameter_value altera_asmi_parallel gui_read_rdid true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_read_status true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_sector_erase true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_sector_protect true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_wren true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_write true
|
||||
set_instance_parameter_value altera_asmi_parallel gui_read_dummyclk true
|
||||
set_instance_parameter_value altera_asmi_parallel PAGE_SIZE 256
|
||||
set_instance_parameter_value altera_asmi_parallel gui_use_asmiblock $DDASI_ON
|
||||
|
||||
if {$is_sim_devices_list eq "true"} {
|
||||
set_instance_parameter_value altera_asmi_parallel ENABLE_SIM true
|
||||
} else {
|
||||
set_instance_parameter_value altera_asmi_parallel ENABLE_SIM false
|
||||
}
|
||||
|
||||
set_cmacros $is_qspi $FLASH_TYPE
|
||||
}
|
||||
|
||||
# add ASMI PARALLEL
|
||||
add_hdl_instance altera_asmi_parallel altera_asmi_parallel
|
||||
|
||||
# add EPCQ CONTROLLER
|
||||
add_hdl_instance altera_epcq_controller_core altera_epcq_controller_core
|
||||
|
||||
# +-------------------------------------
|
||||
# | Add settings needed by Nios tools
|
||||
# +-------------------------------------
|
||||
# Tells us component is a flash
|
||||
set_module_assignment embeddedsw.memoryInfo.IS_FLASH 1
|
||||
|
||||
# interface assignments for embedded software
|
||||
set_interface_assignment avl_mem embeddedsw.configuration.isFlash 1
|
||||
set_interface_assignment avl_mem embeddedsw.configuration.isMemoryDevice 1
|
||||
set_interface_assignment avl_mem embeddedsw.configuration.isNonVolatileStorage 1
|
||||
set_interface_assignment avl_mem embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
# These assignments tells tools to create byte-addressed .hex files only
|
||||
set_module_assignment embeddedsw.memoryInfo.GENERATE_HEX 1
|
||||
set_module_assignment embeddedsw.memoryInfo.USE_BYTE_ADDRESSING_FOR_HEX 1
|
||||
set_module_assignment embeddedsw.memoryInfo.GENERATE_DAT_SYM 0
|
||||
set_module_assignment embeddedsw.memoryInfo.GENERATE_FLASH 0
|
||||
|
||||
# Width of memory
|
||||
set_module_assignment embeddedsw.memoryInfo.MEM_INIT_DATA_WIDTH 32
|
||||
|
||||
# Output directories for programming files
|
||||
#set_module_assignment embeddedsw.memoryInfo.DAT_SYM_INSTALL_DIR {SIM_DIR}
|
||||
#set_module_assignment embeddedsw.memoryInfo.FLASH_INSTALL_DIR {APP_DIR}
|
||||
set_module_assignment embeddedsw.memoryInfo.HEX_INSTALL_DIR {QPF_DIR}
|
||||
|
||||
# Module assignments related to names of simulation files
|
||||
#set_module_assignment postgeneration.simulation.init_file.param_name {INIT_FILENAME}
|
||||
#set_module_assignment postgeneration.simulation.init_file.type {MEM_INIT}
|
||||
|
||||
# +-------------------------------------
|
||||
# | Add settings needed by DTG tools
|
||||
# +-------------------------------------
|
||||
# add device tree properties
|
||||
set_module_assignment embeddedsw.dts.vendor "altr"
|
||||
set_module_assignment embeddedsw.dts.name "epcq"
|
||||
set_module_assignment embeddedsw.dts.group "epcq"
|
||||
set_module_assignment embeddedsw.dts.compatible "altr,epcq-1.0"
|
||||
|
||||
## Add documentation links for user guide and/or release notes
|
||||
add_documentation_link "User Guide" https://documentation.altera.com/#/link/sfo1400787952932/iga1431459459085
|
||||
add_documentation_link "Release Notes" https://documentation.altera.com/#/link/hco1421698042087/hco1421697689300
|
|
@ -1,260 +0,0 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2014 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ALTERA_EPCQ_CONTROLLER_REGS_H__
|
||||
#define __ALTERA_EPCQ_CONTROLLER_REGS_H__
|
||||
|
||||
#include <io.h>
|
||||
|
||||
/*
|
||||
* EPCQ_RD_STATUS register offset
|
||||
*
|
||||
* The EPCQ_RD_STATUS register contains information from the read status
|
||||
* register operation. A full description of the register can be found in the
|
||||
* data sheet,
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_STATUS_REG (0x0)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_STATUS register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_STATUS(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_STATUS_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_STATUS(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_STATUS_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_STATUS(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_STATUS_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_STATUS register description macros
|
||||
*/
|
||||
|
||||
/** Write in progress bit */
|
||||
#define ALTERA_EPCQ_CONTROLLER_STATUS_WIP_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER_STATUS_WIP_AVAILABLE (0x00000000)
|
||||
#define ALTERA_EPCQ_CONTROLLER_STATUS_WIP_BUSY (0x00000001)
|
||||
/** When to time out a poll of the write in progress bit */
|
||||
/* 0.7 sec time out */
|
||||
#define ALTERA_EPCQ_CONTROLLER_1US_TIMEOUT_VALUE 700000
|
||||
|
||||
/*
|
||||
* EPCQ_RD_SID register offset
|
||||
*
|
||||
* The EPCQ_RD_SID register contains the information from the read silicon ID
|
||||
* operation and can be used to determine what type of EPCS device we have.
|
||||
* Only support in EPCS16 and EPCS64.
|
||||
*
|
||||
* This register is valid only if the device is an EPCS.
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_SID_REG (0x4)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_SID register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_SID(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_SID_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_SID(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_SID_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_SID(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_SID_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_SID register description macros
|
||||
*
|
||||
* Specific device values obtained from Table 14 of:
|
||||
* "Serial Configuration (EPCS) Devices Datasheet"
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_SID_MASK (0x000000FF)
|
||||
#define ALTERA_EPCQ_CONTROLLER_SID_EPCS16 (0x00000014)
|
||||
#define ALTERA_EPCQ_CONTROLLER_SID_EPCS64 (0x00000016)
|
||||
#define ALTERA_EPCQ_CONTROLLER_SID_EPCS128 (0x00000018)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_RDID register offset
|
||||
*
|
||||
* The EPCQ_RD_RDID register contains the information from the read memory
|
||||
* capacity operation and can be used to determine what type of EPCQ device
|
||||
* we have.
|
||||
*
|
||||
* This register is only valid if the device is an EPCQ.
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_REG (0x8)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_RDID register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_RDID(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_RDID_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_RDID(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_RDID_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_RDID(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_RDID_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_RDID register description macros
|
||||
*
|
||||
* Specific device values obtained from Table 28 of:
|
||||
* "Quad-Serial Configuration (EPCQ (www.altera.com/literature/hb/cfg/cfg_cf52012.pdf))
|
||||
* Devices Datasheet"
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_MASK (0x000000FF)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ16 (0x00000015)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ32 (0x00000016)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ64 (0x00000017)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ128 (0x00000018)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ256 (0x00000019)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ512 (0x00000020)
|
||||
#define ALTERA_EPCQ_CONTROLLER_RDID_EPCQ1024 (0x00000021)
|
||||
|
||||
/*
|
||||
* EPCQ_MEM_OP register offset
|
||||
*
|
||||
* The EPCQ_MEM_OP register is used to do memory protect and erase operations
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_REG (0xC)
|
||||
|
||||
/*
|
||||
* EPCQ_MEM_OP register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_MEM_OP(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_MEM_OP_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_MEM_OP(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_MEM_OP_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_MEM_OP(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_MEM_OP_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_MEM_OP register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_CMD_MASK (0x00000003)
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_BULK_ERASE_CMD (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_SECTOR_ERASE_CMD (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_SECTOR_PROTECT_CMD (0x00000003)
|
||||
|
||||
/** see datasheet for sector values */
|
||||
#define ALTERA_EPCQ_CONTROLLER_MEM_OP_SECTOR_VALUE_MASK (0x00FFFF00)
|
||||
|
||||
/*
|
||||
* EPCQ_ISR register offset
|
||||
*
|
||||
* The EPCQ_ISR register is used to determine whether an invalid write or erase
|
||||
* operation triggered an interrupt
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_ISR_REG (0x10)
|
||||
|
||||
/*
|
||||
* EPCQ_ISR register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_ISR(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_ISR_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_ISR(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_ISR_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_ISR(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_ISR_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_ISR register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_ISR_ILLEGAL_ERASE_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER_ISR_ILLEGAL_ERASE_ACTIVE (0x00000001)
|
||||
|
||||
#define ALTERA_EPCQ_CONTROLLER_ISR_ILLEGAL_WRITE_MASK (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER_ISR_ILLEGAL_WRITE_ACTIVE (0x00000002)
|
||||
|
||||
|
||||
/*
|
||||
* EPCQ_IMR register offset
|
||||
*
|
||||
* The EPCQ_IMR register is used to mask the invalid erase or the invalid write
|
||||
* interrupts.
|
||||
*
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_IMR_REG (0x14)
|
||||
|
||||
/*
|
||||
* EPCQ_IMR register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CONTROLLER_IMR(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CONTROLLER_IMR_REG)
|
||||
|
||||
#define IORD_ALTERA_EPCQ_CONTROLLER_IMR(base) \
|
||||
IORD_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_IMR_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CONTROLLER_IMR(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CONTROLLER_IMR_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_IMR register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER_IMR_ILLEGAL_ERASE_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER_IMR_ILLEGAL_ERASE_ENABLED (0x00000001)
|
||||
|
||||
#define ALTERA_EPCQ_CONTROLLER_IMR_ILLEGAL_WRITE_MASK (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER_IMR_ILLEGAL_WRITE_ENABLED (0x00000002)
|
||||
|
||||
/*
|
||||
* EPCQ_CHIP_SELECT register offset
|
||||
*
|
||||
* The EPCQ_CHIP_SELECT register is used to issue chip select
|
||||
*/
|
||||
#define ALTERA_EPCQ_CHIP_SELECT_REG (0x18)
|
||||
|
||||
/*
|
||||
* EPCQ_CHIP_SELECT register access macros
|
||||
*/
|
||||
#define IOADDR_ALTERA_EPCQ_CHIP_SELECT(base) \
|
||||
__IO_CALC_ADDRESS_DYNAMIC(base, ALTERA_EPCQ_CHIP_SELECT_REG)
|
||||
|
||||
#define IOWR_ALTERA_EPCQ_CHIP_SELECT(base, data) \
|
||||
IOWR_32DIRECT(base, ALTERA_EPCQ_CHIP_SELECT_REG, data)
|
||||
|
||||
/*
|
||||
* EPCQ_CHIP_SELECT register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CHIP1_SELECT (0x00000001)
|
||||
#define ALTERA_EPCQ_CHIP2_SELECT (0x00000002)
|
||||
#define ALTERA_EPCQ_CHIP3_SELECT (0x00000003)
|
||||
|
||||
#endif /* __ALTERA_EPCQ_CONTROLLER_REGS_H__ */
|
|
@ -0,0 +1,246 @@
|
|||
package require -exact sopc 9.1
|
||||
|
||||
# +-----------------------------------
|
||||
# | module altera_jtag_avalon_master_mod
|
||||
# |
|
||||
set_module_property NAME altera_jtag_avalon_master_mod
|
||||
set_module_property DESCRIPTION "The JTAG to Avalon Master Bridge is a collection of pre-wired components that provide an Avalon Master using the new JTAG channel."
|
||||
set_module_property VERSION "20.1"
|
||||
set_module_property GROUP "Basic Functions/Bridges and Adaptors/Memory Mapped"
|
||||
set_module_property AUTHOR "Altera Corporation"
|
||||
set_module_property DISPLAY_NAME "JTAG to Avalon Master Bridge (customized)"
|
||||
set_module_property DATASHEET_URL "http://www.altera.com/literature/hb/nios2/qts_qii55011.pdf"
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE false
|
||||
set_module_property ANALYZE_HDL false
|
||||
set_module_property VALIDATION_CALLBACK validate
|
||||
set_module_property COMPOSE_CALLBACK compose
|
||||
|
||||
set_module_assignment debug.hostConnection {type jtag id 110:132}
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | parameters
|
||||
# |
|
||||
add_parameter USE_PLI INTEGER 0
|
||||
set_parameter_property USE_PLI DISPLAY_NAME "Use Simulation Link Mode"
|
||||
set_parameter_property USE_PLI DISPLAY_HINT boolean
|
||||
set_parameter_property USE_PLI UNITS None
|
||||
set_parameter_property USE_PLI HDL_PARAMETER true
|
||||
|
||||
add_parameter PLI_PORT INTEGER 50000
|
||||
set_parameter_property PLI_PORT DISPLAY_NAME "Simulation Link Server Port"
|
||||
set_parameter_property PLI_PORT UNITS None
|
||||
set_parameter_property PLI_PORT VISIBLE true
|
||||
set_parameter_property PLI_PORT ENABLED false
|
||||
set_parameter_property PLI_PORT HDL_PARAMETER true
|
||||
|
||||
add_parameter COMPONENT_CLOCK INTEGER 0
|
||||
set_parameter_property COMPONENT_CLOCK SYSTEM_INFO { CLOCK_RATE clock }
|
||||
set_parameter_property COMPONENT_CLOCK VISIBLE false
|
||||
|
||||
add_parameter FAST_VER "INTEGER" "0" ""
|
||||
set_parameter_property FAST_VER "VISIBLE" true
|
||||
set_parameter_property FAST_VER "DISPLAY_NAME" "Enhanced transaction master"
|
||||
set_parameter_property FAST_VER "DESCRIPTION" "Increase transaction master throughput"
|
||||
set_parameter_property FAST_VER "DISPLAY_HINT" "boolean"
|
||||
set_parameter_property FAST_VER "STATUS" experimental
|
||||
|
||||
add_parameter FIFO_DEPTHS "INTEGER" "2" ""
|
||||
set_parameter_property FIFO_DEPTHS "VISIBLE" true
|
||||
set_parameter_property FIFO_DEPTHS "HDL_PARAMETER" true
|
||||
set_parameter_property FIFO_DEPTHS "ALLOWED_RANGES" "2:8192"
|
||||
set_parameter_property FIFO_DEPTHS "DISPLAY_NAME" "FIFO depth"
|
||||
set_parameter_property FIFO_DEPTHS "DESCRIPTION" "User need to tweak this to find the sweet spot"
|
||||
set_parameter_property FIFO_DEPTHS "STATUS" experimental
|
||||
|
||||
add_parameter USE_MEMORY_BLOCKS INTEGER 0
|
||||
set_parameter_property USE_MEMORY_BLOCKS DISPLAY_NAME "Use memory blocks instead of LEs"
|
||||
set_parameter_property USE_MEMORY_BLOCKS DISPLAY_HINT boolean
|
||||
set_parameter_property USE_MEMORY_BLOCKS UNITS None
|
||||
set_parameter_property USE_MEMORY_BLOCKS HDL_PARAMETER true
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | Validate
|
||||
# |
|
||||
proc validate {} {
|
||||
set use_pli [ get_parameter_value USE_PLI ]
|
||||
set use_fast [ get_parameter_value FAST_VER ]
|
||||
if {$use_pli == ""} {
|
||||
set_parameter_value USE_PLI 0
|
||||
set use_pli 0
|
||||
}
|
||||
if {$use_fast == ""} {
|
||||
set_parameter_value FAST_VER 0
|
||||
set use_fast 0
|
||||
}
|
||||
if {$use_pli == 0} {
|
||||
set_parameter_property PLI_PORT ENABLED false
|
||||
} else {
|
||||
set_parameter_property PLI_PORT ENABLED true
|
||||
}
|
||||
if {$use_fast == 0} {
|
||||
set_parameter_property FIFO_DEPTHS ENABLED false
|
||||
} else {
|
||||
set_parameter_property FIFO_DEPTHS ENABLED true
|
||||
}
|
||||
}
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | Compose
|
||||
# |
|
||||
proc compose {} {
|
||||
|
||||
# +-----------------------------------
|
||||
# | submodule instantiation
|
||||
# |
|
||||
#add_instance clk_src clock_source
|
||||
add_instance clk_src altera_clock_bridge
|
||||
add_instance clk_rst altera_reset_bridge
|
||||
add_instance jtag_phy_embedded_in_jtag_master altera_jtag_dc_streaming
|
||||
add_instance timing_adt timing_adapter
|
||||
add_instance fifo altera_avalon_sc_fifo
|
||||
add_instance b2p altera_avalon_st_bytes_to_packets
|
||||
add_instance p2b altera_avalon_st_packets_to_bytes
|
||||
add_instance transacto altera_avalon_packets_to_master
|
||||
add_instance b2p_adapter channel_adapter
|
||||
add_instance p2b_adapter channel_adapter
|
||||
|
||||
# altera_reset_bridge parameters
|
||||
set_instance_parameter clk_rst SYNCHRONOUS_EDGES none
|
||||
# altera_jtag_dc_streaming parameters
|
||||
set_instance_parameter jtag_phy_embedded_in_jtag_master PURPOSE 1
|
||||
set_instance_parameter jtag_phy_embedded_in_jtag_master DOWNSTREAM_FIFO_SIZE 64
|
||||
set_instance_parameter jtag_phy_embedded_in_jtag_master USE_PLI [ get_parameter_value USE_PLI ]
|
||||
set_instance_parameter jtag_phy_embedded_in_jtag_master PLI_PORT [ get_parameter_value PLI_PORT ]
|
||||
# timing adapter parameters
|
||||
set_instance_parameter timing_adt inBitsPerSymbol 8
|
||||
set_instance_parameter timing_adt inChannelWidth 0
|
||||
set_instance_parameter timing_adt inErrorWidth 0
|
||||
set_instance_parameter timing_adt inMaxChannel 0
|
||||
set_instance_parameter timing_adt inReadyLatency 0
|
||||
set_instance_parameter timing_adt inSymbolsPerBeat 1
|
||||
set_instance_parameter timing_adt inUseEmpty false
|
||||
set_instance_parameter timing_adt inUseEmptyPort NO
|
||||
set_instance_parameter timing_adt inUsePackets false
|
||||
set_instance_parameter timing_adt inUseReady [ get_parameter_value USE_PLI ]
|
||||
set_instance_parameter timing_adt inUseValid true
|
||||
set_instance_parameter timing_adt outReadyLatency 0
|
||||
set_instance_parameter timing_adt outUseReady true
|
||||
set_instance_parameter timing_adt outUseValid true
|
||||
# b2p channel adapter parameters
|
||||
set_instance_parameter b2p_adapter inBitsPerSymbol 8
|
||||
set_instance_parameter b2p_adapter inChannelWidth 8
|
||||
set_instance_parameter b2p_adapter inErrorWidth 0
|
||||
set_instance_parameter b2p_adapter inMaxChannel 255
|
||||
set_instance_parameter b2p_adapter inReadyLatency 0
|
||||
set_instance_parameter b2p_adapter inSymbolsPerBeat 1
|
||||
set_instance_parameter b2p_adapter inUseEmpty false
|
||||
set_instance_parameter b2p_adapter inUseEmptyPort AUTO
|
||||
set_instance_parameter b2p_adapter inUsePackets true
|
||||
set_instance_parameter b2p_adapter inUseReady true
|
||||
set_instance_parameter b2p_adapter outChannelWidth 0
|
||||
set_instance_parameter b2p_adapter outMaxChannel 0
|
||||
# p2b channel adapter parameters
|
||||
set_instance_parameter p2b_adapter inBitsPerSymbol 8
|
||||
set_instance_parameter p2b_adapter inChannelWidth 0
|
||||
set_instance_parameter p2b_adapter inErrorWidth 0
|
||||
set_instance_parameter p2b_adapter inMaxChannel 0
|
||||
set_instance_parameter p2b_adapter inReadyLatency 0
|
||||
set_instance_parameter p2b_adapter inSymbolsPerBeat 1
|
||||
set_instance_parameter p2b_adapter inUseEmpty false
|
||||
set_instance_parameter p2b_adapter inUseEmptyPort AUTO
|
||||
set_instance_parameter p2b_adapter inUsePackets true
|
||||
set_instance_parameter p2b_adapter inUseReady true
|
||||
set_instance_parameter p2b_adapter outChannelWidth 8
|
||||
set_instance_parameter p2b_adapter outMaxChannel 255
|
||||
# sc fifo parameters
|
||||
set_instance_parameter fifo SYMBOLS_PER_BEAT 1
|
||||
set_instance_parameter fifo BITS_PER_SYMBOL 8
|
||||
set_instance_parameter fifo FIFO_DEPTH 64
|
||||
set_instance_parameter fifo CHANNEL_WIDTH 0
|
||||
set_instance_parameter fifo ERROR_WIDTH 0
|
||||
set_instance_parameter fifo USE_PACKETS 0
|
||||
set_instance_parameter fifo USE_FILL_LEVEL 0
|
||||
set_instance_parameter fifo USE_STORE_FORWARD 0
|
||||
set_instance_parameter fifo USE_ALMOST_FULL_IF 0
|
||||
set_instance_parameter fifo USE_ALMOST_EMPTY_IF 0
|
||||
set_instance_parameter fifo USE_MEMORY_BLOCKS [ get_parameter_value USE_MEMORY_BLOCKS ]
|
||||
# transacto parameters
|
||||
set_instance_parameter transacto EXPORT_MASTER_SIGNALS 0
|
||||
set_instance_parameter transacto FAST_VER [ get_parameter_value FAST_VER ]
|
||||
set_instance_parameter transacto FIFO_DEPTHS [ get_parameter_value FIFO_DEPTHS ]
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point clk
|
||||
# |
|
||||
add_interface clk clock end
|
||||
set_interface_property clk export_of clk_src.in_clk
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | connection point clk_reset
|
||||
# |
|
||||
add_interface clk_reset reset end
|
||||
set_interface_property clk_reset export_of clk_rst.in_reset
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | connection point master
|
||||
# |
|
||||
add_interface master avalon start
|
||||
set_interface_property master export_of transacto.avalon_master
|
||||
set_interface_assignment master debug.providesServices master
|
||||
set_interface_assignment master debug.visible true
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | connection point master_reset
|
||||
# |
|
||||
add_interface master_reset reset start
|
||||
set_interface_property master_reset export_of jtag_phy_embedded_in_jtag_master.resetrequest
|
||||
# |
|
||||
# +-----------------------------------
|
||||
# +-----------------------------------
|
||||
# | submodule interface connections
|
||||
# |
|
||||
add_connection clk_src.out_clk jtag_phy_embedded_in_jtag_master.clock
|
||||
add_connection clk_src.out_clk timing_adt.clk
|
||||
add_connection clk_src.out_clk fifo.clk
|
||||
add_connection clk_src.out_clk b2p.clk
|
||||
add_connection clk_src.out_clk p2b.clk
|
||||
add_connection clk_src.out_clk transacto.clk
|
||||
add_connection clk_src.out_clk b2p_adapter.clk
|
||||
add_connection clk_src.out_clk p2b_adapter.clk
|
||||
|
||||
add_connection clk_rst.out_reset jtag_phy_embedded_in_jtag_master.clock_reset
|
||||
add_connection clk_rst.out_reset timing_adt.reset
|
||||
add_connection clk_rst.out_reset fifo.clk_reset
|
||||
add_connection clk_rst.out_reset b2p.clk_reset
|
||||
add_connection clk_rst.out_reset p2b.clk_reset
|
||||
add_connection clk_rst.out_reset transacto.clk_reset
|
||||
add_connection clk_rst.out_reset b2p_adapter.reset
|
||||
add_connection clk_rst.out_reset p2b_adapter.reset
|
||||
|
||||
add_connection jtag_phy_embedded_in_jtag_master.src timing_adt.in
|
||||
add_connection timing_adt.out fifo.in
|
||||
add_connection fifo.out b2p.in_bytes_stream
|
||||
add_connection b2p.out_packets_stream b2p_adapter.in
|
||||
add_connection b2p_adapter.out transacto.in_stream
|
||||
add_connection transacto.out_stream p2b_adapter.in
|
||||
add_connection p2b_adapter.out p2b.in_packets_stream
|
||||
add_connection p2b.out_bytes_stream jtag_phy_embedded_in_jtag_master.sink
|
||||
# |
|
||||
# +-----------------------------------
|
||||
}
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
|
||||
## Add documentation links for user guide and/or release notes
|
||||
add_documentation_link "User Guide" https://documentation.altera.com/#/link/sfo1400787952932/iga1401396548170
|
|
@ -1,56 +0,0 @@
|
|||
// (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
// Your use of Altera Corporation's design tools, logic functions and other
|
||||
// software and tools, and its AMPP partner logic functions, and any output
|
||||
// files any of the foregoing (including device programming or simulation
|
||||
// files), and any associated documentation or information are expressly subject
|
||||
// to the terms and conditions of the Altera Program License Subscription
|
||||
// Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
// license agreement, including, without limitation, that your use is for the
|
||||
// sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
// Altera or its authorized distributors. Please refer to the applicable
|
||||
// agreement for further details.
|
||||
|
||||
|
||||
//Legal Notice: (C)2010 Altera Corporation. All rights reserved. Your
|
||||
//use of Altera Corporation's design tools, logic functions and other
|
||||
//software and tools, and its AMPP partner logic functions, and any
|
||||
//output files any of the foregoing (including device programming or
|
||||
//simulation files), and any associated documentation or information are
|
||||
//expressly subject to the terms and conditions of the Altera Program
|
||||
//License Subscription Agreement or other applicable license agreement,
|
||||
//including, without limitation, that your use is for the sole purpose
|
||||
//of programming logic devices manufactured by Altera and sold by Altera
|
||||
//or its authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
|
||||
// synthesis translate_off
|
||||
`timescale 1ns / 1ps
|
||||
// synthesis translate_on
|
||||
|
||||
// turn off superfluous verilog processor warnings
|
||||
// altera message_level Level1
|
||||
// altera message_off 10034 10035 10036 10037 10230 10240 10030
|
||||
|
||||
module endianconverter_qsys (
|
||||
// inputs:
|
||||
dataa,
|
||||
datab,
|
||||
|
||||
// outputs:
|
||||
result
|
||||
)
|
||||
;
|
||||
|
||||
output [ 31: 0] result;
|
||||
input [ 31: 0] dataa;
|
||||
input [ 31: 0] datab;
|
||||
|
||||
wire [ 31: 0] result;
|
||||
//s1, which is an e_custom_instruction_slave
|
||||
assign result[7 : 0] = dataa[31 : 24];
|
||||
assign result[15 : 8] = dataa[23 : 16];
|
||||
assign result[23 : 16] = dataa[15 : 8];
|
||||
assign result[31 : 24] = dataa[7 : 0];
|
||||
|
||||
endmodule
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
# TCL File Generated by Component Editor 10.1
|
||||
# Tue Aug 17 15:04:48 MYT 2010
|
||||
# DO NOT MODIFY
|
||||
|
||||
|
||||
# +-----------------------------------
|
||||
# |
|
||||
# |
|
||||
# | ./converter_0.v syn, sim
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | request TCL package from ACDS 10.1
|
||||
# |
|
||||
package require -exact sopc 10.1
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | module altera_nios_custom_instr_endian_converter
|
||||
# |
|
||||
set_module_property NAME altera_nios_custom_instr_endianconverter
|
||||
set_module_property VERSION "__VERSION_SHORT__"
|
||||
set_module_property INTERNAL false
|
||||
set_module_property GROUP "Custom Instruction Modules"
|
||||
set_module_property AUTHOR "Altera Corporation"
|
||||
set_module_property DISPLAY_NAME "Endian Converter"
|
||||
set_module_property HIDE_FROM_SOPC true
|
||||
set_module_property TOP_LEVEL_HDL_FILE endianconverter_qsys.v
|
||||
set_module_property TOP_LEVEL_HDL_MODULE endianconverter_qsys
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property SIMULATION_MODEL_IN_VHDL true
|
||||
set_module_property EDITABLE false
|
||||
set_module_property ANALYZE_HDL FALSE
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | files
|
||||
# |
|
||||
add_file endianconverter_qsys.v {SYNTHESIS SIMULATION}
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | parameters
|
||||
# |
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | display items
|
||||
# |
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point s1
|
||||
# |
|
||||
add_interface s1 nios_custom_instruction end
|
||||
set_interface_property s1 clockCycle 1
|
||||
set_interface_property s1 operands 1
|
||||
|
||||
set_interface_property s1 ENABLED true
|
||||
|
||||
add_interface_port s1 dataa dataa Input 32
|
||||
add_interface_port s1 datab datab Input 32
|
||||
add_interface_port s1 result result Output 32
|
||||
# |
|
||||
# +-----------------------------------
|
|
@ -1,159 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
# TCL File Generated by Component Editor 8.0
|
||||
# Mon Dec 22 17:22:07 EST 2008
|
||||
# DO NOT MODIFY
|
||||
|
||||
set aup_version 15.1
|
||||
|
||||
|
||||
|
||||
# +-----------------------------------
|
||||
# |
|
||||
# | Altera_UP_SD_Card_Avalon_Interface "Altera_UP_SD_Card_Avalon_Interface" v1.0
|
||||
# | null 2008.12.22.17:22:07
|
||||
# | A module that allows communication with an SD Card
|
||||
# |
|
||||
# | ./hdl/Altera_UP_SD_Card_Avalon_Interface.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_48_bit_Command_Generator.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Buffer.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Clock.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Control_FSM.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Interface.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Memory_Block.qip syn
|
||||
# | ./hdl/Altera_UP_SD_Card_Response_Receiver.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_CRC16_Generator.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_CRC7_Generator.vhd syn
|
||||
# | ./hdl/Altera_UP_SD_Signal_Trigger.vhd syn
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
|
||||
# +-----------------------------------
|
||||
# | module Altera_UP_SD_Card_Avalon_Interface
|
||||
# |
|
||||
set_module_property DESCRIPTION "A module that allows communication with an SD Card"
|
||||
set_module_property NAME Altera_UP_SD_Card_Avalon_Interface_mod
|
||||
set_module_property VERSION $aup_version
|
||||
set_module_property GROUP "Memory"
|
||||
set_module_property DISPLAY_NAME "SD Card Interface"
|
||||
set_module_property DATASHEET_URL "[pwd]/doc/SD_Card_Interface_for_SoPC_Builder.pdf"
|
||||
set_module_property LIBRARIES {ieee.std_logic_1164.all ieee.std_logic_arith.all ieee.std_logic_unsigned.all std.standard.all}
|
||||
set_module_property TOP_LEVEL_HDL_FILE "hdl/Altera_UP_SD_Card_Avalon_Interface.vhd"
|
||||
set_module_property TOP_LEVEL_HDL_MODULE Altera_UP_SD_Card_Avalon_Interface
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE false
|
||||
#set_module_property ANALYZE_HDL false
|
||||
set_module_property SIMULATION_MODEL_IN_VERILOG false
|
||||
set_module_property SIMULATION_MODEL_IN_VHDL false
|
||||
set_module_property SIMULATION_MODEL_HAS_TULIPS false
|
||||
set_module_property SIMULATION_MODEL_IS_OBFUSCATED false
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | files
|
||||
# |
|
||||
add_file hdl/Altera_UP_SD_Card_Avalon_Interface.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_48_bit_Command_Generator.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Buffer.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Clock.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Control_FSM.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Interface.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Response_Receiver.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_CRC16_Generator.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_CRC7_Generator.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Signal_Trigger.vhd {SYNTHESIS}
|
||||
add_file hdl/Altera_UP_SD_Card_Memory_Block.vhd {SYNTHESIS}
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | parameters
|
||||
# |
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point avalon_sdcard_slave
|
||||
# |
|
||||
add_interface avalon_sdcard_slave avalon end
|
||||
set_interface_property avalon_sdcard_slave holdTime 0
|
||||
set_interface_property avalon_sdcard_slave linewrapBursts false
|
||||
set_interface_property avalon_sdcard_slave minimumUninterruptedRunLength 1
|
||||
set_interface_property avalon_sdcard_slave bridgesToMaster ""
|
||||
set_interface_property avalon_sdcard_slave isMemoryDevice false
|
||||
set_interface_property avalon_sdcard_slave burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_sdcard_slave addressSpan 1024
|
||||
set_interface_property avalon_sdcard_slave timingUnits Cycles
|
||||
set_interface_property avalon_sdcard_slave setupTime 0
|
||||
set_interface_property avalon_sdcard_slave writeWaitTime 0
|
||||
set_interface_property avalon_sdcard_slave isNonVolatileStorage false
|
||||
set_interface_property avalon_sdcard_slave addressAlignment DYNAMIC
|
||||
set_interface_property avalon_sdcard_slave maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_sdcard_slave readWaitTime 1
|
||||
set_interface_property avalon_sdcard_slave readLatency 0
|
||||
set_interface_property avalon_sdcard_slave printableDevice false
|
||||
|
||||
set_interface_property avalon_sdcard_slave associatedClock clk
|
||||
set_interface_property avalon_sdcard_slave associatedReset reset
|
||||
|
||||
add_interface_port avalon_sdcard_slave i_avalon_chip_select chipselect Input 1
|
||||
add_interface_port avalon_sdcard_slave i_avalon_address address Input 8
|
||||
add_interface_port avalon_sdcard_slave i_avalon_read read Input 1
|
||||
add_interface_port avalon_sdcard_slave i_avalon_write write Input 1
|
||||
add_interface_port avalon_sdcard_slave i_avalon_byteenable byteenable Input 4
|
||||
add_interface_port avalon_sdcard_slave i_avalon_writedata writedata Input 32
|
||||
add_interface_port avalon_sdcard_slave o_avalon_readdata readdata Output 32
|
||||
add_interface_port avalon_sdcard_slave o_avalon_waitrequest waitrequest Output 1
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point clk
|
||||
# |
|
||||
add_interface clk clock end
|
||||
set_interface_property clk enabled true
|
||||
|
||||
add_interface_port clk i_clock clk Input 1
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point reset
|
||||
# |
|
||||
add_interface reset reset end
|
||||
set_interface_property reset associatedClock clk
|
||||
set_interface_property reset enabled true
|
||||
set_interface_property reset synchronousEdges DEASSERT
|
||||
|
||||
add_interface_port reset i_reset_n reset_n Input 1
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
# +-----------------------------------
|
||||
# | connection point conduit_end
|
||||
# |
|
||||
add_interface conduit_end conduit end
|
||||
|
||||
add_interface_port conduit_end b_SD_cmd export Bidir 1
|
||||
add_interface_port conduit_end b_SD_dat export Bidir 1
|
||||
add_interface_port conduit_end b_SD_dat3 export Bidir 1
|
||||
add_interface_port conduit_end o_SD_clock export Output 1
|
||||
# |
|
||||
# +-----------------------------------
|
||||
|
||||
## Add documentation links for user guide and/or release notes
|
||||
add_documentation_link "User Guide" file:///ip/altera/university_program/memory/altera_up_sd_card_avalon_interface/doc/SD_Card_Interface_for_SoPC_Builder.pdf
|
||||
add_documentation_link "Release Notes" https://documentation.altera.com/#/link/hco1421698042087/hco1421698013408
|
|
@ -1,56 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
# TCL File Generated by Altera University Program
|
||||
# DO NOT MODIFY
|
||||
|
||||
set aup_version 15.1
|
||||
|
||||
# Create a new driver - this name must be different than the
|
||||
# hardware component name
|
||||
create_driver Altera_UP_SD_Card_Avalon_Interface_mod_driver
|
||||
|
||||
# Associate it with some hardware
|
||||
set_sw_property hw_class_name Altera_UP_SD_Card_Avalon_Interface_mod
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version $aup_version
|
||||
|
||||
# This driver is proclaimed to be compatible with 'component'
|
||||
# as old as version "1.0". The component hardware version is set in the
|
||||
# _hw.tcl file - If the hardware component version number is not equal
|
||||
# or greater than the min_compatable_hw_version number, the driver
|
||||
# source files will not be copied over to the BSP driver directory
|
||||
set_sw_property min_compatible_hw_version 15.1
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize true
|
||||
|
||||
# Location in generated BSP that sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
#
|
||||
# Source file listings...
|
||||
#
|
||||
|
||||
# C/C++ source files
|
||||
add_sw_property c_source HAL/src/Altera_UP_SD_Card_Avalon_Interface_mod.c
|
||||
|
||||
# Include files
|
||||
add_sw_property include_source HAL/inc/Altera_UP_SD_Card_Avalon_Interface_mod.h
|
||||
|
||||
# This driver supports HAL type
|
||||
add_sw_property supported_bsp_type HAL
|
||||
|
||||
# End of file
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
#ifndef __ALTERA_UP_SD_CARD_AVALON_INTERFACE_H__
|
||||
#define __ALTERA_UP_SD_CARD_AVALON_INTERFACE_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <alt_types.h>
|
||||
#include <sys/alt_dev.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define SD_RAW_IFACE
|
||||
|
||||
/*
|
||||
* Device structure definition. Each instance of the driver uses one
|
||||
* of these structures to hold its associated state.
|
||||
*/
|
||||
typedef struct alt_up_sd_card_dev {
|
||||
/// @brief character mode device structure
|
||||
/// @sa Developing Device Drivers for the HAL in Nios II Software Developer's Handbook
|
||||
alt_dev dev;
|
||||
/// @brief the base address of the device
|
||||
unsigned int base;
|
||||
|
||||
} alt_up_sd_card_dev;
|
||||
|
||||
#ifndef bool
|
||||
typedef enum e_bool { false = 0, true = 1 } bool;
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HAL system functions
|
||||
|
||||
alt_up_sd_card_dev* alt_up_sd_card_open_dev(const char *name);
|
||||
/* Open an SD Card Interface if it is connected to the system. */
|
||||
|
||||
|
||||
bool alt_up_sd_card_is_Present(void);
|
||||
/* Check if there is an SD Card insterted into the SD Card socket.
|
||||
*/
|
||||
|
||||
#ifndef SD_RAW_IFACE
|
||||
bool alt_up_sd_card_is_FAT16(void);
|
||||
/* This function reads the SD card data in an effort to determine if the card is formated as a FAT16
|
||||
* volume. Please note that FAT12 has a similar format, but will not be supported by this driver.
|
||||
*/
|
||||
|
||||
|
||||
short int alt_up_sd_card_fopen(char *name, bool create);
|
||||
/* This function reads the SD card data in an effort to determine if the card is formated as a FAT16
|
||||
* volume. Please note that FAT12 has a similar format, but will not be supported by this driver.
|
||||
*
|
||||
* Inputs:
|
||||
* name - a file name including a directory, relative to the root directory
|
||||
* create - a flag set to true to create a file if it does not already exist
|
||||
* Output:
|
||||
* An index to the file record assigned to the specified file. -1 is returned if the file could not be opened.
|
||||
*/
|
||||
|
||||
|
||||
short int alt_up_sd_card_find_first(char *directory_to_search_through, char *file_name);
|
||||
/* This function sets up a search algorithm to go through a given directory looking for files.
|
||||
* If the search directory is valid, then the function searches for the first file it finds.
|
||||
* Inputs:
|
||||
* directory_to_search_through - name of the directory to search through
|
||||
* file_name - an array to store a name of the file found. Must be 13 bytes long (12 bytes for file name and 1 byte of NULL termination).
|
||||
* Outputs:
|
||||
* 0 - success
|
||||
* 1 - invalid directory
|
||||
* 2 - No card or incorrect card format.
|
||||
*
|
||||
* To specify a directory give the name in a format consistent with the following regular expression:
|
||||
* [{[valid_chars]+}/]*.
|
||||
*
|
||||
* In other words, give a path name starting at the root directory, where each directory name is followed by a '/'.
|
||||
* Then, append a '.' to the directory name. Examples:
|
||||
* "." - look through the root directory
|
||||
* "first/." - look through a directory named "first" that is located in the root directory.
|
||||
* "first/sub/." - look through a directory named "sub", that is located within the subdirectory named "first". "first" is located in the root directory.
|
||||
* Invalid examples include:
|
||||
* "/.", "/////." - this is not the root directory.
|
||||
* "/first/." - the first character may not be a '/'.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
short int alt_up_sd_card_find_next(char *file_name);
|
||||
/* This function searches for the next file in a given directory, as specified by the find_first function.
|
||||
* Inputs:
|
||||
* file_name - an array to store a name of the file found. Must be 13 bytes long (12 bytes for file name and 1 byte of NULL termination).
|
||||
* Outputs:
|
||||
* -1 - end of directory.
|
||||
* 0 - success
|
||||
* 2 - No card or incorrect card format.
|
||||
* 4 - find_first has not been called successfully.
|
||||
*/
|
||||
|
||||
void alt_up_sd_card_set_attributes(short int file_handle, short int attributes);
|
||||
/* Set file attributes as needed.
|
||||
*/
|
||||
|
||||
short int alt_up_sd_card_get_attributes(short int file_handle);
|
||||
/* Return file attributes, or -1 if the file_handle is invalid.
|
||||
*/
|
||||
|
||||
|
||||
short int alt_up_sd_card_read(short int file_handle);
|
||||
/* Read a single character from the given file. Return -1 if at the end of a file. Any other negative number
|
||||
* means that the file could not be read. A number between 0 and 255 is an ASCII character read from the SD Card. */
|
||||
|
||||
|
||||
bool alt_up_sd_card_write(short int file_handle, char byte_of_data);
|
||||
/* Write a single character to a given file. Return true if successful, and false otherwise. */
|
||||
|
||||
|
||||
bool alt_up_sd_card_fclose(short int file_handle);
|
||||
// This function closes an opened file and saves data to SD Card if necessary.
|
||||
|
||||
#else
|
||||
bool Write_Sector_Data(int sector_index, int partition_offset);
|
||||
bool Save_Modified_Sector();
|
||||
bool Read_Sector_Data(int sector_index, int partition_offset);
|
||||
#endif //SD_RAW_IFACE
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// file-like operation functions
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// direct operation functions
|
||||
|
||||
|
||||
/*
|
||||
* Macros used by alt_sys_init
|
||||
*/
|
||||
#define ALTERA_UP_SD_CARD_AVALON_INTERFACE_MOD_INSTANCE(name, device) \
|
||||
static alt_up_sd_card_dev device = \
|
||||
{ \
|
||||
{ \
|
||||
ALT_LLIST_ENTRY, \
|
||||
name##_NAME, \
|
||||
NULL , /* open */ \
|
||||
NULL , /* close */ \
|
||||
NULL, /* read */ \
|
||||
NULL, /* write */ \
|
||||
NULL , /* lseek */ \
|
||||
NULL , /* fstat */ \
|
||||
NULL , /* ioctl */ \
|
||||
}, \
|
||||
name##_BASE, \
|
||||
}
|
||||
|
||||
#define ALTERA_UP_SD_CARD_AVALON_INTERFACE_MOD_INIT(name, device) \
|
||||
{ \
|
||||
alt_dev_reg(&device.dev); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __ALTERA_UP_SD_CARD_AVALON_INTERFACE_H__ */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,79 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------
|
||||
-- This generates the necessary 16-CRC for Command and Response
|
||||
-- Implementation: serial input/parallel output
|
||||
-- When input stream ends, the crcout output is the CRC checksum for them
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
----------------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity Altera_UP_SD_CRC16_Generator is
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_sync_reset : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_CRC16_Generator is
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal shift_register : std_logic_vector(15 downto 0);
|
||||
begin
|
||||
|
||||
process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
shift_register <= (OTHERS => '0');
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_sync_reset = '1') then
|
||||
shift_register <= (OTHERS => '0');
|
||||
elsif (i_enable = '1') then
|
||||
if (i_shift = '0') then
|
||||
shift_register(0) <= i_datain XOR shift_register(15);
|
||||
shift_register(4 downto 1) <= shift_register(3 downto 0);
|
||||
shift_register(5) <= shift_register(4) XOR i_datain XOR shift_register(15);
|
||||
shift_register(11 downto 6) <= shift_register(10 downto 5);
|
||||
shift_register(12) <= shift_register(11) XOR i_datain XOR shift_register(15);
|
||||
shift_register(15 downto 13) <= shift_register(14 downto 12);
|
||||
else -- shift CRC out (no more calculation now)
|
||||
shift_register(15 downto 1) <= shift_register(14 downto 0);
|
||||
shift_register(0) <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
o_dataout <= shift_register(15);
|
||||
o_crcout <= shift_register;
|
||||
end rtl;
|
||||
|
||||
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- This generates the necessary 7-CRC for Command and Response
|
||||
-- Implementation: serial input/parallel output
|
||||
--
|
||||
-- When input stream ends, the crcout output is the CRC checksum for the input stream.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity Altera_UP_SD_CRC7_Generator is
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(6 downto 0)
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_CRC7_Generator is
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal shift_register : std_logic_vector(6 downto 0);
|
||||
begin
|
||||
|
||||
process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
shift_register <= (OTHERS => '0');
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_enable = '1') then
|
||||
if (i_shift = '0') then
|
||||
shift_register(0) <= i_datain XOR shift_register(6);
|
||||
shift_register(1) <= shift_register(0);
|
||||
shift_register(2) <= shift_register(1);
|
||||
shift_register(3) <= shift_register(2) XOR i_datain XOR shift_register(6);
|
||||
shift_register(4) <= shift_register(3);
|
||||
shift_register(5) <= shift_register(4);
|
||||
shift_register(6) <= shift_register(5);
|
||||
else -- shift CRC out (no more calculation now)
|
||||
shift_register(0) <= '0';
|
||||
shift_register(6 downto 1) <= shift_register(5 downto 0);
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
o_dataout <= shift_register(6);
|
||||
o_crcout <= shift_register;
|
||||
end rtl;
|
||||
|
|
@ -1,570 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-- This module takes a command ID and data, and generates a 48-bit message for it.
|
||||
-- It will first check if the command is a valid 48-bit command and produce the
|
||||
-- following outputs:
|
||||
-- 1. o_dataout -> a single bit output that produces the message to be sent to the
|
||||
-- SD card one bit at a time. Every time the i_message_bit_out input
|
||||
-- is high and the i_clock has a positive edge, a new bit is produced.
|
||||
-- 2. o_message_done -> a signal that is asserted high when the entire message has been
|
||||
-- produced through the o_dataout output.
|
||||
-- 3. o_valid -> is a signal that is asserted high if the specified message is valid.
|
||||
-- 4. o_response_type -> indicates the command response type.
|
||||
-- 5. o_returning_ocr -> the response from the SD card will contain the OCR register
|
||||
-- 6. o_returning_cid -> the response from the SD card will contain the CID register
|
||||
-- 7. o_returning_rca -> the response from the SD card will contain the RCA register
|
||||
-- 8. o_returning_csd -> the response from the SD card will contain the CSD register
|
||||
-- 9. o_data_read -> asserted when the command being sent is a data read command.
|
||||
-- 10. o_data_write -> asserted when the command being sent is a data write command.
|
||||
-- 11. o_wait_cmd_busy -> is set high when the response to this command will be
|
||||
-- followed by a busy signal.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
-------------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_48_bit_Command_Generator is
|
||||
generic (
|
||||
-- Basic commands
|
||||
COMMAND_0_GO_IDLE : STD_LOGIC_VECTOR(5 downto 0) := "000000";
|
||||
COMMAND_2_ALL_SEND_CID : STD_LOGIC_VECTOR(5 downto 0) := "000010";
|
||||
COMMAND_3_SEND_RCA : STD_LOGIC_VECTOR(5 downto 0) := "000011";
|
||||
COMMAND_4_SET_DSR : STD_LOGIC_VECTOR(5 downto 0) := "000100";
|
||||
COMMAND_6_SWITCH_FUNCTION : STD_LOGIC_VECTOR(5 downto 0) := "000110";
|
||||
COMMAND_7_SELECT_CARD : STD_LOGIC_VECTOR(5 downto 0) := "000111";
|
||||
COMMAND_9_SEND_CSD : STD_LOGIC_VECTOR(5 downto 0) := "001001";
|
||||
COMMAND_10_SEND_CID : STD_LOGIC_VECTOR(5 downto 0) := "001010";
|
||||
COMMAND_12_STOP_TRANSMISSION : STD_LOGIC_VECTOR(5 downto 0) := "001100";
|
||||
COMMAND_13_SEND_STATUS : STD_LOGIC_VECTOR(5 downto 0) := "001101";
|
||||
COMMAND_15_GO_INACTIVE : STD_LOGIC_VECTOR(5 downto 0) := "001111";
|
||||
-- Block oriented read/write/lock commands
|
||||
COMMAND_16_SET_BLOCK_LENGTH : STD_LOGIC_VECTOR(5 downto 0) := "010000";
|
||||
-- Block oriented read commands
|
||||
COMMAND_17_READ_BLOCK : STD_LOGIC_VECTOR(5 downto 0) := "010001";
|
||||
COMMAND_18_READ_MULTIPLE_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "010010";
|
||||
-- Block oriented write commands
|
||||
COMMAND_24_WRITE_BLOCK : STD_LOGIC_VECTOR(5 downto 0) := "011000";
|
||||
COMMAND_25_WRITE_MULTIPLE_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "011001";
|
||||
COMMAND_27_PROGRAM_CSD : STD_LOGIC_VECTOR(5 downto 0) := "011011";
|
||||
-- Block oriented write-protection commands
|
||||
COMMAND_28_SET_WRITE_PROTECT : STD_LOGIC_VECTOR(5 downto 0) := "011100";
|
||||
COMMAND_29_CLEAR_WRITE_PROTECT : STD_LOGIC_VECTOR(5 downto 0) := "011101";
|
||||
COMMAND_30_SEND_PROTECTED_GROUPS : STD_LOGIC_VECTOR(5 downto 0) := "011110";
|
||||
-- Erase commands
|
||||
COMMAND_32_ERASE_BLOCK_START : STD_LOGIC_VECTOR(5 downto 0) := "100000";
|
||||
COMMAND_33_ERASE_BLOCK_END : STD_LOGIC_VECTOR(5 downto 0) := "100001";
|
||||
COMMAND_38_ERASE_SELECTED_GROUPS: STD_LOGIC_VECTOR(5 downto 0) := "100110";
|
||||
-- Block lock commands
|
||||
COMMAND_42_LOCK_UNLOCK : STD_LOGIC_VECTOR(5 downto 0) := "101010";
|
||||
-- Command Type Settings
|
||||
COMMAND_55_APP_CMD : STD_LOGIC_VECTOR(5 downto 0) := "110111";
|
||||
COMMAND_56_GEN_CMD : STD_LOGIC_VECTOR(5 downto 0) := "111000";
|
||||
-- Application Specific commands - must be preceeded with command 55.
|
||||
ACOMMAND_6_SET_BUS_WIDTH : STD_LOGIC_VECTOR(5 downto 0) := "000110";
|
||||
ACOMMAND_13_SD_STATUS : STD_LOGIC_VECTOR(5 downto 0) := "001101";
|
||||
ACOMMAND_22_SEND_NUM_WR_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "010100";
|
||||
ACOMMAND_23_SET_BLK_ERASE_COUNT : STD_LOGIC_VECTOR(5 downto 0) := "010101";
|
||||
ACOMMAND_41_SEND_OP_CONDITION : STD_LOGIC_VECTOR(5 downto 0) := "101001";
|
||||
ACOMMAND_42_SET_CLR_CARD_DETECT : STD_LOGIC_VECTOR(5 downto 0) := "101010";
|
||||
ACOMMAND_51_SEND_SCR : STD_LOGIC_VECTOR(5 downto 0) := "110011";
|
||||
-- First custom_command
|
||||
FIRST_NON_PREDEFINED_COMMAND : STD_LOGIC_VECTOR(3 downto 0) := "1010"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_message_bit_out : in std_logic;
|
||||
i_command_ID : in std_logic_vector(5 downto 0);
|
||||
i_argument : in std_logic_vector(31 downto 0);
|
||||
i_predefined_message : in std_logic_vector(3 downto 0);
|
||||
i_generate : in std_logic;
|
||||
i_DSR : in std_logic_vector(15 downto 0);
|
||||
i_OCR : in std_logic_vector(31 downto 0);
|
||||
i_RCA : in std_logic_vector(15 downto 0);
|
||||
o_dataout : out std_logic;
|
||||
o_message_done : out std_logic;
|
||||
o_valid : out std_logic;
|
||||
o_returning_ocr : out std_logic;
|
||||
o_returning_cid : out std_logic;
|
||||
o_returning_rca : out std_logic;
|
||||
o_returning_csd : out std_logic;
|
||||
o_returning_status : out std_logic;
|
||||
o_data_read : out std_logic;
|
||||
o_data_write : out std_logic;
|
||||
o_wait_cmd_busy : out std_logic;
|
||||
o_last_cmd_was_55 : out std_logic;
|
||||
o_response_type : out std_logic_vector(2 downto 0)
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_48_bit_Command_Generator is
|
||||
|
||||
component Altera_UP_SD_CRC7_Generator
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(6 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal counter : std_logic_vector(6 downto 0);
|
||||
signal last_command_id : std_logic_vector(5 downto 0);
|
||||
signal message_bits : std_logic_vector(39 downto 0);
|
||||
signal last_command_sent_was_CMD55, valid : std_logic;
|
||||
signal bit_to_send, sending_CRC, command_valid : std_logic;
|
||||
signal returning_cid_reg, returning_rca_reg, returning_csd_reg, returning_dsr_reg, returning_ocr_reg, returning_status_reg : std_logic;
|
||||
-- UNREGISTERED
|
||||
signal temp_4_bits : std_logic_vector(3 downto 0);
|
||||
signal message_done, CRC_generator_out, produce_next_bit : std_logic;
|
||||
signal app_specific_valid, regular_command_valid : std_logic;
|
||||
signal response_type, response_type_reg : std_logic_vector(2 downto 0);
|
||||
signal cmd_argument : std_logic_vector(31 downto 0);
|
||||
begin
|
||||
-- This set of bits is necessary to allow the SD card to accept a VDD level for communication.
|
||||
temp_4_bits <= "1111" when ((i_OCR(23) = '1') or (i_OCR(22) = '1') or (i_OCR(21) = '1') or (i_OCR(20) = '1')) else "0000";
|
||||
-- Generate the bits to be sent to the SD card. These bits must pass through the CRC generator
|
||||
-- to produce error checking code. The error checking code will follow the message. The message terminates with
|
||||
-- a logic '1'. Total message length is 48 bits.
|
||||
message_data_generator: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
message_bits <= (OTHERS => '0');
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
-- Store type of a response.
|
||||
response_type_reg <= response_type;
|
||||
-- Generate a message. Please note that the predefined messages are used for initialization.
|
||||
-- If executed in sequence, they will initialize the SD card to work correctly. Only once these
|
||||
-- instructions are completed can the data transfer begin.
|
||||
case (i_predefined_message) is
|
||||
when "0000" =>
|
||||
-- Generate a predefined message - CMD0.
|
||||
message_bits <= ("01" & COMMAND_0_GO_IDLE & "00000000000000000000000000000000");
|
||||
when "0001" =>
|
||||
-- Generate a predefined message - CMD55.
|
||||
message_bits <= ("01" & COMMAND_55_APP_CMD & "0000000000000000" & "0000000000000000");
|
||||
when "0010" =>
|
||||
-- Generate a predefined message - ACMD41.
|
||||
message_bits <= ("01" & ACOMMAND_41_SEND_OP_CONDITION & "0000" & temp_4_bits & "000" & i_OCR(20) & "00000000000000000000");
|
||||
when "0011" =>
|
||||
-- Generate a predefined message - CMD2.
|
||||
message_bits <= ("01" & COMMAND_2_ALL_SEND_CID & "00000000000000000000000000000000");
|
||||
when "0100" =>
|
||||
-- Generate a predefined message - CMD3.
|
||||
message_bits <= ("01" & COMMAND_3_SEND_RCA & "00000000000000000000000000000000");
|
||||
when "0101" =>
|
||||
-- Generate a predefined message - CMD9.
|
||||
message_bits <= ("01" & COMMAND_9_SEND_CSD & i_RCA & "0000000000000000");
|
||||
when "0110" =>
|
||||
-- Generate a predefined message - CMD4.
|
||||
message_bits <= ("01" & COMMAND_4_SET_DSR & i_DSR & "0000000000000000");
|
||||
when "0111" =>
|
||||
-- Generate a predefined message - CMD16. Set block length to 512.
|
||||
message_bits <= ("01" & COMMAND_16_SET_BLOCK_LENGTH & "0000000000000000" & "0000001000000000" );
|
||||
when "1000" =>
|
||||
-- Generate a predefined message - CMD7. Select the card so we can access it's data.
|
||||
message_bits <= ("01" & COMMAND_7_SELECT_CARD & i_RCA & "0000001000000000" );
|
||||
when "1001" =>
|
||||
-- Generate a predefined message - CMD13. Send SD card status.
|
||||
message_bits <= ("01" & COMMAND_13_SEND_STATUS & i_RCA & "0000000000000000");
|
||||
|
||||
when others =>
|
||||
-- Generate a custom message
|
||||
message_bits <= ("01" & i_command_ID & cmd_argument);
|
||||
end case;
|
||||
else
|
||||
-- Shift bits out as needed
|
||||
if (produce_next_bit = '1') then
|
||||
-- Shift message bits.
|
||||
message_bits(39 downto 1) <= message_bits(38 downto 0);
|
||||
message_bits(0) <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Generate command argument based on the command_ID. For most commands, the argument is user specified.
|
||||
-- For some commands, it is necessary to send a particular SD Card register contents. Hence, these contents are
|
||||
-- sent instead of the user data.
|
||||
argument_generator: process (i_command_ID, last_command_sent_was_CMD55, i_generate, i_RCA, i_DSR, i_OCR, i_argument)
|
||||
begin
|
||||
cmd_argument <= i_argument;
|
||||
if (i_generate = '1') then
|
||||
case (i_command_ID) is
|
||||
when COMMAND_4_SET_DSR =>
|
||||
cmd_argument <= i_DSR & i_argument(15 downto 0);
|
||||
when COMMAND_7_SELECT_CARD =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when COMMAND_9_SEND_CSD =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when COMMAND_10_SEND_CID =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when COMMAND_13_SEND_STATUS =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when COMMAND_15_GO_INACTIVE =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when COMMAND_55_APP_CMD =>
|
||||
cmd_argument <= i_RCA & i_argument(15 downto 0);
|
||||
when ACOMMAND_41_SEND_OP_CONDITION =>
|
||||
if (last_command_sent_was_CMD55 = '1') then
|
||||
cmd_argument <= i_OCR;
|
||||
end if;
|
||||
when others =>
|
||||
cmd_argument <= i_argument;
|
||||
end case;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Validate the message ID before sending it out.
|
||||
command_validator: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
command_valid <= '0';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
if (("0" & i_predefined_message) >= ("0" & FIRST_NON_PREDEFINED_COMMAND)) then
|
||||
-- Check the custom message
|
||||
if (last_command_sent_was_CMD55 = '1') then
|
||||
-- Check the application specific messages
|
||||
command_valid <= app_specific_valid;
|
||||
else
|
||||
-- Check the default messages.
|
||||
command_valid <= regular_command_valid;
|
||||
end if;
|
||||
else
|
||||
-- A command is valid if the message is predefined.
|
||||
command_valid <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Registers that indicate that the command sent will return contents of a control register.
|
||||
-- The contents of the response should therefore be stored in the appropriate register.
|
||||
responses_with_control_regs: process(i_clock, i_reset_n, last_command_sent_was_CMD55, last_command_id, message_done)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
returning_ocr_reg <= '0';
|
||||
returning_cid_reg <= '0';
|
||||
returning_rca_reg <= '0';
|
||||
returning_csd_reg <= '0';
|
||||
returning_status_reg <= '0';
|
||||
elsif (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
returning_ocr_reg <= '0';
|
||||
returning_cid_reg <= '0';
|
||||
returning_rca_reg <= '0';
|
||||
returning_csd_reg <= '0';
|
||||
returning_status_reg <= '0';
|
||||
elsif (message_done = '1') then
|
||||
-- OCR
|
||||
if ((last_command_sent_was_CMD55 = '1') and (last_command_id = ACOMMAND_41_SEND_OP_CONDITION)) then
|
||||
returning_ocr_reg <= '1';
|
||||
end if;
|
||||
-- CID
|
||||
if (last_command_id = COMMAND_2_ALL_SEND_CID) then
|
||||
returning_cid_reg <= '1';
|
||||
end if;
|
||||
-- RCA
|
||||
if (last_command_id = COMMAND_3_SEND_RCA) then
|
||||
returning_rca_reg <= '1';
|
||||
end if;
|
||||
-- CSD
|
||||
if (last_command_id = COMMAND_9_SEND_CSD) then
|
||||
returning_csd_reg <= '1';
|
||||
end if;
|
||||
-- Status
|
||||
if ((last_command_sent_was_CMD55 = '0') and (last_command_id = COMMAND_13_SEND_STATUS)) then
|
||||
returning_status_reg <= '1';
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Count the number of bits sent using a counter.
|
||||
sent_bit_counter: process(i_clock, i_reset_n, i_generate, produce_next_bit, counter)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
counter <= (OTHERS => '0');
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
-- Reset the counter indicating the number of bits produced.
|
||||
counter <= "0000000";
|
||||
else
|
||||
if (produce_next_bit = '1') then
|
||||
-- Update the number of message bits sent.
|
||||
counter <= counter + '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Select the source for the output data to be either the message data or the CRC bits.
|
||||
source_selector: process(i_clock, i_reset_n, i_generate)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
sending_CRC <= '0';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
-- Set sending CRC flag to 0.
|
||||
sending_CRC <= '0';
|
||||
else
|
||||
-- If this is the last bit being sent, then bits that follow are the CRC bits.
|
||||
if (counter = "0101000") then
|
||||
sending_CRC <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- When the message is sent, store its ID. In a special case when CMD55 is sent, the next command can be an application
|
||||
-- specific command. We need to check those command IDs to verify the validity of the message.
|
||||
CMD55_recognizer: process(i_clock, i_reset_n, i_generate, produce_next_bit, counter, message_done, last_command_id)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
last_command_sent_was_CMD55 <= '0';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '0') then
|
||||
-- Store the ID of the current command.
|
||||
if (produce_next_bit = '1') then
|
||||
if (counter = "0000000") then
|
||||
last_command_id <= message_bits(37 downto 32);
|
||||
end if;
|
||||
end if;
|
||||
-- When message has been sent then check if it was CMD55.
|
||||
if (message_done = '1') then
|
||||
if (last_command_id = COMMAND_55_APP_CMD) then
|
||||
last_command_sent_was_CMD55 <= '1';
|
||||
else
|
||||
last_command_sent_was_CMD55 <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Instantiate a CRC7 generator. Message bits will pass through it to create the CRC code for the message.
|
||||
CRC7_Gen: Altera_UP_SD_CRC7_Generator PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_enable => i_message_bit_out,
|
||||
i_shift => sending_CRC,
|
||||
i_datain => message_bits(39),
|
||||
o_dataout => CRC_generator_out
|
||||
);
|
||||
|
||||
-- Define the source of the data produced by this module, depending on the counter value and the sending_CRC register state.
|
||||
data_bit_register: process(i_clock, i_reset_n, i_generate, produce_next_bit, counter)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
bit_to_send <= '1';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_generate = '1') then
|
||||
bit_to_send <= '1';
|
||||
elsif (produce_next_bit = '1') then
|
||||
-- Send data to output.
|
||||
if (sending_CRC = '0') then
|
||||
-- Send message bits
|
||||
bit_to_send <= message_bits(39);
|
||||
else
|
||||
-- Send CRC bits
|
||||
if ((counter = "0101111") or (counter = "0110000")) then
|
||||
-- At the end of CRC bits put a 1.
|
||||
bit_to_send <= '1';
|
||||
else
|
||||
bit_to_send <= CRC_generator_out;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Define conditions to produce the next message bit on the module output port o_dataout.
|
||||
produce_next_bit <= i_message_bit_out and (not message_done);
|
||||
-- Message is done when the last bit appears at the output.
|
||||
message_done <= '1' when (counter = "0110001") else '0';
|
||||
-- Check the application specific messages
|
||||
app_specific_valid <= '1' when (
|
||||
--(i_command_ID = COMMAND_0_GO_IDLE) or
|
||||
(i_command_ID = COMMAND_2_ALL_SEND_CID) or
|
||||
(i_command_ID = COMMAND_3_SEND_RCA) or
|
||||
(i_command_ID = COMMAND_4_SET_DSR) or
|
||||
--(i_command_ID = ACOMMAND_6_SET_BUS_WIDTH) or
|
||||
--(i_command_ID = COMMAND_7_SELECT_CARD) or
|
||||
(i_command_ID = COMMAND_9_SEND_CSD) or
|
||||
(i_command_ID = COMMAND_10_SEND_CID) or
|
||||
--(i_command_ID = COMMAND_12_STOP_TRANSMISSION) or
|
||||
(i_command_ID = ACOMMAND_13_SD_STATUS) or
|
||||
--(i_command_ID = COMMAND_15_GO_INACTIVE) or
|
||||
--(i_command_ID = COMMAND_16_SET_BLOCK_LENGTH) or
|
||||
(i_command_ID = COMMAND_17_READ_BLOCK) or
|
||||
--(i_command_ID = COMMAND_18_READ_MULTIPLE_BLOCKS) or
|
||||
(i_command_ID = ACOMMAND_22_SEND_NUM_WR_BLOCKS) or
|
||||
(i_command_ID = ACOMMAND_23_SET_BLK_ERASE_COUNT) or
|
||||
(i_command_ID = COMMAND_24_WRITE_BLOCK) or
|
||||
(i_command_ID = COMMAND_25_WRITE_MULTIPLE_BLOCKS) or
|
||||
(i_command_ID = COMMAND_27_PROGRAM_CSD) or
|
||||
(i_command_ID = COMMAND_28_SET_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_29_CLEAR_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_30_SEND_PROTECTED_GROUPS) or
|
||||
(i_command_ID = COMMAND_32_ERASE_BLOCK_START) or
|
||||
(i_command_ID = COMMAND_33_ERASE_BLOCK_END) or
|
||||
(i_command_ID = COMMAND_38_ERASE_SELECTED_GROUPS) or
|
||||
(i_command_ID = ACOMMAND_41_SEND_OP_CONDITION) or
|
||||
(i_command_ID = ACOMMAND_42_SET_CLR_CARD_DETECT) or
|
||||
(i_command_ID = ACOMMAND_51_SEND_SCR) or
|
||||
(i_command_ID = COMMAND_55_APP_CMD) or
|
||||
(i_command_ID = COMMAND_56_GEN_CMD)
|
||||
)
|
||||
else '0';
|
||||
-- Check the default messages.
|
||||
regular_command_valid <= '1' when (
|
||||
-------------------------------------------------------
|
||||
-- Disabled to prevent malfunction of the core
|
||||
-------------------------------------------------------
|
||||
--(i_command_ID = COMMAND_0_GO_IDLE) or
|
||||
--(i_command_ID = COMMAND_6_SWITCH_FUNCTION) or
|
||||
--(i_command_ID = COMMAND_7_SELECT_CARD) or
|
||||
--(i_command_ID = COMMAND_15_GO_INACTIVE) or
|
||||
--(i_command_ID = COMMAND_27_PROGRAM_CSD) or
|
||||
--(i_command_ID = COMMAND_30_SEND_PROTECTED_GROUPS) or
|
||||
--(i_command_ID = COMMAND_42_LOCK_UNLOCK) or
|
||||
-------------------------------------------------------
|
||||
(i_command_ID = COMMAND_2_ALL_SEND_CID) or
|
||||
(i_command_ID = COMMAND_3_SEND_RCA) or
|
||||
(i_command_ID = COMMAND_4_SET_DSR) or
|
||||
(i_command_ID = COMMAND_9_SEND_CSD) or
|
||||
(i_command_ID = COMMAND_10_SEND_CID) or
|
||||
(i_command_ID = COMMAND_13_SEND_STATUS) or
|
||||
-------------------------------------------------------
|
||||
-- Disabled to simplify the circuit
|
||||
-------------------------------------------------------
|
||||
--(i_command_ID = COMMAND_12_STOP_TRANSMISSION) or
|
||||
--(i_command_ID = COMMAND_16_SET_BLOCK_LENGTH) or
|
||||
--(i_command_ID = COMMAND_18_READ_MULTIPLE_BLOCKS) or
|
||||
--(i_command_ID = COMMAND_25_WRITE_MULTIPLE_BLOCKS) or
|
||||
-------------------------------------------------------
|
||||
(i_command_ID = COMMAND_17_READ_BLOCK) or
|
||||
(i_command_ID = COMMAND_24_WRITE_BLOCK) or
|
||||
(i_command_ID = COMMAND_28_SET_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_29_CLEAR_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_32_ERASE_BLOCK_START) or
|
||||
(i_command_ID = COMMAND_33_ERASE_BLOCK_END) or
|
||||
(i_command_ID = COMMAND_38_ERASE_SELECTED_GROUPS) or
|
||||
(i_command_ID = COMMAND_55_APP_CMD) or
|
||||
(i_command_ID = COMMAND_56_GEN_CMD)
|
||||
)
|
||||
else '0';
|
||||
|
||||
response_type <= "001" when -- Wait for type 1 response when
|
||||
(
|
||||
(i_predefined_message = "0001") or
|
||||
(i_predefined_message = "0111") or
|
||||
(i_predefined_message = "1000") or
|
||||
(i_predefined_message = "1001") or
|
||||
((i_predefined_message = FIRST_NON_PREDEFINED_COMMAND) and
|
||||
((i_command_ID = COMMAND_6_SWITCH_FUNCTION) or
|
||||
(i_command_ID = COMMAND_7_SELECT_CARD) or
|
||||
(i_command_ID = COMMAND_12_STOP_TRANSMISSION) or
|
||||
(i_command_ID = COMMAND_13_SEND_STATUS) or
|
||||
(i_command_ID = COMMAND_16_SET_BLOCK_LENGTH) or
|
||||
(i_command_ID = COMMAND_17_READ_BLOCK) or
|
||||
(i_command_ID = COMMAND_18_READ_MULTIPLE_BLOCKS) or
|
||||
(i_command_ID = COMMAND_24_WRITE_BLOCK) or
|
||||
(i_command_ID = COMMAND_25_WRITE_MULTIPLE_BLOCKS) or
|
||||
(i_command_ID = COMMAND_27_PROGRAM_CSD) or
|
||||
(i_command_ID = COMMAND_28_SET_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_29_CLEAR_WRITE_PROTECT) or
|
||||
(i_command_ID = COMMAND_30_SEND_PROTECTED_GROUPS) or
|
||||
(i_command_ID = COMMAND_32_ERASE_BLOCK_START) or
|
||||
(i_command_ID = COMMAND_33_ERASE_BLOCK_END) or
|
||||
(i_command_ID = COMMAND_38_ERASE_SELECTED_GROUPS) or
|
||||
(i_command_ID = COMMAND_42_LOCK_UNLOCK) or
|
||||
(i_command_ID = COMMAND_55_APP_CMD) or
|
||||
(i_command_ID = COMMAND_56_GEN_CMD) or
|
||||
((last_command_sent_was_CMD55 = '1') and
|
||||
((i_command_ID = ACOMMAND_6_SET_BUS_WIDTH) or
|
||||
(i_command_ID = ACOMMAND_13_SD_STATUS) or
|
||||
(i_command_ID = ACOMMAND_22_SEND_NUM_WR_BLOCKS) or
|
||||
(i_command_ID = ACOMMAND_23_SET_BLK_ERASE_COUNT) or
|
||||
(i_command_ID = ACOMMAND_42_SET_CLR_CARD_DETECT) or
|
||||
(i_command_ID = ACOMMAND_51_SEND_SCR)))))
|
||||
) else
|
||||
"010" when -- Wait for type 2 response when
|
||||
(
|
||||
((i_predefined_message = FIRST_NON_PREDEFINED_COMMAND) and
|
||||
((i_command_ID = COMMAND_2_ALL_SEND_CID) or
|
||||
(i_command_ID = COMMAND_9_SEND_CSD) or
|
||||
(i_command_ID = COMMAND_10_SEND_CID))) or
|
||||
(i_predefined_message = "0011") or
|
||||
(i_predefined_message = "0101")
|
||||
) else
|
||||
"011" when -- Wait for type 3 response when
|
||||
(
|
||||
((i_predefined_message = FIRST_NON_PREDEFINED_COMMAND) and (last_command_sent_was_CMD55 = '1') and (i_command_ID = ACOMMAND_41_SEND_OP_CONDITION)) or
|
||||
(i_predefined_message = "0010")
|
||||
) else
|
||||
"110" when -- Wait for type 6 response when
|
||||
(((i_predefined_message = FIRST_NON_PREDEFINED_COMMAND) and (i_command_ID = COMMAND_3_SEND_RCA)) or
|
||||
(i_predefined_message = "0100"))
|
||||
else "000"; -- Otherwise there is no response pending.
|
||||
|
||||
-- Define circuit outputs
|
||||
o_message_done <= message_done;
|
||||
o_response_type <= response_type_reg;
|
||||
o_valid <= command_valid;
|
||||
o_dataout <= bit_to_send;
|
||||
o_returning_ocr <= returning_ocr_reg;
|
||||
o_returning_cid <= returning_cid_reg;
|
||||
o_returning_rca <= returning_rca_reg;
|
||||
o_returning_csd <= returning_csd_reg;
|
||||
o_returning_status <= returning_status_reg;
|
||||
o_data_read <= '1' when (last_command_id = COMMAND_17_READ_BLOCK) else '0';
|
||||
o_data_write <= '1' when (last_command_id = COMMAND_24_WRITE_BLOCK) else '0';
|
||||
o_last_cmd_was_55 <= last_command_sent_was_CMD55;
|
||||
o_wait_cmd_busy <= '1' when (
|
||||
(last_command_id = COMMAND_7_SELECT_CARD) or
|
||||
(last_command_id = COMMAND_12_STOP_TRANSMISSION) or
|
||||
(last_command_id = COMMAND_28_SET_WRITE_PROTECT) or
|
||||
(last_command_id = COMMAND_29_CLEAR_WRITE_PROTECT) or
|
||||
(last_command_id = COMMAND_38_ERASE_SELECTED_GROUPS))
|
||||
else '0';
|
||||
end rtl;
|
|
@ -1,518 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
-- This is an FSM that allows access to the SD Card IP core via the Avalon Interconnect.
|
||||
--
|
||||
-- This module takes a range of addresses on the Avalon Interconnect. Specifically:
|
||||
-- - 0x00000000 to 0x000001ff
|
||||
-- word addressable buffer space. The data to be written to the SD card as well
|
||||
-- as data read from the SD card can be accessed here.
|
||||
--
|
||||
-- - 0x00000200 to 0x0000020f
|
||||
-- 128-bit containing the Card Identification Number. The meaning of each bit is described in the
|
||||
-- SD Card Physical Layer Specification Document.
|
||||
--
|
||||
-- - 0x00000210 to 0x0000021f
|
||||
-- 128-bit register containing Card Specific Data. The meaning of each bit is described in the
|
||||
-- SD Card Physical Layer Specification Document.
|
||||
--
|
||||
-- - 0x00000220 to 0x00000223
|
||||
-- 32-bit register containing Operating Conditions Register. The meaning of each bit is described
|
||||
-- in the SD Card Physical Layer Specification Document.
|
||||
--
|
||||
-- - 0x00000224 to 0x00000227
|
||||
-- 32-bit register containing the Status Register. The meaning of each bit is described
|
||||
-- in the SD Card Physical Layer Specification Document. However, if the card is not connected or the
|
||||
-- status register could not be read from the SD card, this register will contain invalid data. In such
|
||||
-- a case, wait for a card to be connected by checking the Auxiliary Status Register (UP Core Specific), and
|
||||
-- a command 13 (SEND_STATUS) to update the contents of this register when possible. If a card is connected then
|
||||
-- the Auxiliary Status Register can be polled until such a time that Status Register is valid, as the SD Card
|
||||
-- interface circuit updates the status register approximately every 0.1 of a second, and after every command
|
||||
-- is executed.
|
||||
--
|
||||
-- - 0x00000228 to 0x000000229
|
||||
-- 16-bit register containing the Relative Card Address. This address uniquely identifies a card
|
||||
-- connected to the SD Card slot.
|
||||
--
|
||||
-- - 0x0000022C to 0x00000022F
|
||||
-- 32-bit register used to set the argument for a command to be sent to the SD Card.
|
||||
--
|
||||
-- - 0x00000230 to 0x000000231
|
||||
-- 16-bit register used to send a command to an SD card. Once written, the interface will issue the
|
||||
-- specified command. The meaning of each bit in this register is as follows:
|
||||
-- - 0-5 - command index. This is a command index as per SD Card Physical Layer specification document.
|
||||
-- - 6 - use most recent RCA. If this bit is set, the command argument will be replaced with the contents of
|
||||
-- the Relative Card Address register, followed by 16 0s. For commands that require RCA to be sent as
|
||||
-- an argument, this bit should be set and users will not need to specify RCA themselves.
|
||||
-- - 7-15 - currently unused bits. They will be ignored.
|
||||
-- NOTE: If a specified command is determined to be invalid, or the card is not connected to the SD Card socket,
|
||||
-- then the SD Card interface circuit will not issue the command.
|
||||
--
|
||||
-- - 0x00000234 to 0x00000235
|
||||
-- 16-bit register with Auxiliary Status Register. This is the Altera UP SD Card Interface status. The meaning of
|
||||
-- the bits is as follows:
|
||||
-- - 0 - last command valid - Set to '1' if the most recently user issued command was valid.
|
||||
-- - 1 - card connected - Set to '1' if at present an SD card
|
||||
-- - 2 - execution in progress - Set to '1' if the command recently issued is currently being executed. If true,
|
||||
-- then the current state of SD Card registers should be ignored.
|
||||
-- - 3 - status register valid - Set to '1' if the status register is valid.
|
||||
-- - 4 - command timed out - Set to '1' if the last command timed out.
|
||||
-- - 5 - crc failed - Set to '1' if the last command failed a CRC check.
|
||||
-- - 6-15 - unused.
|
||||
--
|
||||
-- - 0x00000238 to 0x0000023B
|
||||
-- 32-bit register containing the 32-bit R1 response message. Use it to test validity of the response. This register
|
||||
-- will not store the response to SEND_STATUS command. Insteand, read the SD_status register at location 0x00000224.
|
||||
--
|
||||
-- Date: December 8, 2008
|
||||
-- NOTES/REVISIONS:
|
||||
-- December 17, 2008 - added R1 response register to the core. It is now available at 0x00000238.
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Avalon_Interface is
|
||||
generic (
|
||||
ADDRESS_BUFFER : std_logic_vector(7 downto 0) := "00000000";
|
||||
ADDRESS_CID : std_logic_vector(7 downto 0) := "10000000";
|
||||
ADDRESS_CSD : std_logic_vector(7 downto 0) := "10000100";
|
||||
ADDRESS_OCR : std_logic_vector(7 downto 0) := "10001000";
|
||||
ADDRESS_SR : std_logic_vector(7 downto 0) := "10001001";
|
||||
ADDRESS_RCA : std_logic_vector(7 downto 0) := "10001010";
|
||||
ADDRESS_ARGUMENT : std_logic_vector(7 downto 0) := "10001011";
|
||||
ADDRESS_COMMAND : std_logic_vector(7 downto 0) := "10001100";
|
||||
ADDRESS_ASR : std_logic_vector(7 downto 0) := "10001101";
|
||||
ADDRESS_R1 : std_logic_vector(7 downto 0) := "10001110"
|
||||
);
|
||||
port
|
||||
(
|
||||
-- Clock and Reset signals
|
||||
i_clock : in STD_LOGIC;
|
||||
i_reset_n : in STD_LOGIC; -- Asynchronous reset
|
||||
|
||||
-- Avalon Interconnect Signals
|
||||
i_avalon_address : in STD_LOGIC_VECTOR(7 downto 0);
|
||||
i_avalon_chip_select : in STD_LOGIC;
|
||||
i_avalon_read : in STD_LOGIC;
|
||||
i_avalon_write : in STD_LOGIC;
|
||||
i_avalon_byteenable : in STD_LOGIC_VECTOR(3 downto 0);
|
||||
i_avalon_writedata : in STD_LOGIC_VECTOR(31 downto 0);
|
||||
o_avalon_readdata : out STD_LOGIC_VECTOR(31 downto 0);
|
||||
o_avalon_waitrequest : out STD_LOGIC;
|
||||
|
||||
-- SD Card interface ports
|
||||
b_SD_cmd : inout STD_LOGIC;
|
||||
b_SD_dat : inout STD_LOGIC;
|
||||
b_SD_dat3 : inout STD_LOGIC;
|
||||
o_SD_clock : out STD_LOGIC
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Avalon_Interface is
|
||||
|
||||
component Altera_UP_SD_Card_Interface is
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
|
||||
-- Command interface
|
||||
b_SD_cmd : inout std_logic;
|
||||
b_SD_dat : inout std_logic;
|
||||
b_SD_dat3 : inout std_logic;
|
||||
i_command_ID : in std_logic_vector(5 downto 0);
|
||||
i_argument : in std_logic_vector(31 downto 0);
|
||||
i_user_command_ready : in std_logic;
|
||||
|
||||
o_SD_clock : out std_logic;
|
||||
o_card_connected : out std_logic;
|
||||
o_command_completed : out std_logic;
|
||||
o_command_valid : out std_logic;
|
||||
o_command_timed_out : out std_logic;
|
||||
o_command_crc_failed : out std_logic;
|
||||
|
||||
-- Buffer access
|
||||
i_buffer_enable : in std_logic;
|
||||
i_buffer_address : in std_logic_vector(7 downto 0);
|
||||
i_buffer_write : in std_logic;
|
||||
i_buffer_data_in : in std_logic_vector(15 downto 0);
|
||||
o_buffer_data_out : out std_logic_vector(15 downto 0);
|
||||
|
||||
-- Show SD Card registers as outputs
|
||||
o_SD_REG_card_identification_number : out std_logic_vector(127 downto 0);
|
||||
o_SD_REG_relative_card_address : out std_logic_vector(15 downto 0);
|
||||
o_SD_REG_operating_conditions_register : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_card_specific_data : out std_logic_vector(127 downto 0);
|
||||
o_SD_REG_status_register : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_response_R1 : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_status_register_valid : out std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
-- Build an enumerated type for the state machine. On reset always reset the DE2 and read the state
|
||||
-- of the switches.
|
||||
type buffer_state_type is ( s_RESET, s_WAIT_REQUEST, s_READ_FIRST_WORD, s_READ_SECOND_WORD, s_RECEIVE_FIRST_WORD,
|
||||
s_RECEIVE_SECOND_WORD, s_WR_READ_FIRST_WORD, s_WR_READ_FIRST_WORD_DELAY, s_WRITE_FIRST_BYTE, s_WRITE_FIRST_WORD,
|
||||
s_WR_READ_SECOND_WORD, s_WR_READ_SECOND_WORD_DELAY, s_WRITE_SECOND_BYTE, s_WRITE_SECOND_WORD, s_WAIT_RELEASE);
|
||||
type command_state_type is (s_RESET_CMD, s_WAIT_COMMAND, s_WAIT_RESPONSE, s_UPDATE_AUX_SR);
|
||||
|
||||
-- Register to hold the current state
|
||||
signal current_state : buffer_state_type;
|
||||
signal next_state : buffer_state_type;
|
||||
signal current_cmd_state : command_state_type;
|
||||
signal next_cmd_state : command_state_type;
|
||||
|
||||
-------------------
|
||||
-- Local signals
|
||||
-------------------
|
||||
-- REGISTERED
|
||||
signal auxiliary_status_reg : std_logic_vector(5 downto 0);
|
||||
signal buffer_data_out_reg : std_logic_vector(31 downto 0);
|
||||
signal buffer_data_in_reg : std_logic_vector(31 downto 0);
|
||||
signal buffer_data_out : std_logic_vector(15 downto 0);
|
||||
signal command_ID_reg : std_logic_vector( 5 downto 0);
|
||||
signal argument_reg : std_logic_vector(31 downto 0);
|
||||
signal avalon_address : std_logic_vector(7 downto 0);
|
||||
signal avalon_byteenable : std_logic_vector(3 downto 0);
|
||||
-- UNREGISTERED
|
||||
signal buffer_address : std_logic_vector(7 downto 0);
|
||||
signal buffer_data_in : std_logic_vector(15 downto 0);
|
||||
signal SD_REG_card_identification_number : std_logic_vector(127 downto 0);
|
||||
signal SD_REG_relative_card_address : std_logic_vector(15 downto 0);
|
||||
signal SD_REG_operating_conditions_register : std_logic_vector(31 downto 0);
|
||||
signal SD_REG_card_specific_data : std_logic_vector(127 downto 0);
|
||||
signal SD_REG_status_register : std_logic_vector(31 downto 0);
|
||||
signal SD_REG_response_R1 : std_logic_vector(31 downto 0);
|
||||
signal command_ready, send_command_ready,
|
||||
command_valid, command_completed, card_connected : std_logic;
|
||||
signal status_reg_valid, argument_write : std_logic;
|
||||
signal read_buffer_request, write_buffer_request, buffer_enable, buffer_write : std_logic;
|
||||
signal command_timed_out, command_crc_failed : std_logic;
|
||||
|
||||
begin
|
||||
-- Define state transitions for buffer interface.
|
||||
state_transitions_buffer: process (current_state, read_buffer_request, write_buffer_request, i_avalon_byteenable, avalon_byteenable)
|
||||
begin
|
||||
case current_state is
|
||||
when s_RESET =>
|
||||
-- Reset local registers.
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
|
||||
when s_WAIT_REQUEST =>
|
||||
-- Wait for a user command.
|
||||
if (read_buffer_request = '1') then
|
||||
next_state <= s_READ_FIRST_WORD;
|
||||
elsif (write_buffer_request = '1') then
|
||||
if ((i_avalon_byteenable(1) = '1') and (i_avalon_byteenable(0) = '1')) then
|
||||
next_state <= s_WRITE_FIRST_WORD;
|
||||
elsif ((i_avalon_byteenable(3) = '1') and (i_avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WRITE_SECOND_WORD;
|
||||
elsif ((i_avalon_byteenable(1) = '1') or (i_avalon_byteenable(0) = '1')) then
|
||||
next_state <= s_WR_READ_FIRST_WORD;
|
||||
elsif ((i_avalon_byteenable(3) = '1') or (i_avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WR_READ_SECOND_WORD;
|
||||
else
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
end if;
|
||||
|
||||
when s_READ_FIRST_WORD =>
|
||||
-- Read first 16-bit word from the buffer
|
||||
next_state <= s_READ_SECOND_WORD;
|
||||
|
||||
when s_READ_SECOND_WORD =>
|
||||
-- Read second 16-bit word from the buffer
|
||||
next_state <= s_RECEIVE_FIRST_WORD;
|
||||
|
||||
when s_RECEIVE_FIRST_WORD =>
|
||||
-- Store first word read
|
||||
next_state <= s_RECEIVE_SECOND_WORD;
|
||||
|
||||
when s_RECEIVE_SECOND_WORD =>
|
||||
-- Store second word read
|
||||
next_state <= s_WAIT_RELEASE;
|
||||
|
||||
-- The following states control writing to the buffer. To write a single byte it is necessary to read a
|
||||
-- word and then write it back, changing only on of its bytes.
|
||||
when s_WR_READ_FIRST_WORD =>
|
||||
-- Read first 16-bit word from the buffer
|
||||
next_state <= s_WR_READ_FIRST_WORD_DELAY;
|
||||
|
||||
when s_WR_READ_FIRST_WORD_DELAY =>
|
||||
-- Wait a cycle
|
||||
next_state <= s_WRITE_FIRST_BYTE;
|
||||
|
||||
when s_WRITE_FIRST_BYTE =>
|
||||
-- Write one of the bytes in the given word into the memory.
|
||||
if ((avalon_byteenable(3) = '1') and (avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WRITE_SECOND_WORD;
|
||||
elsif ((avalon_byteenable(3) = '1') or (avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WR_READ_SECOND_WORD;
|
||||
else
|
||||
next_state <= s_WAIT_RELEASE;
|
||||
end if;
|
||||
|
||||
when s_WR_READ_SECOND_WORD =>
|
||||
-- Read second 16-bit word from the buffer
|
||||
next_state <= s_WR_READ_SECOND_WORD_DELAY;
|
||||
|
||||
when s_WR_READ_SECOND_WORD_DELAY =>
|
||||
-- Wait a cycle
|
||||
next_state <= s_WRITE_SECOND_BYTE;
|
||||
|
||||
when s_WRITE_SECOND_BYTE =>
|
||||
-- Write one of the bytes in the given word into the memory.
|
||||
next_state <= s_WAIT_RELEASE;
|
||||
|
||||
-- Full word writing can be done without reading the word in the first place.
|
||||
when s_WRITE_FIRST_WORD =>
|
||||
-- Write the first word into memory
|
||||
if ((avalon_byteenable(3) = '1') and (avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WRITE_SECOND_WORD;
|
||||
elsif ((avalon_byteenable(3) = '1') or (avalon_byteenable(2) = '1')) then
|
||||
next_state <= s_WR_READ_SECOND_WORD;
|
||||
else
|
||||
next_state <= s_WAIT_RELEASE;
|
||||
end if;
|
||||
|
||||
when s_WRITE_SECOND_WORD =>
|
||||
-- Write the second word into memory
|
||||
next_state <= s_WAIT_RELEASE;
|
||||
|
||||
when s_WAIT_RELEASE =>
|
||||
-- if ((read_buffer_request = '1') or (write_buffer_request = '1')) then
|
||||
-- next_state <= s_WAIT_RELEASE;
|
||||
-- else
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
-- end if;
|
||||
|
||||
when others =>
|
||||
-- Make sure to start in the reset state if the circuit powers up in an odd state.
|
||||
next_state <= s_RESET;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
-- State Registers
|
||||
buffer_state_regs: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
current_state <= s_RESET;
|
||||
elsif(rising_edge(i_clock)) then
|
||||
current_state <= next_state;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
helper_regs: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
avalon_address <= (OTHERS => '0');
|
||||
buffer_data_out_reg <= (OTHERS => '0');
|
||||
buffer_data_in_reg <= (OTHERS => '0');
|
||||
avalon_byteenable <= (OTHERS => '0');
|
||||
elsif(rising_edge(i_clock)) then
|
||||
if (current_state = s_WAIT_REQUEST) then
|
||||
avalon_address <= i_avalon_address;
|
||||
buffer_data_in_reg <= i_avalon_writedata;
|
||||
avalon_byteenable <= i_avalon_byteenable;
|
||||
end if;
|
||||
if (current_state = s_RECEIVE_FIRST_WORD) then
|
||||
buffer_data_out_reg(15 downto 0) <= buffer_data_out;
|
||||
end if;
|
||||
if (current_state = s_RECEIVE_SECOND_WORD) then
|
||||
buffer_data_out_reg(31 downto 16) <= buffer_data_out;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- FSM outputs
|
||||
o_avalon_waitrequest <= (read_buffer_request or write_buffer_request) when (not (current_state = s_WAIT_RELEASE)) else '0';
|
||||
buffer_address(7 downto 1) <= avalon_address(6 downto 0);
|
||||
buffer_address(0) <= '1' when ( (current_state = s_READ_SECOND_WORD) or (current_state = s_WRITE_SECOND_WORD) or
|
||||
(current_state = s_WR_READ_SECOND_WORD) or (current_state = s_WRITE_SECOND_BYTE)) else
|
||||
'0';
|
||||
buffer_enable <= '1' when ( (current_state = s_READ_FIRST_WORD) or (current_state = s_WR_READ_FIRST_WORD) or
|
||||
(current_state = s_READ_SECOND_WORD) or (current_state = s_WR_READ_SECOND_WORD) or
|
||||
(current_state = s_WRITE_FIRST_WORD) or (current_state = s_WRITE_FIRST_BYTE) or
|
||||
(current_state = s_WRITE_SECOND_WORD) or (current_state = s_WRITE_SECOND_BYTE)) else
|
||||
'0';
|
||||
buffer_write <= '1' when ( (current_state = s_WRITE_FIRST_WORD) or (current_state = s_WRITE_FIRST_BYTE) or
|
||||
(current_state = s_WRITE_SECOND_WORD) or (current_state = s_WRITE_SECOND_BYTE)) else
|
||||
'0';
|
||||
buffer_data_in <= (buffer_data_out(15 downto 8) & buffer_data_in_reg(7 downto 0)) when ((current_state = s_WRITE_FIRST_BYTE) and (avalon_byteenable(1 downto 0) = "01")) else
|
||||
(buffer_data_in_reg(15 downto 8) & buffer_data_out(7 downto 0)) when ((current_state = s_WRITE_FIRST_BYTE) and (avalon_byteenable(1 downto 0) = "10")) else
|
||||
(buffer_data_out(15 downto 8) & buffer_data_in_reg(23 downto 16)) when ((current_state = s_WRITE_SECOND_BYTE) and (avalon_byteenable(3 downto 2) = "01")) else
|
||||
(buffer_data_in_reg(31 downto 24) & buffer_data_out(7 downto 0)) when ((current_state = s_WRITE_SECOND_BYTE) and (avalon_byteenable(3 downto 2) = "10")) else
|
||||
buffer_data_in_reg(15 downto 0) when (current_state = s_WRITE_FIRST_WORD) else
|
||||
buffer_data_in_reg(31 downto 16);
|
||||
-- Glue Logic
|
||||
read_buffer_request <= (not i_avalon_address(7)) and (i_avalon_chip_select) and (i_avalon_read);
|
||||
write_buffer_request <= (not i_avalon_address(7)) and (i_avalon_chip_select) and (i_avalon_write);
|
||||
|
||||
-- Define state transitions for command interface.
|
||||
state_transitions_cmd: process (current_cmd_state, command_completed, command_valid, command_ready)
|
||||
begin
|
||||
case current_cmd_state is
|
||||
when s_RESET_CMD =>
|
||||
-- Reset local registers.
|
||||
next_cmd_state <= s_WAIT_COMMAND;
|
||||
|
||||
when s_WAIT_COMMAND =>
|
||||
-- Wait for a user command.
|
||||
if (command_ready = '1') then
|
||||
next_cmd_state <= s_WAIT_RESPONSE;
|
||||
else
|
||||
next_cmd_state <= s_WAIT_COMMAND;
|
||||
end if;
|
||||
|
||||
when s_WAIT_RESPONSE =>
|
||||
-- Generate a predefined command to the SD card. This is the identification process for the SD card.
|
||||
if ((command_completed = '1') or (command_valid = '0')) then
|
||||
next_cmd_state <= s_UPDATE_AUX_SR;
|
||||
else
|
||||
next_cmd_state <= s_WAIT_RESPONSE;
|
||||
end if;
|
||||
|
||||
when s_UPDATE_AUX_SR =>
|
||||
-- Update the Auxiliary status register.
|
||||
if (command_ready = '1') then
|
||||
next_cmd_state <= s_UPDATE_AUX_SR;
|
||||
else
|
||||
next_cmd_state <= s_WAIT_COMMAND;
|
||||
end if;
|
||||
|
||||
when others =>
|
||||
-- Make sure to start in the reset state if the circuit powers up in an odd state.
|
||||
next_cmd_state <= s_RESET_CMD;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
-- State registers
|
||||
cmd_state_regs: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
current_cmd_state <= s_RESET_CMD;
|
||||
elsif(rising_edge(i_clock)) then
|
||||
current_cmd_state <= next_cmd_state;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- FSM outputs
|
||||
send_command_ready <= '1' when ((current_cmd_state = s_WAIT_RESPONSE) or (current_cmd_state = s_UPDATE_AUX_SR)) else '0';
|
||||
|
||||
-- Glue logic
|
||||
command_ready <= '1' when ( (i_avalon_chip_select = '1') and (i_avalon_write = '1') and
|
||||
(i_avalon_address = ADDRESS_COMMAND)) else '0';
|
||||
argument_write <= '1' when ((i_avalon_chip_select = '1') and (i_avalon_write = '1') and
|
||||
(i_avalon_address = ADDRESS_ARGUMENT)) else '0';
|
||||
-- Local Registers
|
||||
local_regs: process(i_clock, i_reset_n, current_cmd_state, card_connected, command_valid, i_avalon_writedata, command_completed, command_ready)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
auxiliary_status_reg <= "000000";
|
||||
command_ID_reg <= (OTHERS => '0');
|
||||
elsif(rising_edge(i_clock)) then
|
||||
-- AUX Status Register
|
||||
if ((current_cmd_state = s_WAIT_RESPONSE) or (current_cmd_state = s_UPDATE_AUX_SR)) then
|
||||
auxiliary_status_reg(2) <= not command_completed;
|
||||
auxiliary_status_reg(4) <= command_timed_out;
|
||||
auxiliary_status_reg(5) <= command_crc_failed;
|
||||
end if;
|
||||
auxiliary_status_reg(0) <= command_valid;
|
||||
auxiliary_status_reg(1) <= card_connected;
|
||||
auxiliary_status_reg(3) <= status_reg_valid;
|
||||
-- Command
|
||||
if (command_ready = '1') then
|
||||
command_ID_reg <= i_avalon_writedata(5 downto 0);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
argument_regs_processing: process(i_clock, i_reset_n, current_cmd_state, i_avalon_writedata, command_ready)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
argument_reg <= (OTHERS => '0');
|
||||
elsif(rising_edge(i_clock)) then
|
||||
-- Argument register
|
||||
if ((command_ready = '1') and ( i_avalon_writedata(6) = '1')) then
|
||||
argument_reg <= SD_REG_relative_card_address & "0000000000000000";
|
||||
elsif (argument_write = '1') then
|
||||
argument_reg <= i_avalon_writedata;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
o_avalon_readdata <= buffer_data_out_reg when (not (current_state = s_WAIT_REQUEST)) else
|
||||
SD_REG_card_identification_number(31 downto 0) when (i_avalon_address = ADDRESS_CID) else
|
||||
SD_REG_card_identification_number(63 downto 32) when (i_avalon_address = ADDRESS_CID(7 downto 2) & "01") else
|
||||
SD_REG_card_identification_number(95 downto 64) when (i_avalon_address = ADDRESS_CID(7 downto 2) & "10") else
|
||||
SD_REG_card_identification_number(127 downto 96) when (i_avalon_address = ADDRESS_CID(7 downto 2) & "11") else
|
||||
SD_REG_card_specific_data(31 downto 0) when (i_avalon_address = ADDRESS_CSD) else
|
||||
SD_REG_card_specific_data(63 downto 32) when (i_avalon_address = ADDRESS_CSD(7 downto 2) & "01") else
|
||||
SD_REG_card_specific_data(95 downto 64) when (i_avalon_address = ADDRESS_CSD(7 downto 2) & "10") else
|
||||
SD_REG_card_specific_data(127 downto 96) when (i_avalon_address = ADDRESS_CSD(7 downto 2) & "11") else
|
||||
SD_REG_operating_conditions_register when (i_avalon_address = ADDRESS_OCR) else
|
||||
SD_REG_status_register when (i_avalon_address = ADDRESS_SR) else
|
||||
("0000000000000000" & SD_REG_relative_card_address)when (i_avalon_address = ADDRESS_RCA) else
|
||||
argument_reg when (i_avalon_address = ADDRESS_ARGUMENT) else
|
||||
("00000000000000000000000000" & command_ID_reg) when (i_avalon_address = ADDRESS_COMMAND) else
|
||||
SD_REG_response_R1 when (i_avalon_address = ADDRESS_R1) else
|
||||
("00000000000000000000000000" & auxiliary_status_reg);
|
||||
|
||||
-- Instantiated Components
|
||||
SD_Card_Port: Altera_UP_SD_Card_Interface
|
||||
port map
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
|
||||
-- Command interface
|
||||
b_SD_cmd => b_SD_cmd,
|
||||
b_SD_dat => b_SD_dat,
|
||||
b_SD_dat3 => b_SD_dat3,
|
||||
i_command_ID => command_ID_reg,
|
||||
i_argument => argument_reg,
|
||||
i_user_command_ready => send_command_ready,
|
||||
|
||||
o_SD_clock => o_SD_clock,
|
||||
o_card_connected => card_connected,
|
||||
o_command_completed => command_completed,
|
||||
o_command_valid => command_valid,
|
||||
o_command_timed_out => command_timed_out,
|
||||
o_command_crc_failed => command_crc_failed,
|
||||
|
||||
-- Buffer access
|
||||
i_buffer_enable => buffer_enable,
|
||||
i_buffer_address => buffer_address,
|
||||
i_buffer_write => buffer_write,
|
||||
i_buffer_data_in => buffer_data_in,
|
||||
o_buffer_data_out => buffer_data_out,
|
||||
|
||||
-- Show SD Card registers as outputs
|
||||
o_SD_REG_card_identification_number => SD_REG_card_identification_number,
|
||||
o_SD_REG_relative_card_address => SD_REG_relative_card_address,
|
||||
o_SD_REG_operating_conditions_register => SD_REG_operating_conditions_register,
|
||||
o_SD_REG_card_specific_data => SD_REG_card_specific_data,
|
||||
o_SD_REG_status_register => SD_REG_status_register,
|
||||
o_SD_REG_response_R1 => SD_REG_response_R1,
|
||||
o_SD_REG_status_register_valid => status_reg_valid
|
||||
);
|
||||
|
||||
end rtl;
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-- This module is a dual port memory block. It has a 16-bit port and a 1-bit port.
|
||||
-- The 1-bit port is used to either send or receive data, while the 16-bit port is used
|
||||
-- by Avalon interconnet to store and retrieve data.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
-------------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Buffer is
|
||||
generic (
|
||||
TIMEOUT : std_logic_vector(15 downto 0) := "1111111111111111";
|
||||
BUSY_WAIT : std_logic_vector(15 downto 0) := "0000001111110000"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
|
||||
-- 1 bit port to transmit and receive data on the data line.
|
||||
i_begin : in std_logic;
|
||||
i_sd_clock_pulse_trigger : in std_logic;
|
||||
i_transmit : in std_logic;
|
||||
i_1bit_data_in : in std_logic;
|
||||
o_1bit_data_out : out std_logic;
|
||||
o_operation_complete : out std_logic;
|
||||
o_crc_passed : out std_logic;
|
||||
o_timed_out : out std_logic;
|
||||
o_dat_direction : out std_logic; -- set to 1 to send data, set to 0 to receive it.
|
||||
|
||||
-- 16 bit port to be accessed by a user circuit.
|
||||
i_enable_16bit_port : in std_logic;
|
||||
i_address_16bit_port : in std_logic_vector(7 downto 0);
|
||||
i_write_16bit : in std_logic;
|
||||
i_16bit_data_in : in std_logic_vector(15 downto 0);
|
||||
o_16bit_data_out : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Buffer is
|
||||
|
||||
component Altera_UP_SD_CRC16_Generator
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_sync_reset : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Card_Memory_Block
|
||||
PORT
|
||||
(
|
||||
address_a : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
address_b : IN STD_LOGIC_VECTOR (11 DOWNTO 0);
|
||||
clock_a : IN STD_LOGIC ;
|
||||
clock_b : IN STD_LOGIC ;
|
||||
data_a : IN STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
data_b : IN STD_LOGIC_VECTOR (0 DOWNTO 0);
|
||||
enable_a : IN STD_LOGIC := '1';
|
||||
enable_b : IN STD_LOGIC := '1';
|
||||
wren_a : IN STD_LOGIC := '1';
|
||||
wren_b : IN STD_LOGIC := '1';
|
||||
q_a : OUT STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
q_b : OUT STD_LOGIC_VECTOR (0 DOWNTO 0)
|
||||
);
|
||||
END component;
|
||||
|
||||
-- Build an enumerated type for the state machine. On reset always reset the DE2 and read the state
|
||||
-- of the switches.
|
||||
type state_type is (s_RESET, s_WAIT_REQUEST, s_SEND_START_BIT, s_SEND_DATA, s_SEND_CRC, s_SEND_STOP, s_WAIT_BUSY, s_WAIT_BUSY_END,
|
||||
s_WAIT_DATA_START, s_RECEIVING_LEADING_BITS, s_RECEIVING_DATA, s_RECEIVING_STOP_BIT, s_WAIT_DEASSERT);
|
||||
|
||||
-- Register to hold the current state
|
||||
signal current_state : state_type;
|
||||
signal next_state : state_type;
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal crc_counter : std_logic_vector(3 downto 0);
|
||||
signal local_mode : std_logic;
|
||||
signal dataout_1bit : std_logic;
|
||||
signal bit_counter : std_logic_vector(2 downto 0);
|
||||
signal byte_counter : std_logic_vector(8 downto 0);
|
||||
signal shift_register : std_logic_vector(16 downto 0);
|
||||
signal timeout_register : std_logic_vector(15 downto 0);
|
||||
signal data_in_reg : std_logic;
|
||||
-- UNREGISTERED
|
||||
signal crc_out : std_logic_vector(15 downto 0);
|
||||
signal single_bit_conversion, single_bit_out : std_logic_vector( 0 downto 0);
|
||||
signal packet_mem_addr_b : std_logic_vector(11 downto 0);
|
||||
signal local_reset, to_crc_generator, from_crc_generator, from_mem_1_bit, shift_crc,
|
||||
recv_data, crc_generator_enable : std_logic;
|
||||
begin
|
||||
-- State transitions
|
||||
state_transitions: process( current_state, i_begin, i_sd_clock_pulse_trigger, i_transmit, byte_counter,
|
||||
bit_counter, crc_counter, i_1bit_data_in, timeout_register, data_in_reg)
|
||||
begin
|
||||
case (current_state) is
|
||||
when s_RESET =>
|
||||
-- Reset local registers and begin waiting for user input.
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
|
||||
when s_WAIT_REQUEST =>
|
||||
-- Wait for i_begin to be high
|
||||
if ((i_begin = '1') and (i_sd_clock_pulse_trigger = '1')) then
|
||||
if (i_transmit = '1') then
|
||||
next_state <= s_SEND_START_BIT;
|
||||
else
|
||||
next_state <= s_WAIT_DATA_START;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
end if;
|
||||
|
||||
when s_SEND_START_BIT =>
|
||||
-- Send a 0 first, followed by 4096 bits of data, 16 CRC bits, and stop bit.
|
||||
if (i_sd_clock_pulse_trigger = '1') then
|
||||
next_state <= s_SEND_DATA;
|
||||
else
|
||||
next_state <= s_SEND_START_BIT;
|
||||
end if;
|
||||
|
||||
when s_SEND_DATA =>
|
||||
-- Send 4096 data bits
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (bit_counter = "000") and (byte_counter = "111111111")) then
|
||||
next_state <= s_SEND_CRC;
|
||||
else
|
||||
next_state <= s_SEND_DATA;
|
||||
end if;
|
||||
|
||||
when s_SEND_CRC =>
|
||||
-- Send 16 CRC bits
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (crc_counter = "1111")) then
|
||||
next_state <= s_SEND_STOP;
|
||||
else
|
||||
next_state <= s_SEND_CRC;
|
||||
end if;
|
||||
|
||||
when s_SEND_STOP =>
|
||||
-- Send stop bit.
|
||||
if (i_sd_clock_pulse_trigger = '1') then
|
||||
next_state <= s_WAIT_BUSY;
|
||||
else
|
||||
next_state <= s_SEND_STOP;
|
||||
end if;
|
||||
|
||||
when s_WAIT_BUSY =>
|
||||
-- After a write, wait for the busy signal. Do not return a done signal until you receive a busy signal.
|
||||
-- If you do not and a long time expires, then the data must have been rejected (due to CRC error maybe).
|
||||
-- In such a case return failure.
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (data_in_reg = '0') and (timeout_register = "0000000000010000")) then
|
||||
next_state <= s_WAIT_BUSY_END;
|
||||
else
|
||||
if (timeout_register = BUSY_WAIT) then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_BUSY;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_WAIT_BUSY_END =>
|
||||
if (i_sd_clock_pulse_trigger = '1') then
|
||||
if (data_in_reg = '1') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_BUSY_END;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_BUSY_END;
|
||||
end if;
|
||||
|
||||
when s_WAIT_DATA_START =>
|
||||
-- Wait for the start bit
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (data_in_reg = '0')) then
|
||||
next_state <= s_RECEIVING_LEADING_BITS;
|
||||
else
|
||||
if (timeout_register = TIMEOUT) then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_DATA_START;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_RECEIVING_LEADING_BITS =>
|
||||
-- shift the start bit in as well as the next 16 bits. Once they are all in you can start putting data into memory.
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (crc_counter = "1111")) then
|
||||
next_state <= s_RECEIVING_DATA;
|
||||
else
|
||||
next_state <= s_RECEIVING_LEADING_BITS;
|
||||
end if;
|
||||
|
||||
when s_RECEIVING_DATA =>
|
||||
-- Wait until all bits arrive.
|
||||
if ((i_sd_clock_pulse_trigger = '1') and (bit_counter = "000") and (byte_counter = "111111111")) then
|
||||
next_state <= s_RECEIVING_STOP_BIT;
|
||||
else
|
||||
next_state <= s_RECEIVING_DATA;
|
||||
end if;
|
||||
|
||||
when s_RECEIVING_STOP_BIT =>
|
||||
-- Wait until all bits arrive.
|
||||
if (i_sd_clock_pulse_trigger = '1')then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_RECEIVING_STOP_BIT;
|
||||
end if;
|
||||
|
||||
when s_WAIT_DEASSERT =>
|
||||
if (i_begin = '1') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_REQUEST;
|
||||
end if;
|
||||
|
||||
when others =>
|
||||
next_state <= s_RESET;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
-- State registers
|
||||
state_regs: process(i_clock, i_reset_n, local_reset)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
current_state <= s_RESET;
|
||||
elsif (rising_edge(i_clock)) then
|
||||
current_state <= next_state;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- FSM outputs
|
||||
to_crc_generator <= shift_register(16) when (current_state = s_RECEIVING_DATA) else
|
||||
from_mem_1_bit when (current_state = s_SEND_DATA) else
|
||||
'0';
|
||||
shift_crc <= '1' when (current_state = s_SEND_CRC) else '0';
|
||||
local_reset <= '1' when ((current_state = s_RESET) or (current_state = s_WAIT_REQUEST)) else '0';
|
||||
recv_data <= '1' when (current_state = s_RECEIVING_DATA) else '0';
|
||||
single_bit_conversion(0) <= shift_register(15);
|
||||
crc_generator_enable <= '0' when (current_state = s_WAIT_DEASSERT) else i_sd_clock_pulse_trigger;
|
||||
o_operation_complete <= '1' when (current_state = s_WAIT_DEASSERT) else '0';
|
||||
o_dat_direction <= '1' when ( (current_state = s_SEND_START_BIT) or
|
||||
(current_state = s_SEND_DATA) or
|
||||
(current_state = s_SEND_CRC) or
|
||||
(current_state = s_SEND_STOP))
|
||||
else '0';
|
||||
o_1bit_data_out <= dataout_1bit;
|
||||
o_crc_passed <= '1' when ((crc_out = shift_register(16 downto 1)) and (shift_register(0) = '1')) else '0';
|
||||
o_timed_out <= '1' when (timeout_register = TIMEOUT) else '0';
|
||||
|
||||
-- Local components
|
||||
local_regs: process(i_clock, i_reset_n, local_reset)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
bit_counter <= (OTHERS => '1');
|
||||
byte_counter <= (OTHERS => '0');
|
||||
dataout_1bit <= '1';
|
||||
crc_counter <= (OTHERS => '0');
|
||||
shift_register <= (OTHERS => '0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- counters and serial output
|
||||
if (local_reset = '1') then
|
||||
bit_counter <= (OTHERS => '1');
|
||||
byte_counter <= (OTHERS => '0');
|
||||
dataout_1bit <= '1';
|
||||
data_in_reg <= '1';
|
||||
crc_counter <= (OTHERS => '0');
|
||||
shift_register <= (OTHERS => '0');
|
||||
elsif (i_sd_clock_pulse_trigger = '1') then
|
||||
if ((not (current_state = s_RECEIVING_LEADING_BITS)) and (not (current_state = s_SEND_CRC))) then
|
||||
crc_counter <= (OTHERS => '0');
|
||||
else
|
||||
if (not (crc_counter = "1111")) then
|
||||
crc_counter <= crc_counter + '1';
|
||||
end if;
|
||||
end if;
|
||||
if ((current_state = s_RECEIVING_DATA) or (current_state = s_SEND_DATA)) then
|
||||
if (not ((bit_counter = "000") and (byte_counter = "111111111"))) then
|
||||
if (bit_counter = "000") then
|
||||
byte_counter <= byte_counter + '1';
|
||||
bit_counter <= "111";
|
||||
else
|
||||
bit_counter <= bit_counter - '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
-- Output data bit.
|
||||
if (current_state = s_SEND_START_BIT) then
|
||||
dataout_1bit <= '0';
|
||||
elsif (current_state = s_SEND_DATA) then
|
||||
dataout_1bit <= from_mem_1_bit;
|
||||
elsif (current_state = s_SEND_CRC) then
|
||||
dataout_1bit <= from_crc_generator;
|
||||
else
|
||||
dataout_1bit <= '1'; -- Stop bit.
|
||||
end if;
|
||||
|
||||
-- Shift register to store the CRC bits once the message is received.
|
||||
if ((current_state = s_RECEIVING_DATA) or
|
||||
(current_state = s_RECEIVING_LEADING_BITS) or
|
||||
(current_state = s_RECEIVING_STOP_BIT)) then
|
||||
shift_register(16 downto 1) <= shift_register(15 downto 0);
|
||||
shift_register(0) <= data_in_reg;
|
||||
end if;
|
||||
data_in_reg <= i_1bit_data_in;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Register holding the timeout value for data transmission.
|
||||
timeout_reg: process(i_clock, i_reset_n, current_state, i_sd_clock_pulse_trigger)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
timeout_register <= (OTHERS => '0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
if ((current_state = s_SEND_STOP) or
|
||||
(current_state = s_WAIT_REQUEST)) then
|
||||
timeout_register <= (OTHERS => '0');
|
||||
elsif (i_sd_clock_pulse_trigger = '1') then
|
||||
-- Increment the timeout counter
|
||||
if (((current_state = s_WAIT_DATA_START) or
|
||||
(current_state = s_WAIT_BUSY)) and (not (timeout_register = TIMEOUT))) then
|
||||
timeout_register <= timeout_register + '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Instantiated components.
|
||||
crc16_checker: Altera_UP_SD_CRC16_Generator
|
||||
port map
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_sync_reset => local_reset,
|
||||
i_enable => crc_generator_enable,
|
||||
i_shift => shift_crc,
|
||||
i_datain => to_crc_generator,
|
||||
o_dataout => from_crc_generator,
|
||||
o_crcout => crc_out
|
||||
);
|
||||
|
||||
packet_memory: Altera_UP_SD_Card_Memory_Block
|
||||
PORT MAP
|
||||
(
|
||||
address_a => i_address_16bit_port,
|
||||
address_b => packet_mem_addr_b,
|
||||
clock_a => i_clock,
|
||||
clock_b => i_clock,
|
||||
data_a => i_16bit_data_in,
|
||||
data_b => single_bit_conversion,
|
||||
enable_a => i_enable_16bit_port,
|
||||
enable_b => '1',
|
||||
wren_a => i_write_16bit,
|
||||
wren_b => recv_data,
|
||||
q_a => o_16bit_data_out,
|
||||
q_b => single_bit_out
|
||||
);
|
||||
from_mem_1_bit <= single_bit_out(0);
|
||||
packet_mem_addr_b <= (byte_counter & bit_counter);
|
||||
|
||||
end rtl;
|
|
@ -1,80 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-- This module is a clock generator for the SD card interface. It takes a 50 MHz
|
||||
-- clock as input and produces a clock signal that depends on the mode in which the
|
||||
-- SD card interface is in. For a card identification mode a clock with a frequency of
|
||||
-- 390.625 kHz is generated. For the data transfer mode, a clock with a frequency of
|
||||
-- 12.5MHz is generated.
|
||||
--
|
||||
-- In addition, the generator produces a clock_mode value that identifies the frequency
|
||||
-- of the o_SD_clock that is currently being generated.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
-------------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Clock is
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_mode : in std_logic; -- 0 for card identification mode, 1 for data transfer mode.
|
||||
o_SD_clock : out std_logic;
|
||||
o_clock_mode : out std_logic;
|
||||
o_trigger_receive : out std_logic;
|
||||
o_trigger_send : out std_logic
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Clock is
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal counter : std_logic_vector(6 downto 0);
|
||||
signal local_mode : std_logic;
|
||||
-- UNREGISTERED
|
||||
begin
|
||||
process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
counter <= (OTHERS => '0');
|
||||
local_mode <= '0';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
if (i_enable = '1') then
|
||||
counter <= counter + '1';
|
||||
end if;
|
||||
-- Change the clock pulse only when at the positive edge of the clock
|
||||
if (counter = "1000000") then
|
||||
local_mode <= i_mode;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
o_clock_mode <= local_mode;
|
||||
o_SD_clock <= counter(6) when (local_mode = '0') else counter(1);
|
||||
o_trigger_receive <= '1' when ((local_mode = '0') and (counter = "0111111")) else
|
||||
((not counter(1)) and (counter(0))) when (local_mode = '1') else '0';
|
||||
o_trigger_send <= '1' when ((local_mode = '0') and (counter = "0011111")) else
|
||||
((counter(1)) and (counter(0))) when (local_mode = '1') else '0';
|
||||
|
||||
end rtl;
|
|
@ -1,347 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
-- This is an FSM that controls the SD Card interface circuitry.
|
||||
--
|
||||
-- On reset, the FSM will initiate a predefined set of commands in an attempt to connect to the SD Card.
|
||||
-- When successful, it will allow commands to be issued to the SD Card, otherwise it will return a signal that
|
||||
-- no card is present in the SD Card slot.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Control_FSM is
|
||||
generic (
|
||||
PREDEFINED_COMMAND_GET_STATUS : STD_LOGIC_VECTOR(3 downto 0) := "1001"
|
||||
);
|
||||
port
|
||||
(
|
||||
-- Clock and Reset signals
|
||||
i_clock : in STD_LOGIC;
|
||||
i_reset_n : in STD_LOGIC;
|
||||
|
||||
-- FSM Inputs
|
||||
i_user_command_ready : in std_logic;
|
||||
i_response_received : in STD_LOGIC;
|
||||
i_response_timed_out : in STD_LOGIC;
|
||||
i_response_crc_passed : in STD_LOGIC;
|
||||
i_command_sent : in STD_LOGIC;
|
||||
i_powerup_busy_n : in STD_LOGIC;
|
||||
i_clocking_pulse_enable : in std_logic;
|
||||
i_current_clock_mode : in std_logic;
|
||||
i_user_message_valid : in std_logic;
|
||||
i_last_cmd_was_55 : in std_logic;
|
||||
i_allow_partial_rw : in std_logic;
|
||||
|
||||
-- FSM Outputs
|
||||
o_generate_command : out STD_LOGIC;
|
||||
o_predefined_command_ID : out STD_LOGIC_VECTOR(3 downto 0);
|
||||
o_receive_response : out STD_LOGIC;
|
||||
o_drive_CMD_line : out STD_LOGIC;
|
||||
o_SD_clock_mode : out STD_LOGIC; -- 0 means slow clock for card identification, 1 means fast clock for transfer mode.
|
||||
o_resetting : out std_logic;
|
||||
o_card_connected : out STD_LOGIC;
|
||||
o_command_completed : out std_logic;
|
||||
o_clear_response_register : out std_logic;
|
||||
o_enable_clock_generator : out std_logic
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Control_FSM is
|
||||
|
||||
-- Build an enumerated type for the state machine. On reset always reset the DE2 and read the state
|
||||
-- of the switches.
|
||||
type state_type is (s_RESET, s_WAIT_74_CYCLES, s_GENERATE_PREDEFINED_COMMAND, s_WAIT_PREDEFINED_COMMAND_TRANSMITTED, s_WAIT_PREDEFINED_COMMAND_RESPONSE,
|
||||
s_GO_TO_NEXT_COMMAND, s_TOGGLE_CLOCK_FREQUENCY, s_AWAIT_USER_COMMAND, s_REACTIVATE_CLOCK,
|
||||
s_GENERATE_COMMAND, s_SEND_COMMAND, s_WAIT_RESPONSE, s_WAIT_FOR_CLOCK_EDGE_BEFORE_DISABLE, s_WAIT_DEASSERT,
|
||||
s_PERIODIC_STATUS_CHECK);
|
||||
|
||||
-- Register to hold the current state
|
||||
signal current_state : state_type;
|
||||
signal next_state : state_type;
|
||||
|
||||
-------------------
|
||||
-- Local signals
|
||||
-------------------
|
||||
-- REGISTERED
|
||||
signal SD_clock_mode, waiting_for_vdd_setup : std_logic;
|
||||
signal id_sequence_step_index : std_logic_vector(3 downto 0);
|
||||
signal delay_counter : std_logic_vector(6 downto 0);
|
||||
signal periodic_status_check : std_logic_vector(23 downto 0);
|
||||
-- UNREGISTERED
|
||||
|
||||
begin
|
||||
-- Define state transitions.
|
||||
state_transitions: process (current_state, i_command_sent, i_response_received, id_sequence_step_index,
|
||||
i_response_timed_out, i_response_crc_passed, delay_counter, waiting_for_vdd_setup,
|
||||
i_user_command_ready, i_clocking_pulse_enable, i_current_clock_mode,
|
||||
i_user_message_valid, i_last_cmd_was_55, periodic_status_check)
|
||||
begin
|
||||
case current_state is
|
||||
when s_RESET =>
|
||||
-- Reset local registers and begin identification process.
|
||||
next_state <= s_WAIT_74_CYCLES;
|
||||
|
||||
when s_WAIT_74_CYCLES =>
|
||||
-- Wait 74 cycles before the card can be sent commands to.
|
||||
if (delay_counter = "1001010") then
|
||||
next_state <= s_GENERATE_PREDEFINED_COMMAND;
|
||||
else
|
||||
next_state <= s_WAIT_74_CYCLES;
|
||||
end if;
|
||||
|
||||
when s_GENERATE_PREDEFINED_COMMAND =>
|
||||
-- Generate a predefined command to the SD card. This is the identification process for the SD card.
|
||||
next_state <= s_WAIT_PREDEFINED_COMMAND_TRANSMITTED;
|
||||
|
||||
when s_WAIT_PREDEFINED_COMMAND_TRANSMITTED =>
|
||||
-- Send a predefined command to the SD card. This is the identification process for the SD card.
|
||||
if (i_command_sent = '1') then
|
||||
next_state <= s_WAIT_PREDEFINED_COMMAND_RESPONSE;
|
||||
else
|
||||
next_state <= s_WAIT_PREDEFINED_COMMAND_TRANSMITTED;
|
||||
end if;
|
||||
|
||||
when s_WAIT_PREDEFINED_COMMAND_RESPONSE =>
|
||||
-- Wait for a response from SD card.
|
||||
if (i_response_received = '1') then
|
||||
if (i_response_timed_out = '1') then
|
||||
if (waiting_for_vdd_setup = '1') then
|
||||
next_state <= s_GO_TO_NEXT_COMMAND;
|
||||
else
|
||||
next_state <= s_RESET;
|
||||
end if;
|
||||
else
|
||||
if (i_response_crc_passed = '0') then
|
||||
next_state <= s_GENERATE_PREDEFINED_COMMAND;
|
||||
else
|
||||
next_state <= s_GO_TO_NEXT_COMMAND;
|
||||
end if;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_PREDEFINED_COMMAND_RESPONSE;
|
||||
end if;
|
||||
|
||||
when s_GO_TO_NEXT_COMMAND =>
|
||||
-- Process the next command in the ID sequence.
|
||||
if (id_sequence_step_index = PREDEFINED_COMMAND_GET_STATUS) then
|
||||
next_state <= s_TOGGLE_CLOCK_FREQUENCY;
|
||||
else
|
||||
next_state <= s_GENERATE_PREDEFINED_COMMAND;
|
||||
end if;
|
||||
|
||||
when s_TOGGLE_CLOCK_FREQUENCY =>
|
||||
-- Now that the card has been initialized, increase the SD card clock frequency to 25MHz.
|
||||
-- Wait for the clock generator to switch operating mode before proceeding further.
|
||||
if (i_current_clock_mode = '1') then
|
||||
next_state <= s_AWAIT_USER_COMMAND;
|
||||
else
|
||||
next_state <= s_TOGGLE_CLOCK_FREQUENCY;
|
||||
end if;
|
||||
|
||||
when s_AWAIT_USER_COMMAND =>
|
||||
-- Wait for the user to send a command to the SD card
|
||||
if (i_user_command_ready = '1') then
|
||||
next_state <= s_REACTIVATE_CLOCK;
|
||||
else
|
||||
-- Every 5 million cycles, or 0.1 of a second.
|
||||
if (periodic_status_check = "010011000100101101000000") then
|
||||
next_state <= s_PERIODIC_STATUS_CHECK;
|
||||
else
|
||||
next_state <= s_AWAIT_USER_COMMAND;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_PERIODIC_STATUS_CHECK =>
|
||||
-- Update status every now and then.
|
||||
next_state <= s_GENERATE_PREDEFINED_COMMAND;
|
||||
|
||||
when s_REACTIVATE_CLOCK =>
|
||||
-- Activate the clock signal and wait 8 clock cycles.
|
||||
if (delay_counter = "0001000") then
|
||||
next_state <= s_GENERATE_COMMAND;
|
||||
else
|
||||
next_state <= s_REACTIVATE_CLOCK;
|
||||
end if;
|
||||
|
||||
when s_GENERATE_COMMAND =>
|
||||
-- Generate user command. If valid, proceed further. Otherwise, indicate that the command is invalid.
|
||||
if (i_user_message_valid = '0') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_SEND_COMMAND;
|
||||
end if;
|
||||
|
||||
when s_SEND_COMMAND =>
|
||||
-- Wait for the command to be sent.
|
||||
if (i_command_sent = '1') then
|
||||
next_state <= s_WAIT_RESPONSE;
|
||||
else
|
||||
next_state <= s_SEND_COMMAND;
|
||||
end if;
|
||||
|
||||
when s_WAIT_RESPONSE =>
|
||||
-- Wait for the SD card to respond.
|
||||
if (i_response_received = '1') then
|
||||
if (i_response_timed_out = '1') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_FOR_CLOCK_EDGE_BEFORE_DISABLE;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_RESPONSE;
|
||||
end if;
|
||||
|
||||
when s_WAIT_FOR_CLOCK_EDGE_BEFORE_DISABLE =>
|
||||
-- Wait for a positive clock edge before you disable the clock.
|
||||
if (i_clocking_pulse_enable = '1') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_FOR_CLOCK_EDGE_BEFORE_DISABLE;
|
||||
end if;
|
||||
|
||||
when s_WAIT_DEASSERT =>
|
||||
-- wait for the user to release command generation request.
|
||||
if (i_user_command_ready = '1') then
|
||||
next_state <= s_WAIT_DEASSERT;
|
||||
else
|
||||
if (i_last_cmd_was_55 = '1') then
|
||||
next_state <= s_AWAIT_USER_COMMAND;
|
||||
else
|
||||
-- Send a get status command to obtain the result of sending the last command.
|
||||
next_state <= s_GENERATE_PREDEFINED_COMMAND;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when others =>
|
||||
-- Make sure to start in the reset state if the circuit powers up in an odd state.
|
||||
next_state <= s_RESET;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
-- State registers.
|
||||
state_registers: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
current_state <= s_RESET;
|
||||
elsif (rising_edge(i_clock)) then
|
||||
current_state <= next_state;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Local FFs:
|
||||
local_ffs:process ( i_clock, i_reset_n, i_powerup_busy_n, current_state,
|
||||
id_sequence_step_index, i_response_received, i_response_timed_out,
|
||||
i_allow_partial_rw)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
SD_clock_mode <= '0';
|
||||
id_sequence_step_index <= (OTHERS => '0');
|
||||
periodic_status_check <= (OTHERS => '0');
|
||||
waiting_for_vdd_setup <= '0';
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- Set SD clock mode to 0 initially, thereby using a clock with frequency between 100 kHz and 400 kHz as
|
||||
-- per SD card specifications. When the card is initialized change the clock to run at 25 MHz.
|
||||
if (current_state = s_WAIT_DEASSERT) then
|
||||
periodic_status_check <= (OTHERS => '0');
|
||||
elsif (current_state = s_AWAIT_USER_COMMAND) then
|
||||
periodic_status_check <= periodic_status_check + '1';
|
||||
end if;
|
||||
|
||||
if (current_state = s_RESET) then
|
||||
SD_clock_mode <= '0';
|
||||
elsif (current_state = s_TOGGLE_CLOCK_FREQUENCY) then
|
||||
SD_clock_mode <= '1';
|
||||
end if;
|
||||
-- Update the ID sequence step as needed.
|
||||
if (current_state = s_RESET) then
|
||||
id_sequence_step_index <= (OTHERS => '0');
|
||||
elsif (current_state = s_GO_TO_NEXT_COMMAND) then
|
||||
if ((i_powerup_busy_n = '0') and (id_sequence_step_index = "0010")) then
|
||||
id_sequence_step_index <= "0001";
|
||||
else
|
||||
if (id_sequence_step_index = "0110") then
|
||||
if (i_allow_partial_rw = '0') then
|
||||
-- If partial read-write not allowed, then skip SET_BLK_LEN command - it will fail.
|
||||
id_sequence_step_index <= "1000";
|
||||
else
|
||||
id_sequence_step_index <= "0111";
|
||||
end if;
|
||||
else
|
||||
id_sequence_step_index <= id_sequence_step_index + '1';
|
||||
end if;
|
||||
end if;
|
||||
elsif (current_state = s_WAIT_DEASSERT) then
|
||||
if (i_last_cmd_was_55 = '0') then
|
||||
-- After each command execute a get status command.
|
||||
id_sequence_step_index <= PREDEFINED_COMMAND_GET_STATUS;
|
||||
end if;
|
||||
elsif (current_state = s_PERIODIC_STATUS_CHECK) then
|
||||
id_sequence_step_index <= PREDEFINED_COMMAND_GET_STATUS;
|
||||
end if;
|
||||
|
||||
-- Do not reset the card when SD card is having its VDD set up. Wait for it to respond, this may take some time.
|
||||
if (id_sequence_step_index = "0010") then
|
||||
waiting_for_vdd_setup <= '1';
|
||||
elsif ((id_sequence_step_index = "0011") or (current_state = s_RESET)) then
|
||||
waiting_for_vdd_setup <= '0';
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Counter that counts to 74 to delay any commands.
|
||||
initial_delay_counter: process(i_clock, i_reset_n, i_clocking_pulse_enable )
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
delay_counter <= (OTHERS => '0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
if ((current_state = s_RESET) or (current_state = s_AWAIT_USER_COMMAND))then
|
||||
delay_counter <= (OTHERS => '0');
|
||||
elsif (((current_state = s_WAIT_74_CYCLES) or (current_state = s_REACTIVATE_CLOCK)) and
|
||||
(i_clocking_pulse_enable = '1')) then
|
||||
delay_counter <= delay_counter + '1';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- FSM outputs.
|
||||
o_SD_clock_mode <= SD_clock_mode;
|
||||
o_generate_command <= '1' when ((current_state = s_GENERATE_PREDEFINED_COMMAND) or
|
||||
(current_state = s_GENERATE_COMMAND))
|
||||
else '0';
|
||||
o_receive_response <= '1' when ((current_state = s_WAIT_PREDEFINED_COMMAND_RESPONSE) or
|
||||
(current_state = s_WAIT_RESPONSE))
|
||||
else '0';
|
||||
o_drive_CMD_line <= '1' when ( (current_state = s_WAIT_PREDEFINED_COMMAND_TRANSMITTED) or
|
||||
(current_state = s_SEND_COMMAND)) else '0';
|
||||
o_predefined_command_ID <= id_sequence_step_index;
|
||||
o_card_connected <= '1' when (id_sequence_step_index(3) = '1') and (
|
||||
(id_sequence_step_index(2) = '1') or
|
||||
(id_sequence_step_index(1) = '1') or
|
||||
(id_sequence_step_index(0) = '1'))
|
||||
else '0';
|
||||
o_resetting <= '1' when (current_state = s_RESET) else '0';
|
||||
o_command_completed <= '1' when (current_state = s_WAIT_DEASSERT) else '0';
|
||||
o_enable_clock_generator <= '0' when (current_state = s_AWAIT_USER_COMMAND) else '1';
|
||||
o_clear_response_register <= '1' when (current_state = s_REACTIVATE_CLOCK) else '0';
|
||||
|
||||
end rtl;
|
||||
|
|
@ -1,518 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-- This module is an interface to the Secure Data Card. This module is intended to be
|
||||
-- used with the DE2 board.
|
||||
--
|
||||
-- This version of the interface supports only a 1-bit serial data transfer. This
|
||||
-- allows the interface to support a MultiMedia card as well.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
-------------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Interface is
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
|
||||
-- Command interface
|
||||
b_SD_cmd : inout std_logic;
|
||||
b_SD_dat : inout std_logic;
|
||||
b_SD_dat3 : inout std_logic;
|
||||
i_command_ID : in std_logic_vector(5 downto 0);
|
||||
i_argument : in std_logic_vector(31 downto 0);
|
||||
i_user_command_ready : in std_logic;
|
||||
|
||||
o_SD_clock : out std_logic;
|
||||
o_card_connected : out std_logic;
|
||||
o_command_completed : out std_logic;
|
||||
o_command_valid : out std_logic;
|
||||
o_command_timed_out : out std_logic;
|
||||
o_command_crc_failed : out std_logic;
|
||||
|
||||
-- Buffer access
|
||||
i_buffer_enable : in std_logic;
|
||||
i_buffer_address : in std_logic_vector(7 downto 0);
|
||||
i_buffer_write : in std_logic;
|
||||
i_buffer_data_in : in std_logic_vector(15 downto 0);
|
||||
o_buffer_data_out : out std_logic_vector(15 downto 0);
|
||||
|
||||
-- Show SD Card registers as outputs
|
||||
o_SD_REG_card_identification_number : out std_logic_vector(127 downto 0);
|
||||
o_SD_REG_relative_card_address : out std_logic_vector(15 downto 0);
|
||||
o_SD_REG_operating_conditions_register : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_card_specific_data : out std_logic_vector(127 downto 0);
|
||||
o_SD_REG_status_register : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_response_R1 : out std_logic_vector(31 downto 0);
|
||||
o_SD_REG_status_register_valid : out std_logic
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Interface is
|
||||
|
||||
component Altera_UP_SD_Card_Clock
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_mode : in std_logic; -- 0 for card identification mode, 1 for data transfer mode.
|
||||
o_SD_clock : out std_logic;
|
||||
o_clock_mode : out std_logic;
|
||||
o_trigger_receive : out std_logic;
|
||||
o_trigger_send : out std_logic
|
||||
);
|
||||
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_CRC7_Generator
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(6 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_CRC16_Generator
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Signal_Trigger
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_signal : in std_logic;
|
||||
o_trigger : out std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Card_48_bit_Command_Generator
|
||||
generic (
|
||||
-- Basic commands
|
||||
COMMAND_0_GO_IDLE : STD_LOGIC_VECTOR(5 downto 0) := "000000";
|
||||
COMMAND_2_ALL_SEND_CID : STD_LOGIC_VECTOR(5 downto 0) := "000010";
|
||||
COMMAND_3_SEND_RCA : STD_LOGIC_VECTOR(5 downto 0) := "000011";
|
||||
COMMAND_4_SET_DSR : STD_LOGIC_VECTOR(5 downto 0) := "000100";
|
||||
COMMAND_6_SWITCH_FUNCTION : STD_LOGIC_VECTOR(5 downto 0) := "000110";
|
||||
COMMAND_7_SELECT_CARD : STD_LOGIC_VECTOR(5 downto 0) := "000111";
|
||||
COMMAND_9_SEND_CSD : STD_LOGIC_VECTOR(5 downto 0) := "001001";
|
||||
COMMAND_10_SEND_CID : STD_LOGIC_VECTOR(5 downto 0) := "001010";
|
||||
COMMAND_12_STOP_TRANSMISSION : STD_LOGIC_VECTOR(5 downto 0) := "001100";
|
||||
COMMAND_13_SEND_STATUS : STD_LOGIC_VECTOR(5 downto 0) := "001101";
|
||||
COMMAND_15_GO_INACTIVE : STD_LOGIC_VECTOR(5 downto 0) := "001111";
|
||||
-- Block oriented read/write/lock commands
|
||||
COMMAND_16_SET_BLOCK_LENGTH : STD_LOGIC_VECTOR(5 downto 0) := "010000";
|
||||
-- Block oriented read commands
|
||||
COMMAND_17_READ_BLOCK : STD_LOGIC_VECTOR(5 downto 0) := "010001";
|
||||
COMMAND_18_READ_MULTIPLE_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "010010";
|
||||
-- Block oriented write commands
|
||||
COMMAND_24_WRITE_BLOCK : STD_LOGIC_VECTOR(5 downto 0) := "011000";
|
||||
COMMAND_25_WRITE_MULTIPLE_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "011001";
|
||||
COMMAND_27_PROGRAM_CSD : STD_LOGIC_VECTOR(5 downto 0) := "011011";
|
||||
-- Block oriented write-protection commands
|
||||
COMMAND_28_SET_WRITE_PROTECT : STD_LOGIC_VECTOR(5 downto 0) := "011100";
|
||||
COMMAND_29_CLEAR_WRITE_PROTECT : STD_LOGIC_VECTOR(5 downto 0) := "011101";
|
||||
COMMAND_30_SEND_PROTECTED_GROUPS : STD_LOGIC_VECTOR(5 downto 0) := "011110";
|
||||
-- Erase commands
|
||||
COMMAND_32_ERASE_BLOCK_START : STD_LOGIC_VECTOR(5 downto 0) := "100000";
|
||||
COMMAND_33_ERASE_BLOCK_END : STD_LOGIC_VECTOR(5 downto 0) := "100001";
|
||||
COMMAND_38_ERASE_SELECTED_GROUPS : STD_LOGIC_VECTOR(5 downto 0) := "100110";
|
||||
-- Block lock commands
|
||||
COMMAND_42_LOCK_UNLOCK : STD_LOGIC_VECTOR(5 downto 0) := "101010";
|
||||
-- Command Type Settings
|
||||
COMMAND_55_APP_CMD : STD_LOGIC_VECTOR(5 downto 0) := "110111";
|
||||
COMMAND_56_GEN_CMD : STD_LOGIC_VECTOR(5 downto 0) := "111000";
|
||||
-- Application Specific commands - must be preceeded with command 55.
|
||||
ACOMMAND_6_SET_BUS_WIDTH : STD_LOGIC_VECTOR(5 downto 0) := "000110";
|
||||
ACOMMAND_13_SD_STATUS : STD_LOGIC_VECTOR(5 downto 0) := "001101";
|
||||
ACOMMAND_22_SEND_NUM_WR_BLOCKS : STD_LOGIC_VECTOR(5 downto 0) := "010100";
|
||||
ACOMMAND_23_SET_BLK_ERASE_COUNT : STD_LOGIC_VECTOR(5 downto 0) := "010101";
|
||||
ACOMMAND_41_SEND_OP_CONDITION : STD_LOGIC_VECTOR(5 downto 0) := "101001";
|
||||
ACOMMAND_42_SET_CLR_CARD_DETECT : STD_LOGIC_VECTOR(5 downto 0) := "101010";
|
||||
ACOMMAND_51_SEND_SCR : STD_LOGIC_VECTOR(5 downto 0) := "110011";
|
||||
-- First custom_command
|
||||
FIRST_NON_PREDEFINED_COMMAND : STD_LOGIC_VECTOR(3 downto 0) := "1010"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_message_bit_out : in std_logic;
|
||||
i_command_ID : in std_logic_vector(5 downto 0);
|
||||
i_argument : in std_logic_vector(31 downto 0);
|
||||
i_predefined_message : in std_logic_vector(3 downto 0);
|
||||
i_generate : in std_logic;
|
||||
i_DSR : in std_logic_vector(15 downto 0);
|
||||
i_OCR : in std_logic_vector(31 downto 0);
|
||||
i_RCA : in std_logic_vector(15 downto 0);
|
||||
o_dataout : out std_logic;
|
||||
o_message_done : out std_logic;
|
||||
o_valid : out std_logic;
|
||||
o_returning_ocr : out std_logic;
|
||||
o_returning_cid : out std_logic;
|
||||
o_returning_rca : out std_logic;
|
||||
o_returning_csd : out std_logic;
|
||||
o_returning_status : out std_logic;
|
||||
o_data_read : out std_logic;
|
||||
o_data_write : out std_logic;
|
||||
o_wait_cmd_busy : out std_logic;
|
||||
o_last_cmd_was_55 : out std_logic;
|
||||
o_response_type : out std_logic_vector(2 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Card_Response_Receiver
|
||||
generic (
|
||||
TIMEOUT : std_logic_vector(7 downto 0) := "00111000";
|
||||
BUSY_WAIT : std_logic_vector(7 downto 0) := "00110000";
|
||||
PROCESSING_DELAY : std_logic_vector(7 downto 0) := "00001000"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_begin : in std_logic;
|
||||
i_scan_pulse : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
i_wait_cmd_busy : in std_logic;
|
||||
i_response_type : in std_logic_vector(2 downto 0);
|
||||
o_data : out std_logic_vector(127 downto 0);
|
||||
o_CRC_passed : out std_logic;
|
||||
o_timeout : out std_logic;
|
||||
o_done : out std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Card_Control_FSM
|
||||
generic (
|
||||
PREDEFINED_COMMAND_GET_STATUS : STD_LOGIC_VECTOR(3 downto 0) := "1001"
|
||||
);
|
||||
port
|
||||
(
|
||||
-- Clock and Reset signals
|
||||
i_clock : in STD_LOGIC;
|
||||
i_reset_n : in STD_LOGIC;
|
||||
|
||||
-- FSM Inputs
|
||||
i_user_command_ready : in std_logic;
|
||||
i_response_received : in STD_LOGIC;
|
||||
i_response_timed_out : in STD_LOGIC;
|
||||
i_response_crc_passed : in STD_LOGIC;
|
||||
i_command_sent : in STD_LOGIC;
|
||||
i_powerup_busy_n : in STD_LOGIC;
|
||||
i_clocking_pulse_enable : in std_logic;
|
||||
i_current_clock_mode : in std_logic;
|
||||
i_user_message_valid : in std_logic;
|
||||
i_last_cmd_was_55 : in std_logic;
|
||||
i_allow_partial_rw : in std_logic;
|
||||
|
||||
-- FSM Outputs
|
||||
o_generate_command : out STD_LOGIC;
|
||||
o_predefined_command_ID : out STD_LOGIC_VECTOR(3 downto 0);
|
||||
o_receive_response : out STD_LOGIC;
|
||||
o_drive_CMD_line : out STD_LOGIC;
|
||||
o_SD_clock_mode : out STD_LOGIC; -- 0 means slow clock for card identification, 1 means fast clock for transfer mode.
|
||||
o_resetting : out std_logic;
|
||||
o_card_connected : out STD_LOGIC;
|
||||
o_command_completed : out std_logic;
|
||||
o_clear_response_register : out std_logic;
|
||||
o_enable_clock_generator : out std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component Altera_UP_SD_Card_Buffer
|
||||
generic (
|
||||
TIMEOUT : std_logic_vector(15 downto 0) := "1111111111111111";
|
||||
BUSY_WAIT : std_logic_vector(15 downto 0) := "0000001111110000"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
|
||||
-- 1 bit port to transmit and receive data on the data line.
|
||||
i_begin : in std_logic;
|
||||
i_sd_clock_pulse_trigger : in std_logic;
|
||||
i_transmit : in std_logic;
|
||||
i_1bit_data_in : in std_logic;
|
||||
o_1bit_data_out : out std_logic;
|
||||
o_operation_complete : out std_logic;
|
||||
o_crc_passed : out std_logic;
|
||||
o_timed_out : out std_logic;
|
||||
o_dat_direction : out std_logic; -- set to 1 to send data, set to 0 to receive it.
|
||||
|
||||
-- 16 bit port to be accessed by a user circuit.
|
||||
i_enable_16bit_port : in std_logic;
|
||||
i_address_16bit_port : in std_logic_vector(7 downto 0);
|
||||
i_write_16bit : in std_logic;
|
||||
i_16bit_data_in : in std_logic_vector(15 downto 0);
|
||||
o_16bit_data_out : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal sd_mode : std_logic;
|
||||
-- SD Card Registers:
|
||||
signal SD_REG_card_identification_number : std_logic_vector(127 downto 0);
|
||||
signal SD_REG_response_R1 : std_logic_vector(31 downto 0);
|
||||
signal SD_REG_relative_card_address : std_logic_vector(15 downto 0);
|
||||
signal SD_REG_driver_stage_register : std_logic_vector(15 downto 0);
|
||||
signal SD_REG_card_specific_data : std_logic_vector(127 downto 0);
|
||||
signal SD_REG_operating_conditions_register : std_logic_vector(31 downto 0);
|
||||
signal SD_REG_status_register : std_logic_vector(31 downto 0);
|
||||
signal SD_REG_status_register_valid : std_logic;
|
||||
-- UNREGISTERED
|
||||
signal data_from_buffer : std_logic_vector(15 downto 0);
|
||||
signal clock_generator_mode, enable_generator, SD_clock, create_message : std_logic;
|
||||
signal send_next_bit, receive_next_bit : std_logic;
|
||||
signal timed_out, response_done, passed_crc, begin_reading_response, resetting : std_logic;
|
||||
signal returning_cid, returning_rca, returning_csd, returning_ocr : std_logic;
|
||||
signal response_type : std_logic_vector(2 downto 0);
|
||||
signal message_valid, messange_sent, data_to_CMD_line, CMD_tristate_buffer_enable, message_sent : std_logic;
|
||||
signal predef_message_ID : std_logic_vector(3 downto 0);
|
||||
signal receive_data_out : std_logic_vector(127 downto 0);
|
||||
signal data_line_done, data_line_crc, data_line_timeout, data_line_direction, data_line_out : std_logic;
|
||||
signal data_read, data_write, wait_cmd_busy, clear_response_register : std_logic;
|
||||
signal response_done_combined : std_logic;
|
||||
signal timeout_combined : std_logic;
|
||||
signal crc_combined, allow_partial_rw : std_logic;
|
||||
signal begin_data_line_operations, last_cmd_was_55, message_sent_trigger, returning_status : std_logic;
|
||||
signal data_line_sd_clock_pulse_trigger : std_logic;
|
||||
begin
|
||||
-- Glue logic
|
||||
SD_REG_driver_stage_register <= (OTHERS => '0');
|
||||
response_done_combined <= (response_done and (not data_read) and (not data_write)) or
|
||||
(response_done and (data_read or data_write) and data_line_done);
|
||||
timeout_combined <= (timed_out and (not data_read) and (not data_write)) or
|
||||
(timed_out and (data_read or data_write) and data_line_timeout);
|
||||
crc_combined <= (passed_crc and (not data_read) and (not data_write)) or
|
||||
(passed_crc and (data_read or data_write) and data_line_crc);
|
||||
begin_data_line_operations <= (data_read and message_sent) or (data_write and response_done);
|
||||
|
||||
-- Partial read and write are only allowed when both bit 79 (partial read allowed) is high and
|
||||
-- bit 21 (partial write allowed) is high.
|
||||
allow_partial_rw <= SD_REG_card_specific_data(79) and SD_REG_card_specific_data(21);
|
||||
|
||||
-- SD Card control registers
|
||||
control_regs: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
SD_REG_operating_conditions_register <= (OTHERS => '0');
|
||||
SD_REG_card_identification_number <= (OTHERS => '0');
|
||||
SD_REG_relative_card_address <= (OTHERS => '0');
|
||||
SD_REG_card_specific_data <= (OTHERS => '0');
|
||||
SD_REG_status_register <= (OTHERS => '0');
|
||||
SD_REG_response_R1 <= (OTHERS => '1');
|
||||
SD_REG_status_register_valid <= '0';
|
||||
elsif (rising_edge(i_clock)) then
|
||||
if ((response_type = "001") and (response_done = '1') and (returning_status = '0') and (clear_response_register = '0')) then
|
||||
SD_REG_response_R1 <= receive_data_out(31 downto 0);
|
||||
elsif (clear_response_register = '1') then
|
||||
SD_REG_response_R1 <= (OTHERS => '1');
|
||||
end if;
|
||||
if (resetting = '1') then
|
||||
SD_REG_operating_conditions_register <= (OTHERS => '0');
|
||||
elsif ((returning_ocr = '1') and (passed_crc = '1') and (response_done = '1') and (timed_out = '0')) then
|
||||
SD_REG_operating_conditions_register <= receive_data_out(31 downto 0);
|
||||
end if;
|
||||
if ((returning_cid = '1') and (passed_crc = '1') and (response_done = '1') and (timed_out = '0')) then
|
||||
SD_REG_card_identification_number <= receive_data_out;
|
||||
end if;
|
||||
if ((returning_rca = '1') and (passed_crc = '1') and (response_done = '1') and (timed_out = '0')) then
|
||||
SD_REG_relative_card_address <= receive_data_out(31 downto 16);
|
||||
end if;
|
||||
if ((returning_csd = '1') and (passed_crc = '1') and (response_done = '1') and (timed_out = '0')) then
|
||||
SD_REG_card_specific_data <= receive_data_out;
|
||||
end if;
|
||||
if (message_sent_trigger = '1') then
|
||||
SD_REG_status_register_valid <= '0';
|
||||
elsif ((returning_status = '1') and (passed_crc = '1') and (response_done = '1') and (timed_out = '0')) then
|
||||
SD_REG_status_register <= receive_data_out(31 downto 0);
|
||||
SD_REG_status_register_valid <= '1';
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Instantiated components
|
||||
command_generator: Altera_UP_SD_Card_48_bit_Command_Generator PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_message_bit_out => send_next_bit,
|
||||
i_command_ID => i_command_ID,
|
||||
i_argument => i_argument,
|
||||
i_predefined_message => predef_message_ID,
|
||||
i_generate => create_message,
|
||||
i_DSR => SD_REG_driver_stage_register,
|
||||
i_OCR => SD_REG_operating_conditions_register,
|
||||
i_RCA => SD_REG_relative_card_address,
|
||||
o_dataout => data_to_CMD_line,
|
||||
o_message_done => message_sent,
|
||||
o_valid => message_valid,
|
||||
o_returning_ocr => returning_ocr,
|
||||
o_returning_cid => returning_cid,
|
||||
o_returning_rca => returning_rca,
|
||||
o_returning_csd => returning_csd,
|
||||
o_returning_status => returning_status,
|
||||
o_data_read => data_read,
|
||||
o_data_write => data_write,
|
||||
o_wait_cmd_busy => wait_cmd_busy,
|
||||
o_last_cmd_was_55 => last_cmd_was_55,
|
||||
o_response_type => response_type
|
||||
);
|
||||
|
||||
response_receiver: Altera_UP_SD_Card_Response_Receiver PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_begin => begin_reading_response,
|
||||
i_scan_pulse => receive_next_bit,
|
||||
i_datain => b_SD_cmd,
|
||||
i_response_type => response_type,
|
||||
i_wait_cmd_busy => wait_cmd_busy,
|
||||
o_data => receive_data_out,
|
||||
o_CRC_passed => passed_crc,
|
||||
o_timeout => timed_out,
|
||||
o_done => response_done
|
||||
);
|
||||
|
||||
control_FSM: Altera_UP_SD_Card_Control_FSM PORT MAP
|
||||
(
|
||||
-- Clock and Reset signals
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
|
||||
-- FSM Inputs
|
||||
i_user_command_ready => i_user_command_ready,
|
||||
i_clocking_pulse_enable => receive_next_bit,
|
||||
i_response_received => response_done_combined,
|
||||
i_response_timed_out => timeout_combined,
|
||||
i_response_crc_passed => crc_combined,
|
||||
i_command_sent => message_sent,
|
||||
i_powerup_busy_n => SD_REG_operating_conditions_register(31),
|
||||
i_current_clock_mode => clock_generator_mode,
|
||||
i_user_message_valid => message_valid,
|
||||
i_last_cmd_was_55 => last_cmd_was_55,
|
||||
i_allow_partial_rw => allow_partial_rw,
|
||||
|
||||
-- FSM Outputs
|
||||
o_generate_command => create_message,
|
||||
o_predefined_command_ID => predef_message_ID,
|
||||
o_receive_response => begin_reading_response,
|
||||
o_drive_CMD_line => CMD_tristate_buffer_enable,
|
||||
o_SD_clock_mode => sd_mode, -- 0 means slow clock for card identification, 1 means fast clock for transfer mode.
|
||||
o_card_connected => o_card_connected,
|
||||
o_command_completed => o_command_completed,
|
||||
o_resetting => resetting,
|
||||
o_clear_response_register => clear_response_register,
|
||||
o_enable_clock_generator => enable_generator
|
||||
);
|
||||
|
||||
clock_generator: Altera_UP_SD_Card_Clock PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_mode => sd_mode,
|
||||
i_enable => enable_generator,
|
||||
o_SD_clock => SD_clock,
|
||||
o_clock_mode => clock_generator_mode,
|
||||
o_trigger_receive => receive_next_bit,
|
||||
o_trigger_send => send_next_bit
|
||||
);
|
||||
|
||||
SD_clock_pulse_trigger: Altera_UP_SD_Signal_Trigger PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_signal => message_sent,
|
||||
o_trigger => message_sent_trigger
|
||||
);
|
||||
|
||||
data_line: Altera_UP_SD_Card_Buffer
|
||||
port map
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
|
||||
-- 1 bit port to transmit and receive data on the data line.
|
||||
i_begin => begin_data_line_operations,
|
||||
i_sd_clock_pulse_trigger => data_line_sd_clock_pulse_trigger,
|
||||
i_transmit => data_write,
|
||||
i_1bit_data_in => b_SD_dat,
|
||||
o_1bit_data_out => data_line_out,
|
||||
o_operation_complete => data_line_done,
|
||||
o_crc_passed => data_line_crc,
|
||||
o_timed_out => data_line_timeout,
|
||||
o_dat_direction => data_line_direction,
|
||||
|
||||
-- 16 bit port to be accessed by a user circuit.
|
||||
i_enable_16bit_port => i_buffer_enable,
|
||||
i_address_16bit_port => i_buffer_address,
|
||||
i_write_16bit => i_buffer_write,
|
||||
i_16bit_data_in => i_buffer_data_in,
|
||||
o_16bit_data_out => data_from_buffer
|
||||
);
|
||||
data_line_sd_clock_pulse_trigger <= (data_write and send_next_bit) or ((not data_write) and receive_next_bit);
|
||||
|
||||
-- Buffer output registers.
|
||||
buff_regs: process(i_clock, i_reset_n, data_from_buffer)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
o_buffer_data_out <= (OTHERS=> '0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
o_buffer_data_out <= data_from_buffer;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Circuit outputs.
|
||||
o_command_valid <= message_valid;
|
||||
o_command_timed_out <= timeout_combined;
|
||||
o_command_crc_failed <= not crc_combined;
|
||||
o_SD_clock <= SD_clock;
|
||||
b_SD_cmd <= data_to_CMD_line when (CMD_tristate_buffer_enable = '1') else 'Z';
|
||||
b_SD_dat <= data_line_out when (data_line_direction = '1') else 'Z';
|
||||
b_SD_dat3 <= 'Z'; -- Set SD card to SD mode.
|
||||
-- SD card registers
|
||||
o_SD_REG_card_identification_number <= SD_REG_card_identification_number;
|
||||
o_SD_REG_relative_card_address <= SD_REG_relative_card_address;
|
||||
o_SD_REG_operating_conditions_register <= SD_REG_operating_conditions_register;
|
||||
o_SD_REG_card_specific_data <= SD_REG_card_specific_data;
|
||||
o_SD_REG_status_register <= SD_REG_status_register;
|
||||
o_SD_REG_response_R1 <= SD_REG_response_R1;
|
||||
o_SD_REG_status_register_valid <= SD_REG_status_register_valid;
|
||||
|
||||
end rtl;
|
|
@ -1,296 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-- megafunction wizard: %RAM: 2-PORT%
|
||||
-- GENERATION: STANDARD
|
||||
-- VERSION: WM1.0
|
||||
-- MODULE: altsyncram
|
||||
|
||||
-- ============================================================
|
||||
-- File Name: Altera_UP_SD_Card_Memory_Block.vhd
|
||||
-- Megafunction Name(s):
|
||||
-- altsyncram
|
||||
--
|
||||
-- Simulation Library Files(s):
|
||||
-- altera_mf
|
||||
-- ============================================================
|
||||
-- ************************************************************
|
||||
-- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
--
|
||||
-- 8.0 Build 215 05/29/2008 SJ Full Version
|
||||
-- ************************************************************
|
||||
|
||||
|
||||
--Copyright (C) 1991-2013 Altera Corporation
|
||||
--Your use of Altera Corporation's design tools, logic functions
|
||||
--and other software and tools, and its AMPP partner logic
|
||||
--functions, and any output files from any of the foregoing
|
||||
--(including device programming or simulation files), and any
|
||||
--associated documentation or information are expressly subject
|
||||
--to the terms and conditions of the Altera Program License
|
||||
--Subscription Agreement, Altera MegaCore Function License
|
||||
--Agreement, or other applicable license agreement, including,
|
||||
--without limitation, that your use is for the sole purpose of
|
||||
--programming logic devices manufactured by Altera and sold by
|
||||
--Altera or its authorized distributors. Please refer to the
|
||||
--applicable agreement for further details.
|
||||
|
||||
|
||||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.all;
|
||||
|
||||
LIBRARY altera_mf;
|
||||
USE altera_mf.all;
|
||||
|
||||
ENTITY Altera_UP_SD_Card_Memory_Block IS
|
||||
PORT
|
||||
(
|
||||
address_a : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
address_b : IN STD_LOGIC_VECTOR (11 DOWNTO 0);
|
||||
clock_a : IN STD_LOGIC ;
|
||||
clock_b : IN STD_LOGIC ;
|
||||
data_a : IN STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
data_b : IN STD_LOGIC_VECTOR (0 DOWNTO 0);
|
||||
enable_a : IN STD_LOGIC := '1';
|
||||
enable_b : IN STD_LOGIC := '1';
|
||||
wren_a : IN STD_LOGIC := '1';
|
||||
wren_b : IN STD_LOGIC := '1';
|
||||
q_a : OUT STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
q_b : OUT STD_LOGIC_VECTOR (0 DOWNTO 0)
|
||||
);
|
||||
END Altera_UP_SD_Card_Memory_Block;
|
||||
|
||||
|
||||
ARCHITECTURE SYN OF altera_up_sd_card_memory_block IS
|
||||
|
||||
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
SIGNAL sub_wire1 : STD_LOGIC_VECTOR (0 DOWNTO 0);
|
||||
|
||||
|
||||
|
||||
COMPONENT altsyncram
|
||||
GENERIC (
|
||||
address_reg_b : STRING;
|
||||
clock_enable_input_a : STRING;
|
||||
clock_enable_input_b : STRING;
|
||||
clock_enable_output_a : STRING;
|
||||
clock_enable_output_b : STRING;
|
||||
indata_reg_b : STRING;
|
||||
init_file : STRING;
|
||||
init_file_layout : STRING;
|
||||
intended_device_family : STRING;
|
||||
lpm_type : STRING;
|
||||
numwords_a : NATURAL;
|
||||
numwords_b : NATURAL;
|
||||
operation_mode : STRING;
|
||||
outdata_aclr_a : STRING;
|
||||
outdata_aclr_b : STRING;
|
||||
outdata_reg_a : STRING;
|
||||
outdata_reg_b : STRING;
|
||||
power_up_uninitialized : STRING;
|
||||
widthad_a : NATURAL;
|
||||
widthad_b : NATURAL;
|
||||
width_a : NATURAL;
|
||||
width_b : NATURAL;
|
||||
width_byteena_a : NATURAL;
|
||||
width_byteena_b : NATURAL;
|
||||
wrcontrol_wraddress_reg_b : STRING
|
||||
);
|
||||
PORT (
|
||||
clocken0 : IN STD_LOGIC ;
|
||||
clocken1 : IN STD_LOGIC ;
|
||||
wren_a : IN STD_LOGIC ;
|
||||
clock0 : IN STD_LOGIC ;
|
||||
wren_b : IN STD_LOGIC ;
|
||||
clock1 : IN STD_LOGIC ;
|
||||
address_a : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
|
||||
address_b : IN STD_LOGIC_VECTOR (11 DOWNTO 0);
|
||||
q_a : OUT STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
q_b : OUT STD_LOGIC_VECTOR (0 DOWNTO 0);
|
||||
data_a : IN STD_LOGIC_VECTOR (15 DOWNTO 0);
|
||||
data_b : IN STD_LOGIC_VECTOR (0 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
BEGIN
|
||||
q_a <= sub_wire0(15 DOWNTO 0);
|
||||
q_b <= sub_wire1(0 DOWNTO 0);
|
||||
|
||||
altsyncram_component : altsyncram
|
||||
GENERIC MAP (
|
||||
address_reg_b => "CLOCK1",
|
||||
clock_enable_input_a => "NORMAL",
|
||||
clock_enable_input_b => "NORMAL",
|
||||
clock_enable_output_a => "BYPASS",
|
||||
clock_enable_output_b => "BYPASS",
|
||||
indata_reg_b => "CLOCK1",
|
||||
init_file => "initial_data.mif",
|
||||
init_file_layout => "PORT_A",
|
||||
intended_device_family => "Cyclone II",
|
||||
lpm_type => "altsyncram",
|
||||
numwords_a => 256,
|
||||
numwords_b => 4096,
|
||||
operation_mode => "BIDIR_DUAL_PORT",
|
||||
outdata_aclr_a => "NONE",
|
||||
outdata_aclr_b => "NONE",
|
||||
outdata_reg_a => "UNREGISTERED",
|
||||
outdata_reg_b => "UNREGISTERED",
|
||||
power_up_uninitialized => "FALSE",
|
||||
widthad_a => 8,
|
||||
widthad_b => 12,
|
||||
width_a => 16,
|
||||
width_b => 1,
|
||||
width_byteena_a => 1,
|
||||
width_byteena_b => 1,
|
||||
wrcontrol_wraddress_reg_b => "CLOCK1"
|
||||
)
|
||||
PORT MAP (
|
||||
clocken0 => enable_a,
|
||||
clocken1 => enable_b,
|
||||
wren_a => wren_a,
|
||||
clock0 => clock_a,
|
||||
wren_b => wren_b,
|
||||
clock1 => clock_b,
|
||||
address_a => address_a,
|
||||
address_b => address_b,
|
||||
data_a => data_a,
|
||||
data_b => data_b,
|
||||
q_a => sub_wire0,
|
||||
q_b => sub_wire1
|
||||
);
|
||||
|
||||
|
||||
|
||||
END SYN;
|
||||
|
||||
-- ============================================================
|
||||
-- CNX file retrieval info
|
||||
-- ============================================================
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
-- Retrieval info: PRIVATE: BlankMemory NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRdata NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: CLRwren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock NUMERIC "5"
|
||||
-- Retrieval info: PRIVATE: Clock_A NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: Clock_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: ECC NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
|
||||
-- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone II"
|
||||
-- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
|
||||
-- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: MEMSIZE NUMERIC "4096"
|
||||
-- Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: MIFfilename STRING "initial_data.mif"
|
||||
-- Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
|
||||
-- Retrieval info: PRIVATE: REGdata NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGq NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrdaddress NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGrren NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: REGwren NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
-- Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: VarWidth NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "16"
|
||||
-- Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "16"
|
||||
-- Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
|
||||
-- Retrieval info: PRIVATE: enable NUMERIC "1"
|
||||
-- Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
-- Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK1"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "NORMAL"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "NORMAL"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
|
||||
-- Retrieval info: CONSTANT: INDATA_REG_B STRING "CLOCK1"
|
||||
-- Retrieval info: CONSTANT: INIT_FILE STRING "initial_data.mif"
|
||||
-- Retrieval info: CONSTANT: INIT_FILE_LAYOUT STRING "PORT_A"
|
||||
-- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone II"
|
||||
-- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256"
|
||||
-- Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "4096"
|
||||
-- Retrieval info: CONSTANT: OPERATION_MODE STRING "BIDIR_DUAL_PORT"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: OUTDATA_REG_B STRING "UNREGISTERED"
|
||||
-- Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8"
|
||||
-- Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "12"
|
||||
-- Retrieval info: CONSTANT: WIDTH_A NUMERIC "16"
|
||||
-- Retrieval info: CONSTANT: WIDTH_B NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WIDTH_BYTEENA_B NUMERIC "1"
|
||||
-- Retrieval info: CONSTANT: WRCONTROL_WRADDRESS_REG_B STRING "CLOCK1"
|
||||
-- Retrieval info: USED_PORT: address_a 0 0 8 0 INPUT NODEFVAL address_a[7..0]
|
||||
-- Retrieval info: USED_PORT: address_b 0 0 12 0 INPUT NODEFVAL address_b[11..0]
|
||||
-- Retrieval info: USED_PORT: clock_a 0 0 0 0 INPUT NODEFVAL clock_a
|
||||
-- Retrieval info: USED_PORT: clock_b 0 0 0 0 INPUT NODEFVAL clock_b
|
||||
-- Retrieval info: USED_PORT: data_a 0 0 16 0 INPUT NODEFVAL data_a[15..0]
|
||||
-- Retrieval info: USED_PORT: data_b 0 0 1 0 INPUT NODEFVAL data_b[0..0]
|
||||
-- Retrieval info: USED_PORT: enable_a 0 0 0 0 INPUT VCC enable_a
|
||||
-- Retrieval info: USED_PORT: enable_b 0 0 0 0 INPUT VCC enable_b
|
||||
-- Retrieval info: USED_PORT: q_a 0 0 16 0 OUTPUT NODEFVAL q_a[15..0]
|
||||
-- Retrieval info: USED_PORT: q_b 0 0 1 0 OUTPUT NODEFVAL q_b[0..0]
|
||||
-- Retrieval info: USED_PORT: wren_a 0 0 0 0 INPUT VCC wren_a
|
||||
-- Retrieval info: USED_PORT: wren_b 0 0 0 0 INPUT VCC wren_b
|
||||
-- Retrieval info: CONNECT: @data_a 0 0 16 0 data_a 0 0 16 0
|
||||
-- Retrieval info: CONNECT: @wren_a 0 0 0 0 wren_a 0 0 0 0
|
||||
-- Retrieval info: CONNECT: q_a 0 0 16 0 @q_a 0 0 16 0
|
||||
-- Retrieval info: CONNECT: q_b 0 0 1 0 @q_b 0 0 1 0
|
||||
-- Retrieval info: CONNECT: @address_a 0 0 8 0 address_a 0 0 8 0
|
||||
-- Retrieval info: CONNECT: @data_b 0 0 1 0 data_b 0 0 1 0
|
||||
-- Retrieval info: CONNECT: @address_b 0 0 12 0 address_b 0 0 12 0
|
||||
-- Retrieval info: CONNECT: @wren_b 0 0 0 0 wren_b 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @clock0 0 0 0 0 clock_a 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @clocken0 0 0 0 0 enable_a 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @clock1 0 0 0 0 clock_b 0 0 0 0
|
||||
-- Retrieval info: CONNECT: @clocken1 0 0 0 0 enable_b 0 0 0 0
|
||||
-- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block.vhd TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block.inc FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block.cmp TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block.bsf TRUE FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block_inst.vhd FALSE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block_waveforms.html TRUE
|
||||
-- Retrieval info: GEN_FILE: TYPE_NORMAL Altera_UP_SD_Card_Memory_Block_wave*.jpg FALSE
|
||||
-- Retrieval info: LIB_FILE: altera_mf
|
|
@ -1,308 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
-- This module looks at the data on the CMD line and waits to receive a response.
|
||||
-- It begins examining the data lines when the i_begin signal is asserted. It then
|
||||
-- waits for a first '0'. It then proceeds to store as many bits as are required by
|
||||
-- the response packet. Each message bit passes through the CRC7 circuit so that
|
||||
-- the CRC check sum can be verified at the end of transmission. The circuit then produces
|
||||
-- the o_data and o_CRC_passed outputs to indicate the message received and if the CRC
|
||||
-- check passed.
|
||||
--
|
||||
-- If for some reason the requested response does not arrive within 56 clock cycles
|
||||
-- then the circuit will produce a '1' on the o_timeout output. In such a case the
|
||||
-- o_data should be ignored.
|
||||
--
|
||||
-- In case of a response that is not 001, 010, 011 or 110, the circuit expects
|
||||
-- no response.
|
||||
--
|
||||
-- A signal o_done is asserted when the circuit has completed response retrieval. In
|
||||
-- a case when a response is not expected, just wait for the CD Card to process the
|
||||
-- command. This is done by waiting 8 (=PROCESSING_DELAY) clock cycles.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
-------------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_arith.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
|
||||
entity Altera_UP_SD_Card_Response_Receiver is
|
||||
generic (
|
||||
TIMEOUT : std_logic_vector(7 downto 0) := "00111000";
|
||||
BUSY_WAIT : std_logic_vector(7 downto 0) := "00110000";
|
||||
PROCESSING_DELAY : std_logic_vector(7 downto 0) := "00001000"
|
||||
);
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_begin : in std_logic;
|
||||
i_scan_pulse : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
i_wait_cmd_busy : in std_logic;
|
||||
i_response_type : in std_logic_vector(2 downto 0);
|
||||
o_data : out std_logic_vector(127 downto 0);
|
||||
o_CRC_passed : out std_logic;
|
||||
o_timeout : out std_logic;
|
||||
o_done : out std_logic
|
||||
);
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Card_Response_Receiver is
|
||||
|
||||
component Altera_UP_SD_CRC7_Generator
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_enable : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_shift : in std_logic;
|
||||
i_datain : in std_logic;
|
||||
o_dataout : out std_logic;
|
||||
o_crcout : out std_logic_vector(6 downto 0)
|
||||
);
|
||||
end component;
|
||||
-- Build an enumerated type for the state machine. On reset always reset the DE2 and read the state
|
||||
-- of the switches.
|
||||
type state_type is (s_WAIT_BEGIN, s_WAIT_END, s_WAIT_PROCESSING_DELAY, s_WAIT_BUSY, s_WAIT_BUSY_END, s_WAIT_BEGIN_DEASSERT);
|
||||
|
||||
-- Register to hold the current state
|
||||
signal current_state : state_type;
|
||||
signal next_state : state_type;
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal registered_data_input : std_logic_vector(127 downto 0);
|
||||
signal response_incoming : std_logic;
|
||||
signal counter, timeout_counter : std_logic_vector(7 downto 0);
|
||||
signal crc_shift, keep_reading_bits, shift_crc_bits : std_logic;
|
||||
-- UNREGISTERED
|
||||
signal limit, limit_minus_1 : std_logic_vector(7 downto 0);
|
||||
signal check_crc : std_logic;
|
||||
signal CRC_bits : std_logic_vector(6 downto 0);
|
||||
signal start_reading_bits, operation_complete, enable_crc_unit : std_logic;
|
||||
begin
|
||||
-- Control FSM. Begin operation when i_begin is raised, then wait for the operation to end and i_begin to be deasserted.
|
||||
state_regs: process(i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
current_state <= s_WAIT_BEGIN;
|
||||
elsif (rising_edge(i_clock)) then
|
||||
current_state <= next_state;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
state_transitions: process(current_state, i_begin, operation_complete, timeout_counter, i_wait_cmd_busy, i_scan_pulse, i_datain)
|
||||
begin
|
||||
case current_state is
|
||||
when s_WAIT_BEGIN =>
|
||||
if (i_begin = '1') then
|
||||
next_state <= s_WAIT_END;
|
||||
else
|
||||
next_state <= s_WAIT_BEGIN;
|
||||
end if;
|
||||
|
||||
when s_WAIT_END =>
|
||||
if (operation_complete = '1') then
|
||||
if (timeout_counter = TIMEOUT) then
|
||||
next_state <= s_WAIT_BEGIN_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_PROCESSING_DELAY;
|
||||
end if;
|
||||
|
||||
else
|
||||
next_state <= s_WAIT_END;
|
||||
end if;
|
||||
|
||||
when s_WAIT_PROCESSING_DELAY =>
|
||||
if (timeout_counter = PROCESSING_DELAY) then
|
||||
if (i_wait_cmd_busy = '1') then
|
||||
next_state <= s_WAIT_BUSY;
|
||||
else
|
||||
next_state <= s_WAIT_BEGIN_DEASSERT;
|
||||
end if;
|
||||
else
|
||||
next_state <= s_WAIT_PROCESSING_DELAY;
|
||||
end if;
|
||||
|
||||
when s_WAIT_BUSY =>
|
||||
if ((i_scan_pulse = '1') and (i_datain = '0')) then
|
||||
next_state <= s_WAIT_BUSY_END;
|
||||
else
|
||||
if (timeout_counter = BUSY_WAIT) then
|
||||
-- If the card did not become busy, then it would not have raised the optional busy signal.
|
||||
-- In such a case, proceeed further as the command has finished correctly.
|
||||
next_state <= s_WAIT_BEGIN_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_BUSY;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when s_WAIT_BUSY_END =>
|
||||
if ((i_scan_pulse = '1') and (i_datain = '1')) then
|
||||
next_state <= s_WAIT_BEGIN_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_BUSY_END;
|
||||
end if;
|
||||
|
||||
when s_WAIT_BEGIN_DEASSERT =>
|
||||
if (i_begin = '1') then
|
||||
next_state <= s_WAIT_BEGIN_DEASSERT;
|
||||
else
|
||||
next_state <= s_WAIT_BEGIN;
|
||||
end if;
|
||||
when others =>
|
||||
next_state <= s_WAIT_BEGIN;
|
||||
end case;
|
||||
end process;
|
||||
|
||||
-- Store the response as it appears on the i_datain line.
|
||||
received_data_buffer: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
registered_data_input <= (OTHERS=>'0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- Only read new data and update the counter value when the scan pulse is high.
|
||||
if (i_scan_pulse = '1') then
|
||||
if ((start_reading_bits = '1') or (keep_reading_bits = '1')) then
|
||||
registered_data_input(127 downto 1) <= registered_data_input(126 downto 0);
|
||||
registered_data_input(0) <= i_datain;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Counter received bits
|
||||
data_read_counter: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
counter <= (OTHERS=>'0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- Reset he counter every time you being reading the response.
|
||||
if (current_state = s_WAIT_BEGIN) then
|
||||
counter <= (OTHERS => '0');
|
||||
end if;
|
||||
-- Update the counter value when the scan pulse is high.
|
||||
if (i_scan_pulse = '1') then
|
||||
if ((start_reading_bits = '1') or (keep_reading_bits = '1')) then
|
||||
counter <= counter + '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
operation_complete <= '1' when (((counter = limit) and (not (limit = "00000000"))) or
|
||||
(timeout_counter = TIMEOUT) or
|
||||
((timeout_counter = PROCESSING_DELAY) and (limit = "00000000"))) else '0';
|
||||
|
||||
-- Count the number of scan pulses before the response is received. If the counter
|
||||
-- exceeds TIMEOUT value, then an error must have occured when the SD card received a message.
|
||||
timeout_counter_control: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
timeout_counter <= (OTHERS=>'0');
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- Reset the counter every time you begin reading the response.
|
||||
if ((current_state = s_WAIT_BEGIN) or ((current_state = s_WAIT_END) and (operation_complete = '1') and (not (timeout_counter = TIMEOUT)))) then
|
||||
timeout_counter <= (OTHERS => '0');
|
||||
end if;
|
||||
-- Update the counter value when the scan pulse is high.
|
||||
if (i_scan_pulse = '1') then
|
||||
if (((start_reading_bits = '0') and (keep_reading_bits = '0') and (current_state = s_WAIT_END) and (not (timeout_counter = TIMEOUT))) or
|
||||
(current_state = s_WAIT_PROCESSING_DELAY) or (current_state = s_WAIT_BUSY)) then
|
||||
timeout_counter <= timeout_counter + '1';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Enable data storing only after you see the first 0.
|
||||
read_enable_logic: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
keep_reading_bits <= '0';
|
||||
elsif (rising_edge(i_clock)) then
|
||||
if (i_scan_pulse = '1') then
|
||||
if ((start_reading_bits = '1') or ((keep_reading_bits = '1') and (not (counter = limit_minus_1)))) then
|
||||
keep_reading_bits <= '1';
|
||||
else
|
||||
keep_reading_bits <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
start_reading_bits <= '1' when ((current_state = s_WAIT_END) and (i_datain = '0') and
|
||||
(counter = "00000000") and (not (limit = "00000000"))) else '0';
|
||||
|
||||
-- CRC7 checker.
|
||||
crc_checker: Altera_UP_SD_CRC7_Generator PORT MAP
|
||||
(
|
||||
i_clock => i_clock,
|
||||
i_reset_n => i_reset_n,
|
||||
i_enable => enable_crc_unit,
|
||||
i_shift => shift_crc_bits,
|
||||
i_datain => registered_data_input(7),
|
||||
o_crcout => CRC_bits
|
||||
);
|
||||
enable_crc_unit <= '1' when ((i_scan_pulse = '1') and (current_state = s_WAIT_END)) else '0';
|
||||
|
||||
-- Clear CRC7 registers before processing the response bits
|
||||
crc_control_register: process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
shift_crc_bits <= '1';
|
||||
elsif (rising_edge(i_clock)) then
|
||||
-- Reset he counter every time you being reading the response.
|
||||
if (current_state = s_WAIT_BEGIN) then
|
||||
-- clear the CRC7 contents before you process the next message.
|
||||
shift_crc_bits <= '1';
|
||||
end if;
|
||||
-- Only read new data and update the counter value when the scan pulse is high.
|
||||
if (i_scan_pulse = '1') then
|
||||
if ((start_reading_bits = '1') or (keep_reading_bits = '1')) then
|
||||
if (counter = "00000111") then
|
||||
-- Once the 7-bits of the CRC checker have been cleared you can process the message and
|
||||
-- compute its CRC bits to verify the validity of the transmission.
|
||||
shift_crc_bits <= '0';
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- Indicate the number of bits to expect in the response packet.
|
||||
limit <= "00110000" when ((i_response_type = "001") or
|
||||
(i_response_type = "011") or
|
||||
(i_response_type = "110")) else
|
||||
"10001000" when (i_response_type = "010") else
|
||||
"00000000"; -- No response
|
||||
limit_minus_1 <=
|
||||
"00101111" when ((i_response_type = "001") or
|
||||
(i_response_type = "011") or
|
||||
(i_response_type = "110")) else
|
||||
"10000111" when (i_response_type = "010") else
|
||||
"00000000"; -- No response
|
||||
|
||||
check_crc <= '1' when ((i_response_type = "001") or (i_response_type = "110")) else '0';
|
||||
|
||||
-- Generate Circuit outputs
|
||||
o_data <= (registered_data_input(127 downto 1) & '1') when (i_response_type = "010") else
|
||||
(CONV_STD_LOGIC_VECTOR(0, 96) & registered_data_input(39 downto 8));
|
||||
|
||||
o_CRC_passed <= '1' when ((check_crc = '0') or
|
||||
((registered_data_input(0) = '1') and (CRC_bits = registered_data_input(7 downto 1)))) else '0';
|
||||
|
||||
o_timeout <= '1' when (timeout_counter = TIMEOUT) else '0';
|
||||
o_done <= '1' when (current_state = s_WAIT_BEGIN_DEASSERT) else '0';
|
||||
end rtl;
|
|
@ -1,57 +0,0 @@
|
|||
-- (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions and other
|
||||
-- software and tools, and its AMPP partner logic functions, and any output
|
||||
-- files any of the foregoing (including device programming or simulation
|
||||
-- files), and any associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License Subscription
|
||||
-- Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
-- license agreement, including, without limitation, that your use is for the
|
||||
-- sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
-- Altera or its authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
|
||||
---------------------------------------------------------------------------------------
|
||||
-- This module generates a trigger pulse every time it sees a transition
|
||||
-- from 0 to 1 on signal i_signal.
|
||||
--
|
||||
-- NOTES/REVISIONS:
|
||||
---------------------------------------------------------------------------------------
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
entity Altera_UP_SD_Signal_Trigger is
|
||||
|
||||
port
|
||||
(
|
||||
i_clock : in std_logic;
|
||||
i_reset_n : in std_logic;
|
||||
i_signal : in std_logic;
|
||||
o_trigger : out std_logic
|
||||
);
|
||||
|
||||
end entity;
|
||||
|
||||
architecture rtl of Altera_UP_SD_Signal_Trigger is
|
||||
|
||||
-- Local wires
|
||||
-- REGISTERED
|
||||
signal local_reg : std_logic;
|
||||
begin
|
||||
|
||||
process (i_clock, i_reset_n)
|
||||
begin
|
||||
if (i_reset_n = '0') then
|
||||
local_reg <= '0';
|
||||
else
|
||||
if (rising_edge(i_clock)) then
|
||||
local_reg <= i_signal;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
o_trigger <= '1' when ((local_reg = '0') and (i_signal = '1'))
|
||||
else '0';
|
||||
end rtl;
|
105
ip/hw_crc32_qsys/hw_crc32_hw.tcl
Normal file
105
ip/hw_crc32_qsys/hw_crc32_hw.tcl
Normal file
|
@ -0,0 +1,105 @@
|
|||
#
|
||||
# request TCL package from ACDS 16.1
|
||||
#
|
||||
package require -exact qsys 16.1
|
||||
|
||||
|
||||
#
|
||||
# module pulpino
|
||||
#
|
||||
set_module_property DESCRIPTION "HW CRC32"
|
||||
set_module_property NAME hw_crc32
|
||||
#set_module_property VERSION 1.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "DSP"
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME hw_crc32
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
|
||||
set adv_dbg_if false
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL CRC_Component
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file CRC_Component.v SYSTEM_VERILOG PATH CRC_Component.v TOP_LEVEL_FILE
|
||||
|
||||
|
||||
add_fileset sim_verilog SIM_VERILOG "" "Verilog Simulation"
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE false
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL CRC_Component
|
||||
add_fileset_file CRC_Component.v SYSTEM_VERILOG PATH CRC_Component.v TOP_LEVEL_FILE
|
||||
|
||||
|
||||
|
||||
#
|
||||
# connection point clk_sink
|
||||
#
|
||||
add_interface clk_sink clock end
|
||||
set_interface_property clk_sink ENABLED true
|
||||
set_interface_property clk_sink EXPORT_OF ""
|
||||
set_interface_property clk_sink PORT_NAME_MAP ""
|
||||
set_interface_property clk_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clk_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clk_sink clk clk Input 1
|
||||
|
||||
|
||||
|
||||
#
|
||||
# connection point reset_sink
|
||||
#
|
||||
add_interface reset_sink reset end
|
||||
set_interface_property reset_sink associatedClock clk_sink
|
||||
set_interface_property reset_sink synchronousEdges DEASSERT
|
||||
set_interface_property reset_sink ENABLED true
|
||||
set_interface_property reset_sink EXPORT_OF ""
|
||||
set_interface_property reset_sink PORT_NAME_MAP ""
|
||||
set_interface_property reset_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset_sink reset reset Input 1
|
||||
|
||||
|
||||
|
||||
#
|
||||
# connection point avalon_slave
|
||||
#
|
||||
add_interface avalon_slave avalon end
|
||||
set_interface_property avalon_slave addressUnits WORDS
|
||||
set_interface_property avalon_slave associatedClock clk_sink
|
||||
set_interface_property avalon_slave associatedReset reset_sink
|
||||
set_interface_property avalon_slave bitsPerSymbol 8
|
||||
set_interface_property avalon_slave burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_slave burstcountUnits WORDS
|
||||
set_interface_property avalon_slave explicitAddressSpan 0
|
||||
set_interface_property avalon_slave holdTime 0
|
||||
set_interface_property avalon_slave linewrapBursts false
|
||||
set_interface_property avalon_slave maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_slave readLatency 1
|
||||
set_interface_property avalon_slave readWaitTime 1
|
||||
set_interface_property avalon_slave setupTime 0
|
||||
set_interface_property avalon_slave timingUnits Cycles
|
||||
set_interface_property avalon_slave writeWaitTime 0
|
||||
set_interface_property avalon_slave ENABLED true
|
||||
set_interface_property avalon_slave EXPORT_OF ""
|
||||
set_interface_property avalon_slave PORT_NAME_MAP ""
|
||||
set_interface_property avalon_slave CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_slave SVD_ADDRESS_GROUP ""
|
||||
add_interface_port avalon_slave address address Input 3
|
||||
add_interface_port avalon_slave readdata readdata Output 32
|
||||
add_interface_port avalon_slave read read Input 1
|
||||
add_interface_port avalon_slave chipselect chipselect Input 1
|
||||
add_interface_port avalon_slave byteenable byteenable Input 4
|
||||
add_interface_port avalon_slave write write Input 1
|
||||
add_interface_port avalon_slave writedata writedata Input 32
|
|
@ -9,15 +9,15 @@ extern "C"
|
|||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define SCL_MIN_CLKDIV 10
|
||||
|
||||
|
||||
void I2C_init(alt_u32 base,alt_u32 clk,alt_u32 speed);
|
||||
int I2C_start(alt_u32 base, alt_u32 add, alt_u32 read);
|
||||
alt_u32 I2C_read(alt_u32 base,alt_u32 last);
|
||||
alt_u32 I2C_write(alt_u32 base,alt_u8 data, alt_u32 last);
|
||||
alt_u32 SPI_read(alt_u32 base);
|
||||
void SPI_write(alt_u32 base,alt_u8 data);
|
||||
void SPI_read(alt_u32 base, alt_u8 *rdata, int len);
|
||||
void SPI_write(alt_u32 base, const alt_u8 *wdata, int len);
|
||||
#define I2C_OK (0)
|
||||
#define I2C_ACK (0)
|
||||
#define I2C_NOACK (1)
|
||||
|
|
|
@ -69,7 +69,7 @@ int I2C_start(alt_u32 base, alt_u32 add, alt_u32 read)
|
|||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_STA_MSK | I2C_OPENCORES_CR_WR_MSK );
|
||||
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
while (IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK) {}
|
||||
|
||||
/* now check to see if the address was acknowledged */
|
||||
if(IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_RXNACK_MSK)
|
||||
|
@ -119,7 +119,7 @@ alt_u32 I2C_read(alt_u32 base,alt_u32 last)
|
|||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_RD_MSK );
|
||||
}
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
while (IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK) {}
|
||||
|
||||
/* now read the data */
|
||||
return (IORD_I2C_OPENCORES_RXR(base));
|
||||
|
@ -162,7 +162,7 @@ alt_u32 I2C_write(alt_u32 base,alt_u8 data, alt_u32 last)
|
|||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_WR_MSK );
|
||||
}
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
while (IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK) {}
|
||||
|
||||
/* now check to see if the address was acknowledged */
|
||||
if(IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_RXNACK_MSK)
|
||||
|
@ -182,25 +182,31 @@ alt_u32 I2C_write(alt_u32 base,alt_u8 data, alt_u32 last)
|
|||
|
||||
}
|
||||
|
||||
alt_u32 SPI_read(alt_u32 base)
|
||||
void SPI_read(alt_u32 base, alt_u8 *rdata, int len)
|
||||
{
|
||||
/* start read*/
|
||||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_RD_MSK|I2C_OPENCORES_CR_NACK_MSK|I2C_OPENCORES_CR_SPIM_MSK );
|
||||
int i;
|
||||
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
|
||||
/* now read the data */
|
||||
return (IORD_I2C_OPENCORES_RXR(base));
|
||||
for (i=0; i<len; i++) {
|
||||
/* start read*/
|
||||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_RD_MSK|I2C_OPENCORES_CR_NACK_MSK|I2C_OPENCORES_CR_SPIM_MSK );
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
/* now read the data */
|
||||
if (rdata)
|
||||
rdata[i] = IORD_I2C_OPENCORES_RXR(base);
|
||||
}
|
||||
}
|
||||
|
||||
void SPI_write(alt_u32 base,alt_u8 data) {
|
||||
/* transmit the data*/
|
||||
IOWR_I2C_OPENCORES_TXR(base, data);
|
||||
void SPI_write(alt_u32 base, const alt_u8 *wdata, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* start write */
|
||||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_WR_MSK|I2C_OPENCORES_CR_NACK_MSK|I2C_OPENCORES_CR_SPIM_MSK );
|
||||
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
for (i=0; i<len; i++) {
|
||||
/* transmit the data*/
|
||||
IOWR_I2C_OPENCORES_TXR(base, wdata[i]);
|
||||
/* start write */
|
||||
IOWR_I2C_OPENCORES_CR(base, I2C_OPENCORES_CR_WR_MSK|I2C_OPENCORES_CR_NACK_MSK|I2C_OPENCORES_CR_SPIM_MSK );
|
||||
/* wait for the trnasaction to be over.*/
|
||||
while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,9 +129,12 @@
|
|||
module i2c_master_bit_ctrl(
|
||||
clk, rst, nReset,
|
||||
clk_cnt, ena, cmd, cmd_ack, busy, al, din, dout,
|
||||
scl_i, scl_o, scl_oen, sda_i, sda_o, sda_oen
|
||||
scl_i, scl_o, scl_oen, sda_i, sda_o, sda_oen, spi_miso
|
||||
);
|
||||
|
||||
// parameters
|
||||
parameter dedicated_spi = 0;
|
||||
|
||||
//
|
||||
// inputs & outputs
|
||||
//
|
||||
|
@ -164,6 +167,9 @@ module i2c_master_bit_ctrl(
|
|||
output sda_oen; // i2c data line output enable (active low)
|
||||
reg sda_oen;
|
||||
|
||||
// SPI MISO
|
||||
input spi_miso;
|
||||
reg spi_rden;
|
||||
|
||||
//
|
||||
// variable declarations
|
||||
|
@ -249,7 +255,7 @@ module i2c_master_bit_ctrl(
|
|||
else
|
||||
begin
|
||||
sSCL <= #1 scl_i;
|
||||
sSDA <= #1 sda_i;
|
||||
sSDA <= #1 spi_rden ? spi_miso : sda_i;
|
||||
|
||||
dSCL <= #1 sSCL;
|
||||
dSDA <= #1 sSDA;
|
||||
|
@ -349,6 +355,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b1;
|
||||
sda_oen <= #1 1'b1;
|
||||
sda_chk <= #1 1'b0;
|
||||
spi_rden <= #1 1'b0;
|
||||
end
|
||||
else if (rst | al)
|
||||
begin
|
||||
|
@ -357,6 +364,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b1;
|
||||
sda_oen <= #1 1'b1;
|
||||
sda_chk <= #1 1'b0;
|
||||
spi_rden <= #1 1'b0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -546,6 +554,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b0; // set SCL low
|
||||
sda_oen <= #1 1'b1; // tri-state SDA
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
spi_rden <= #1 1'b0; //clear SPI read enable
|
||||
end
|
||||
|
||||
spi_rd_b:
|
||||
|
@ -554,6 +563,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b0; // keep SCL low
|
||||
sda_oen <= #1 1'b1; // keep SDA tri-stated
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
spi_rden <= #1 1'b1; //set SPI read enable
|
||||
end
|
||||
|
||||
spi_rd_c:
|
||||
|
@ -562,6 +572,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b1; // set SCL high
|
||||
sda_oen <= #1 1'b1; // keep SDA tri-stated
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
spi_rden <= #1 1'b1; //set SPI read enable
|
||||
end
|
||||
|
||||
spi_rd_d:
|
||||
|
@ -571,6 +582,7 @@ module i2c_master_bit_ctrl(
|
|||
scl_oen <= #1 1'b1; // tri-state SCL
|
||||
sda_oen <= #1 1'b1; // keep SDA tri-stated
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
spi_rden <= #1 1'b0; //clear SPI read enable
|
||||
end
|
||||
|
||||
// write (last SPI bit)
|
||||
|
@ -578,7 +590,7 @@ module i2c_master_bit_ctrl(
|
|||
begin
|
||||
c_state <= #1 spi_wr_b;
|
||||
scl_oen <= #1 1'b0; // set SCL low
|
||||
sda_oen <= #1 1'b1; // keep SDA
|
||||
sda_oen <= #1 dedicated_spi ? din : 1'b1; // keep SDA tri-stated by default to avoid generating I2C start condition
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
end
|
||||
|
||||
|
@ -586,7 +598,7 @@ module i2c_master_bit_ctrl(
|
|||
begin
|
||||
c_state <= #1 spi_wr_c;
|
||||
scl_oen <= #1 1'b0; // keep SCL low
|
||||
sda_oen <= #1 din; // set SDA
|
||||
sda_oen <= #1 din; // set/keep SDA
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
end
|
||||
|
||||
|
@ -603,7 +615,7 @@ module i2c_master_bit_ctrl(
|
|||
c_state <= #1 idle;
|
||||
cmd_ack <= #1 1'b1;
|
||||
scl_oen <= #1 1'b1; // tri-state SCL
|
||||
sda_oen <= #1 1'b1; // tri-state SDA
|
||||
sda_oen <= #1 dedicated_spi ? din : 1'b1; // tri-state SDA by default to release bus for I2C mode
|
||||
sda_chk <= #1 1'b0; // don't check SDA output
|
||||
end
|
||||
|
||||
|
|
|
@ -74,7 +74,10 @@
|
|||
|
||||
module i2c_master_byte_ctrl (
|
||||
clk, rst, nReset, ena, clk_cnt, start, stop, read, write, ack_in, spi_mode, din,
|
||||
cmd_ack, ack_out, dout, i2c_busy, i2c_al, scl_i, scl_o, scl_oen, sda_i, sda_o, sda_oen );
|
||||
cmd_ack, ack_out, dout, i2c_busy, i2c_al, scl_i, scl_o, scl_oen, sda_i, sda_o, sda_oen, spi_miso );
|
||||
|
||||
// parameters
|
||||
parameter dedicated_spi = 0;
|
||||
|
||||
//
|
||||
// inputs & outputs
|
||||
|
@ -112,6 +115,8 @@ module i2c_master_byte_ctrl (
|
|||
output sda_o;
|
||||
output sda_oen;
|
||||
|
||||
// SPI MISO
|
||||
input spi_miso;
|
||||
|
||||
//
|
||||
// Variable declarations
|
||||
|
@ -147,7 +152,7 @@ module i2c_master_byte_ctrl (
|
|||
//
|
||||
|
||||
// hookup bit_controller
|
||||
i2c_master_bit_ctrl bit_controller (
|
||||
i2c_master_bit_ctrl #(.dedicated_spi(dedicated_spi)) bit_controller (
|
||||
.clk ( clk ),
|
||||
.rst ( rst ),
|
||||
.nReset ( nReset ),
|
||||
|
@ -164,7 +169,8 @@ module i2c_master_byte_ctrl (
|
|||
.scl_oen ( scl_oen ),
|
||||
.sda_i ( sda_i ),
|
||||
.sda_o ( sda_o ),
|
||||
.sda_oen ( sda_oen )
|
||||
.sda_oen ( sda_oen ),
|
||||
.spi_miso (spi_miso)
|
||||
);
|
||||
|
||||
// generate go-signal
|
||||
|
|
|
@ -75,10 +75,11 @@
|
|||
module i2c_master_top(
|
||||
wb_clk_i, wb_rst_i, arst_i, wb_adr_i, wb_dat_i, wb_dat_o,
|
||||
wb_we_i, wb_stb_i, wb_cyc_i, wb_ack_o, wb_inta_o,
|
||||
scl_pad_i, scl_pad_o, scl_padoen_o, sda_pad_i, sda_pad_o, sda_padoen_o );
|
||||
scl_pad_i, scl_pad_o, scl_padoen_o, sda_pad_i, sda_pad_o, sda_padoen_o, spi_miso_pad_i );
|
||||
|
||||
// parameters
|
||||
parameter ARST_LVL = 1'b0; // asynchronous reset level
|
||||
parameter dedicated_spi = 0;
|
||||
|
||||
//
|
||||
// inputs & outputs
|
||||
|
@ -112,7 +113,9 @@ module i2c_master_top(
|
|||
output sda_pad_o; // SDA-line output (always 1'b0)
|
||||
output sda_padoen_o; // SDA-line output enable (active low)
|
||||
|
||||
|
||||
// extra SPI MISO line
|
||||
input spi_miso_pad_i;
|
||||
|
||||
//
|
||||
// variable declarations
|
||||
//
|
||||
|
@ -230,7 +233,7 @@ module i2c_master_top(
|
|||
assign ien = ctr[6];
|
||||
|
||||
// hookup byte controller block
|
||||
i2c_master_byte_ctrl byte_controller (
|
||||
i2c_master_byte_ctrl #(.dedicated_spi(dedicated_spi)) byte_controller (
|
||||
.clk ( wb_clk_i ),
|
||||
.rst ( wb_rst_i ),
|
||||
.nReset ( rst_i ),
|
||||
|
@ -253,7 +256,8 @@ module i2c_master_top(
|
|||
.scl_oen ( scl_padoen_o ),
|
||||
.sda_i ( sda_pad_i ),
|
||||
.sda_o ( sda_pad_o ),
|
||||
.sda_oen ( sda_padoen_o )
|
||||
.sda_oen ( sda_padoen_o ),
|
||||
.spi_miso ( spi_miso_pad_i )
|
||||
);
|
||||
|
||||
// status register block + interrupt request signal
|
||||
|
|
|
@ -8,9 +8,10 @@ module i2c_opencores
|
|||
(
|
||||
wb_clk_i, wb_rst_i, wb_adr_i, wb_dat_i, wb_dat_o,
|
||||
wb_we_i, wb_stb_i, /*wb_cyc_i,*/ wb_ack_o, wb_inta_o,
|
||||
scl_pad_io, sda_pad_io
|
||||
scl_pad_io, sda_pad_io, spi_miso_pad_i
|
||||
);
|
||||
|
||||
parameter dedicated_spi = 0;
|
||||
|
||||
// Common bus signals
|
||||
input wb_clk_i; // WISHBONE clock
|
||||
|
@ -30,6 +31,9 @@ output wb_inta_o; // WISHBONE interrupt output
|
|||
inout scl_pad_io; // I2C clock io
|
||||
inout sda_pad_io; // I2C data io
|
||||
|
||||
// SPI MISO
|
||||
input spi_miso_pad_i;
|
||||
|
||||
wire wb_cyc_i; // WISHBONE cycle input
|
||||
// Wire tri-state scl/sda
|
||||
wire scl_pad_i;
|
||||
|
@ -39,7 +43,7 @@ wire scl_padoen_o;
|
|||
|
||||
assign wb_cyc_i = wb_stb_i;
|
||||
assign scl_pad_i = scl_pad_io;
|
||||
assign scl_pad_io = scl_padoen_o ? 1'bZ : scl_pad_o;
|
||||
assign scl_pad_io = scl_padoen_o ? (dedicated_spi ? 1'b1 : 1'bZ) : scl_pad_o;
|
||||
|
||||
wire sda_pad_i;
|
||||
wire sda_pad_o;
|
||||
|
@ -47,7 +51,7 @@ wire sda_pad_io;
|
|||
wire sda_padoen_o;
|
||||
|
||||
assign sda_pad_i = sda_pad_io;
|
||||
assign sda_pad_io = sda_padoen_o ? 1'bZ : sda_pad_o;
|
||||
assign sda_pad_io = sda_padoen_o ? (dedicated_spi ? 1'b1 : 1'bZ) : sda_pad_o;
|
||||
|
||||
// Avalon doesn't have an asynchronous reset
|
||||
// set it to be inactive and just use synchronous reset
|
||||
|
@ -57,7 +61,7 @@ wire arst_i;
|
|||
assign arst_i = 1'b1;
|
||||
|
||||
// Connect the top level I2C core
|
||||
i2c_master_top i2c_master_top_inst
|
||||
i2c_master_top #(.dedicated_spi(dedicated_spi)) i2c_master_top_inst
|
||||
(
|
||||
.wb_clk_i(wb_clk_i), .wb_rst_i(wb_rst_i), .arst_i(arst_i),
|
||||
|
||||
|
@ -66,7 +70,8 @@ i2c_master_top i2c_master_top_inst
|
|||
.wb_ack_o(wb_ack_o), .wb_inta_o(wb_inta_o),
|
||||
|
||||
.scl_pad_i(scl_pad_i), .scl_pad_o(scl_pad_o), .scl_padoen_o(scl_padoen_o),
|
||||
.sda_pad_i(sda_pad_i), .sda_pad_o(sda_pad_o), .sda_padoen_o(sda_padoen_o)
|
||||
.sda_pad_i(sda_pad_i), .sda_pad_o(sda_pad_o), .sda_padoen_o(sda_padoen_o),
|
||||
.spi_miso_pad_i(spi_miso_pad_i)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
|
|
@ -18,9 +18,9 @@ package require -exact qsys 13.1
|
|||
#
|
||||
# module i2c_opencores
|
||||
#
|
||||
set_module_property DESCRIPTION "I2C Master Peripheral from opencores.org"
|
||||
set_module_property DESCRIPTION "I2C Master Peripheral from opencores.org, plus SPI master (CPOL=1, CPHA=1) functionality using the same bus."
|
||||
set_module_property NAME i2c_opencores
|
||||
set_module_property VERSION 13.0
|
||||
set_module_property VERSION 17.1
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Interface Protocols/Serial"
|
||||
|
@ -59,7 +59,14 @@ add_fileset_file timescale.v VERILOG PATH timescale.v
|
|||
#
|
||||
# parameters
|
||||
#
|
||||
|
||||
add_parameter dedicated_spi INTEGER 1
|
||||
set_parameter_property dedicated_spi DEFAULT_VALUE 0
|
||||
set_parameter_property dedicated_spi DISPLAY_NAME "Dedicated SPI mode"
|
||||
set_parameter_property dedicated_spi DISPLAY_HINT boolean
|
||||
set_parameter_property dedicated_spi TYPE INTEGER
|
||||
set_parameter_property dedicated_spi UNITS None
|
||||
set_parameter_property dedicated_spi HDL_PARAMETER true
|
||||
set_parameter_property dedicated_spi DESCRIPTION "Enables higher speed by always driving clock&data lines (no tristate) and by outputting data on falling clk edge without delay."
|
||||
|
||||
#
|
||||
# display items
|
||||
|
@ -109,6 +116,7 @@ set_interface_property export SVD_ADDRESS_GROUP ""
|
|||
|
||||
add_interface_port export scl_pad_io export Bidir 1
|
||||
add_interface_port export sda_pad_io export Bidir 1
|
||||
add_interface_port export spi_miso_pad_i export Input 1
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -1,224 +0,0 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Author - JCJB *
|
||||
* *
|
||||
* This design uses the following CRC-32 implementations: *
|
||||
* *
|
||||
* --> Software - Uses modulo 2 division to perform the remainder calculation. *
|
||||
* --> Optimized Software - Uses a lookup table of all possible division *
|
||||
* values. The calculation operates on 8 bit data. *
|
||||
* --> Custom Instruction - Uses a parallel hardware CRC circuit to calculate *
|
||||
* the remainder. The calculation operates on 8, *
|
||||
* 16, 24, or 32 bit data. *
|
||||
* *
|
||||
* The software implementations can be changed to CRC-16 or CRC-CCITT however *
|
||||
* the custom instruction must be modified as well to support the same *
|
||||
* standard. Simply use the values defined in crc.h to change the standard *
|
||||
* used (using the same values in the hardware parameterization) or define *
|
||||
* your own standard. *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
#include "stdio.h"
|
||||
#include "crc.h"
|
||||
#include "ci_crc.h"
|
||||
#include "sys/alt_timestamp.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
|
||||
/* Modify these values to adjust the test being performed */
|
||||
#define NUMBER_OF_BUFFERS 32
|
||||
#define BUFFER_SIZE 256 /* in bytes */
|
||||
|
||||
/* Change the name of memory device according to what you are using
|
||||
* e.g.: DDR_SDRAM_0 ##_SPAN
|
||||
* SSRAM_0 ##_SPAN
|
||||
*/
|
||||
#define MEMORY_DEVICE_SIZE 32768
|
||||
|
||||
|
||||
/* Make sure there is room left for Nios II text, rodata, rwdata, stack,
|
||||
* and heap. This software and the buffer space must fit within the
|
||||
* size of memory device. A total of 1.5 MBytes is reserved. If BUFFER_SIZE
|
||||
* is a multiple of four then exactly 256kB will be left, otherwise is
|
||||
* amount will be less since the column dimension needs some padding to
|
||||
* stay 32 bit aligned
|
||||
*/
|
||||
#if ((BUFFER_SIZE * NUMBER_OF_BUFFERS) >= MEMORY_DEVICE_SIZE - 10000)
|
||||
#error Your buffer space has exceeded the maximum allowable space. Please\
|
||||
reduce the buffer space so that there is enough room to hold Nios II\
|
||||
code.
|
||||
#endif
|
||||
|
||||
|
||||
/* This will line up the data onto a 32 bit (or greater) boundary. A 2d array
|
||||
* is being used here for simplicity. The first dimension represents a byte
|
||||
* of data and the second dimension represents an individual buffer
|
||||
*/
|
||||
#if ((BUFFER_SIZE & 0x3) == 0)
|
||||
unsigned char data_buffer_region[NUMBER_OF_BUFFERS][BUFFER_SIZE] __attribute__ ((aligned(4)));
|
||||
#else /* need to allocate extra bytes so that all buffers start on a 32 bit
|
||||
boundaries by rounding up the column dimension to the next power of 4
|
||||
*/
|
||||
unsigned char data_buffer_region[NUMBER_OF_BUFFERS][BUFFER_SIZE + 4 - (BUFFER_SIZE&0x3)] __attribute__ ((aligned(4)));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned long buffer_counter, data_counter;
|
||||
unsigned long sw_slow_results[NUMBER_OF_BUFFERS];
|
||||
unsigned long sw_fast_results[NUMBER_OF_BUFFERS];
|
||||
unsigned long ci_results[NUMBER_OF_BUFFERS];
|
||||
unsigned char random_data = 0x5A;
|
||||
//unsigned long sw_slow_timeA, sw_slow_timeB;
|
||||
// unsigned long sw_fast_timeA, sw_fast_timeB;
|
||||
// unsigned long ci_timeA, ci_timeB;
|
||||
|
||||
alt_u32 sw_slow_timeA, sw_slow_timeB;
|
||||
alt_u32 sw_fast_timeA, sw_fast_timeB;
|
||||
alt_u32 ci_timeA, ci_timeB;
|
||||
|
||||
|
||||
printf("+-----------------------------------------------------------+\n");
|
||||
printf("| Comparison between software and custom instruction CRC32 |\n");
|
||||
printf("+-----------------------------------------------------------+\n\n\n");
|
||||
|
||||
printf("System specification\n");
|
||||
printf("--------------------\n");
|
||||
|
||||
printf("System clock speed = %lu MHz\n", (unsigned long)ALT_CPU_FREQ /(unsigned long)1000000);
|
||||
printf("Number of buffer locations = %d\n", NUMBER_OF_BUFFERS);
|
||||
printf("Size of each buffer = %d bytes\n\n\n", BUFFER_SIZE);
|
||||
|
||||
|
||||
/* Initializing the data buffers */
|
||||
printf("Initializing all of the buffers with pseudo-random data\n");
|
||||
printf("-------------------------------------------------------\n");
|
||||
for(buffer_counter = 0; buffer_counter < NUMBER_OF_BUFFERS; buffer_counter++)
|
||||
{
|
||||
for(data_counter = 0; data_counter < BUFFER_SIZE; data_counter++)
|
||||
{
|
||||
data_buffer_region[buffer_counter][data_counter] = random_data;
|
||||
random_data = (random_data >> 4) + (random_data << 4) + (data_counter & 0xFF);
|
||||
}
|
||||
}
|
||||
printf("Initialization completed\n\n\n");
|
||||
|
||||
|
||||
if(alt_timestamp_start() < 0) // starts the timestamp timer
|
||||
{
|
||||
printf("Please add the high resolution timer to the timestamp timer setting in the syslib properties page.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* Slow software CRC based on a modulo 2 division implementation */
|
||||
printf("Running the software CRC\n");
|
||||
printf("------------------------\n");
|
||||
sw_slow_timeA = alt_timestamp();
|
||||
|
||||
for(buffer_counter = 0; buffer_counter < NUMBER_OF_BUFFERS; buffer_counter++)
|
||||
{
|
||||
sw_slow_results[buffer_counter] = crcSlow(data_buffer_region[buffer_counter], BUFFER_SIZE);
|
||||
}
|
||||
sw_slow_timeB = alt_timestamp();
|
||||
|
||||
printf("Completed\n\n\n");
|
||||
|
||||
|
||||
/* Fast software CRC based on a lookup table implementation */
|
||||
crcInit();
|
||||
printf("Running the optimized software CRC\n");
|
||||
printf("----------------------------------\n");
|
||||
sw_fast_timeA = alt_timestamp();
|
||||
for(buffer_counter = 0; buffer_counter < NUMBER_OF_BUFFERS; buffer_counter++)
|
||||
{
|
||||
sw_fast_results[buffer_counter] = crcFast(data_buffer_region[buffer_counter], BUFFER_SIZE);
|
||||
}
|
||||
sw_fast_timeB = alt_timestamp();
|
||||
printf("Completed\n\n\n");
|
||||
|
||||
|
||||
/* Custom instruction CRC */
|
||||
printf("Running the custom instruction CRC\n");
|
||||
printf("----------------------------------\n");
|
||||
ci_timeA = alt_timestamp();
|
||||
for(buffer_counter = 0; buffer_counter < NUMBER_OF_BUFFERS; buffer_counter++)
|
||||
{
|
||||
ci_results[buffer_counter] = crcCI(data_buffer_region[buffer_counter], BUFFER_SIZE);
|
||||
}
|
||||
ci_timeB = alt_timestamp();
|
||||
printf("Completed\n\n\n");
|
||||
|
||||
/* Validation of results */
|
||||
printf("Validating the CRC results from all implementations\n");
|
||||
printf("----------------------------------------------------\n");
|
||||
for(buffer_counter = 0; buffer_counter < NUMBER_OF_BUFFERS; buffer_counter++)
|
||||
{
|
||||
/* Test every combination of results to make sure they are consistant */
|
||||
if((sw_slow_results[buffer_counter] != ci_results[buffer_counter]) |
|
||||
(sw_fast_results[buffer_counter] != ci_results[buffer_counter]))
|
||||
{
|
||||
printf("FAILURE! Software CRC = 0x%lx, Optimized Software CRC = 0x%lx, Custom Instruction CRC = 0x%lx,\n",
|
||||
sw_slow_results[buffer_counter], sw_fast_results[buffer_counter], ci_results[buffer_counter]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
printf("All CRC implementations produced the same results\n\n\n");
|
||||
|
||||
|
||||
// Report processing times
|
||||
printf("Processing time for each implementation\n");
|
||||
printf("---------------------------------------\n");
|
||||
printf("Software CRC = %.2lu ms\n", 1000*((unsigned long)(sw_slow_timeB-sw_slow_timeA))/((unsigned long)alt_timestamp_freq()));
|
||||
printf("Optimized software CRC = %.2lu ms\n", 1000*((unsigned long)(sw_fast_timeB-sw_fast_timeA))/((unsigned long)alt_timestamp_freq()));
|
||||
printf("Custom instruction CRC = %.2lu ms\n\n\n", 1000*((unsigned long)(ci_timeB-ci_timeA))/((unsigned long)alt_timestamp_freq()));
|
||||
|
||||
printf("Processing throughput for each implementation\n"); // throughput = total bits / (time(s) * 1000000)
|
||||
printf("---------------------------------------------\n");
|
||||
printf("Software CRC = %.2lu Mbps\n", (8 * NUMBER_OF_BUFFERS * BUFFER_SIZE)/(1000000*(unsigned long)(sw_slow_timeB-sw_slow_timeA)/((unsigned long)alt_timestamp_freq())));
|
||||
printf("Optimized software CRC = %.2lu Mbps\n", (8 * NUMBER_OF_BUFFERS * BUFFER_SIZE)/(1000000*(unsigned long)(sw_fast_timeB-sw_fast_timeA)/((unsigned long)alt_timestamp_freq())));
|
||||
printf("Custom instruction CRC = %.2lu Mbps\n\n\n", (8 * NUMBER_OF_BUFFERS * BUFFER_SIZE)/(1000000*(unsigned long)(ci_timeB-ci_timeA)/((unsigned long)alt_timestamp_freq())));
|
||||
|
||||
printf("Speedup ratio\n");
|
||||
printf("-------------\n");
|
||||
printf("Custom instruction CRC vs software CRC = %lu\n", ((unsigned long)(sw_slow_timeB-sw_slow_timeA))/((unsigned long)(ci_timeB-ci_timeA)));
|
||||
printf("Custom instruction CRC vs optimized software CRC = %lu\n", ((unsigned long)(sw_fast_timeB-sw_fast_timeA))/((unsigned long)(ci_timeB-ci_timeA)));
|
||||
printf("Optimized software CRC vs software CRC= %lu\n", ((unsigned long)(sw_slow_timeB-sw_slow_timeA))/((unsigned long)(sw_fast_timeB-sw_fast_timeA)));
|
||||
return 0;
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Filename: crc.h
|
||||
*
|
||||
* Description: A header file describing the various CRC standards.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2000 by Michael Barr. This software is placed into
|
||||
* the public domain and may be used for any purpose. However, this
|
||||
* notice must not be changed or removed and no warranty is either
|
||||
* expressed or implied by its publication or distribution.
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef _crc_h
|
||||
#define _crc_h
|
||||
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE !FALSE
|
||||
|
||||
/*
|
||||
* Select the CRC standard from the list that follows.
|
||||
*/
|
||||
#define CRC32
|
||||
|
||||
|
||||
#if defined(CRC_CCITT)
|
||||
|
||||
typedef unsigned short crc;
|
||||
|
||||
#define CRC_NAME "CRC-CCITT"
|
||||
#define POLYNOMIAL 0x1021
|
||||
#define INITIAL_REMAINDER 0xFFFF
|
||||
#define FINAL_XOR_VALUE 0x0000
|
||||
#define REFLECT_DATA FALSE
|
||||
#define REFLECT_REMAINDER FALSE
|
||||
#define CHECK_VALUE 0x29B1
|
||||
|
||||
#elif defined(CRC16)
|
||||
|
||||
typedef unsigned short crc;
|
||||
|
||||
#define CRC_NAME "CRC-16"
|
||||
#define POLYNOMIAL 0x8005
|
||||
#define INITIAL_REMAINDER 0x0000
|
||||
#define FINAL_XOR_VALUE 0x0000
|
||||
#define REFLECT_DATA TRUE
|
||||
#define REFLECT_REMAINDER TRUE
|
||||
#define CHECK_VALUE 0xBB3D
|
||||
|
||||
#elif defined(CRC32)
|
||||
|
||||
typedef unsigned long crc;
|
||||
|
||||
#define CRC_NAME "CRC-32"
|
||||
#define POLYNOMIAL 0x04C11DB7
|
||||
#define INITIAL_REMAINDER 0xFFFFFFFF
|
||||
#define FINAL_XOR_VALUE 0xFFFFFFFF
|
||||
#define REFLECT_DATA TRUE
|
||||
#define REFLECT_REMAINDER TRUE
|
||||
#define CHECK_VALUE 0xCBF43926
|
||||
|
||||
#else
|
||||
|
||||
#error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void crcInit(void);
|
||||
crc crcSlow(unsigned char const message[], int nBytes);
|
||||
crc crcFast(unsigned char const message[], int nBytes);
|
||||
|
||||
|
||||
#endif /* _crc_h */
|
|
@ -1,97 +0,0 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Filename: ci_crc.c
|
||||
*
|
||||
* Description: Custom instruction implementations of the CRC.
|
||||
*
|
||||
* Notes: A macro is defined that is used to access the CRC custom
|
||||
* instruction.
|
||||
*********************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*The n values and their corresponding operation are as follow:
|
||||
* n = 0, Initialize the custom instruction to the initial remainder value
|
||||
* n = 1, Write 8 bits data to custom instruction
|
||||
* n = 2, Write 16 bits data to custom instruction
|
||||
* n = 3, Write 32 bits data to custom instruction
|
||||
* n = 4, Read 32 bits data from the custom instruction
|
||||
* n = 5, Read 64 bits data from the custom instruction
|
||||
* n = 6, Read 96 bits data from the custom instruction
|
||||
* n = 7, Read 128 bits data from the custom instruction*/
|
||||
#define CRC_CI_MACRO(n, A) __builtin_custom_ini(ALT_CI_NIOS2_HW_CRC32_0_N + (n & 0x7), (A))
|
||||
|
||||
unsigned long crcCI(unsigned char * input_data, unsigned long input_data_length, int do_initialize)
|
||||
{
|
||||
unsigned long index;
|
||||
/* copy of the data buffer pointer so that it can advance by different widths */
|
||||
void * input_data_copy = (void *)input_data;
|
||||
|
||||
/* The custom instruction CRC will initialize to the inital remainder value */
|
||||
if (do_initialize)
|
||||
CRC_CI_MACRO(0,0);
|
||||
|
||||
/* Write 32 bit data to the custom instruction. If the buffer does not end
|
||||
* on a 32 bit boundary then the remaining data will be sent to the custom
|
||||
* instruction in the 'if' statement below.
|
||||
*/
|
||||
for(index = 0; index < (input_data_length & 0xFFFFFFFC); index+=4)
|
||||
{
|
||||
CRC_CI_MACRO(3, *(unsigned long *)input_data_copy);
|
||||
input_data_copy += 4; /* void pointer, must move by 4 for each word */
|
||||
}
|
||||
|
||||
/* Write the remainder of the buffer if it does not end on a word boundary */
|
||||
if((input_data_length & 0x3) == 0x3) /* 3 bytes left */
|
||||
{
|
||||
CRC_CI_MACRO(2, *(unsigned short *)input_data_copy);
|
||||
input_data_copy += 2;
|
||||
CRC_CI_MACRO(1, *(unsigned char *)input_data_copy);
|
||||
}
|
||||
else if((input_data_length & 0x3) == 0x2) /* 2 bytes left */
|
||||
{
|
||||
CRC_CI_MACRO(2, *(unsigned short *)input_data_copy);
|
||||
}
|
||||
else if((input_data_length & 0x3) == 0x1) /* 1 byte left */
|
||||
{
|
||||
CRC_CI_MACRO(1, *(unsigned char *)input_data_copy);
|
||||
}
|
||||
|
||||
/* There are 4 registers in the CRC custom instruction. Since
|
||||
* this example uses CRC-32 only the first register must be read
|
||||
* in order to receive the full result.
|
||||
*/
|
||||
return CRC_CI_MACRO(4, 0);
|
||||
}
|
|
@ -1,265 +0,0 @@
|
|||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* Altera does not recommend, suggest or require that this reference design *
|
||||
* file be used in conjunction or combination with any other product. *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* Filename: crc.c
|
||||
*
|
||||
* Description: Slow and fast implementations of the CRC standards.
|
||||
*
|
||||
* Notes: The parameters for each supported CRC standard are
|
||||
* defined in the header file crc.h. The implementations
|
||||
* here should stand up to further additions to that list.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2000 by Michael Barr. This software is placed into
|
||||
* the public domain and may be used for any purpose. However, this
|
||||
* notice must not be changed or removed and no warranty is either
|
||||
* expressed or implied by its publication or distribution.
|
||||
**********************************************************************/
|
||||
|
||||
#include "crc.h"
|
||||
|
||||
|
||||
/*
|
||||
* Derive parameters from the standard-specific parameters in crc.h.
|
||||
*/
|
||||
#define WIDTH (8 * sizeof(crc))
|
||||
#define TOPBIT (1 << (WIDTH - 1))
|
||||
|
||||
#if (REFLECT_DATA == TRUE)
|
||||
#undef REFLECT_DATA
|
||||
#define REFLECT_DATA(X) ((unsigned char) reflect((X), 8))
|
||||
#else
|
||||
#undef REFLECT_DATA
|
||||
#define REFLECT_DATA(X) (X)
|
||||
#endif
|
||||
|
||||
#if (REFLECT_REMAINDER == TRUE)
|
||||
#undef REFLECT_REMAINDER
|
||||
#define REFLECT_REMAINDER(X) ((crc) reflect((X), WIDTH))
|
||||
#else
|
||||
#undef REFLECT_REMAINDER
|
||||
#define REFLECT_REMAINDER(X) (X)
|
||||
#endif
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Function: reflect()
|
||||
*
|
||||
* Description: Reorder the bits of a binary sequence, by reflecting
|
||||
* them about the middle position.
|
||||
*
|
||||
* Notes: No checking is done that nBits <= 32.
|
||||
*
|
||||
* Returns: The reflection of the original data.
|
||||
*
|
||||
*********************************************************************/
|
||||
static unsigned long
|
||||
reflect(unsigned long data, unsigned char nBits)
|
||||
{
|
||||
unsigned long reflection = 0x00000000;
|
||||
unsigned char bit;
|
||||
|
||||
/*
|
||||
* Reflect the data about the center bit.
|
||||
*/
|
||||
for (bit = 0; bit < nBits; ++bit)
|
||||
{
|
||||
/*
|
||||
* If the LSB bit is set, set the reflection of it.
|
||||
*/
|
||||
if (data & 0x01)
|
||||
{
|
||||
reflection |= (1 << ((nBits - 1) - bit));
|
||||
}
|
||||
|
||||
data = (data >> 1);
|
||||
}
|
||||
|
||||
return (reflection);
|
||||
|
||||
} /* reflect() */
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Function: crcSlow()
|
||||
*
|
||||
* Description: Compute the CRC of a given message.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* Returns: The CRC of the message.
|
||||
*
|
||||
*********************************************************************/
|
||||
crc
|
||||
crcSlow(unsigned char const message[], int nBytes)
|
||||
{
|
||||
crc remainder = INITIAL_REMAINDER;
|
||||
int byte;
|
||||
unsigned char bit;
|
||||
|
||||
|
||||
/*
|
||||
* Perform modulo-2 division, a byte at a time.
|
||||
*/
|
||||
for (byte = 0; byte < nBytes; ++byte)
|
||||
{
|
||||
/*
|
||||
* Bring the next byte into the remainder.
|
||||
*/
|
||||
remainder ^= (REFLECT_DATA(message[byte]) << (WIDTH - 8));
|
||||
|
||||
/*
|
||||
* Perform modulo-2 division, a bit at a time.
|
||||
*/
|
||||
for (bit = 8; bit > 0; --bit)
|
||||
{
|
||||
/*
|
||||
* Try to divide the current data bit.
|
||||
*/
|
||||
if (remainder & TOPBIT)
|
||||
{
|
||||
remainder = (remainder << 1) ^ POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
remainder = (remainder << 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The final remainder is the CRC result.
|
||||
*/
|
||||
return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);
|
||||
|
||||
} /* crcSlow() */
|
||||
|
||||
|
||||
crc crcTable[256];
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Function: crcInit()
|
||||
*
|
||||
* Description: Populate the partial CRC lookup table.
|
||||
*
|
||||
* Notes: This function must be rerun any time the CRC standard
|
||||
* is changed. If desired, it can be run "offline" and
|
||||
* the table results stored in an embedded system's ROM.
|
||||
*
|
||||
* Returns: None defined.
|
||||
*
|
||||
*********************************************************************/
|
||||
void
|
||||
crcInit(void)
|
||||
{
|
||||
crc remainder;
|
||||
int dividend;
|
||||
unsigned char bit;
|
||||
|
||||
|
||||
/*
|
||||
* Compute the remainder of each possible dividend.
|
||||
*/
|
||||
for (dividend = 0; dividend < 256; ++dividend)
|
||||
{
|
||||
/*
|
||||
* Start with the dividend followed by zeros.
|
||||
*/
|
||||
remainder = dividend << (WIDTH - 8);
|
||||
|
||||
/*
|
||||
* Perform modulo-2 division, a bit at a time.
|
||||
*/
|
||||
for (bit = 8; bit > 0; --bit)
|
||||
{
|
||||
/*
|
||||
* Try to divide the current data bit.
|
||||
*/
|
||||
if (remainder & TOPBIT)
|
||||
{
|
||||
remainder = (remainder << 1) ^ POLYNOMIAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
remainder = (remainder << 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the result into the table.
|
||||
*/
|
||||
crcTable[dividend] = remainder;
|
||||
}
|
||||
|
||||
} /* crcInit() */
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* Function: crcFast()
|
||||
*
|
||||
* Description: Compute the CRC of a given message.
|
||||
*
|
||||
* Notes: crcInit() must be called first.
|
||||
*
|
||||
* Returns: The CRC of the message.
|
||||
*
|
||||
*********************************************************************/
|
||||
crc
|
||||
crcFast(unsigned char const message[], int nBytes)
|
||||
{
|
||||
crc remainder = INITIAL_REMAINDER;
|
||||
unsigned char data;
|
||||
int byte;
|
||||
|
||||
|
||||
/*
|
||||
* Divide the message by the polynomial, a byte at a time.
|
||||
*/
|
||||
for (byte = 0; byte < nBytes; ++byte)
|
||||
{
|
||||
data = REFLECT_DATA(message[byte]) ^ (remainder >> (WIDTH - 8));
|
||||
remainder = crcTable[data] ^ (remainder << 8);
|
||||
}
|
||||
|
||||
/*
|
||||
* The final remainder is the CRC.
|
||||
*/
|
||||
return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE);
|
||||
|
||||
} /* crcFast() */
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
Legal Notice: (C)2006 Altera Corporation. All rights reserved. Your
|
||||
use of Altera Corporation's design tools, logic functions and other
|
||||
software and tools, and its AMPP partner logic functions, and any
|
||||
output files any of the foregoing (including device programming or
|
||||
simulation files), and any associated documentation or information are
|
||||
expressly subject to the terms and conditions of the Altera Program
|
||||
License Subscription Agreement or other applicable license agreement,
|
||||
including, without limitation, that your use is for the sole purpose
|
||||
of programming logic devices manufactured by Altera and sold by Altera
|
||||
or its authorized distributors. Please refer to the applicable
|
||||
agreement for further details.
|
||||
*/
|
||||
|
||||
/*
|
||||
This thin wrapper re-uses the CRC Avalon component as a Nios II
|
||||
custom instruction. The n port of custom instruction is used as
|
||||
control to the CRC Avalon component. Below are the values of n and
|
||||
the corresponding operations perform by the custom instruction:
|
||||
n = 0, Initialize the custom instruction to the initial remainder value
|
||||
n = 1, Write 8 bits data to custom instruction
|
||||
n = 2, Write 16 bits data to custom instruction
|
||||
n = 3, Write 32 bits data to custom instruction
|
||||
n = 4, Read 32 bits data from the custom instruction
|
||||
n = 5, Read 64 bits data from the custom instruction
|
||||
n = 6, Read 96 bits data from the custom instruction
|
||||
n = 7, Read 128 bits data from the custom instruction
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module CRC_Custom_Instruction(clk,
|
||||
reset,
|
||||
dataa,
|
||||
n,
|
||||
clk_en,
|
||||
start,
|
||||
done,
|
||||
result);
|
||||
/*
|
||||
See the Avalon CRC component for details on the meaning of each
|
||||
parameter listed below.
|
||||
*/
|
||||
parameter crc_width = 32;
|
||||
parameter polynomial_inital = 32'hFFFFFFFF;
|
||||
parameter polynomial = 32'h04C11DB7;
|
||||
parameter reflected_input = 1;
|
||||
parameter reflected_output = 1;
|
||||
parameter xor_output = 32'hFFFFFFFF;
|
||||
|
||||
input clk;
|
||||
input reset;
|
||||
input [31:0] dataa;
|
||||
input [2:0] n;
|
||||
input clk_en;
|
||||
input start;
|
||||
output done;
|
||||
output [31:0] result;
|
||||
|
||||
wire [2:0] address;
|
||||
wire [3:0] byteenable;
|
||||
wire write;
|
||||
wire read;
|
||||
reg done_delay;
|
||||
|
||||
assign write = (n<4);
|
||||
assign read = (n>3);
|
||||
assign byteenable = (n==1)?4'b0001 : (n==2)?4'b0011 : (n==3)?4'b1111 : 4'b0000;
|
||||
assign address = (n==0)?3'b000 : ((n==1)|(n==2)|(n==3))?3'b001 : (n==4)?3'b100 : (n==5)?3'b101 : (n==6)?3'b110 : 3'b111;
|
||||
assign done = (n>3)? done_delay : start;
|
||||
|
||||
always @ (posedge clk or posedge reset)
|
||||
begin
|
||||
if (reset)
|
||||
done_delay <= 0;
|
||||
else
|
||||
done_delay <= start;
|
||||
end
|
||||
|
||||
/*
|
||||
Instantiating the Avalon CRC component and wiring it to be
|
||||
custom instruction compilant
|
||||
*/
|
||||
CRC_Component wrapper_wiring(.clk(clk),
|
||||
.reset(reset),
|
||||
.address(address),
|
||||
.writedata(dataa),
|
||||
.byteenable(byteenable),
|
||||
.write(write & start),
|
||||
.read(read),
|
||||
.chipselect(clk_en),
|
||||
.readdata(result));
|
||||
|
||||
defparam wrapper_wiring.crc_width = crc_width;
|
||||
defparam wrapper_wiring.polynomial_inital = polynomial_inital;
|
||||
defparam wrapper_wiring.polynomial = polynomial;
|
||||
defparam wrapper_wiring.reflected_input = reflected_input;
|
||||
defparam wrapper_wiring.reflected_output = reflected_output;
|
||||
defparam wrapper_wiring.xor_output = xor_output;
|
||||
|
||||
endmodule
|
|
@ -1,116 +0,0 @@
|
|||
# TCL File Generated by Component Editor 15.1
|
||||
# Tue Dec 22 18:46:40 EET 2015
|
||||
# DO NOT MODIFY
|
||||
|
||||
|
||||
#
|
||||
# nios2_hw_crc32 "nios2_hw_crc32" v1.0
|
||||
# 2015.12.22.18:46:40
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# request TCL package from ACDS 15.1
|
||||
#
|
||||
package require -exact qsys 15.1
|
||||
|
||||
|
||||
#
|
||||
# module nios2_hw_crc32
|
||||
#
|
||||
set_module_property DESCRIPTION ""
|
||||
set_module_property NAME nios2_hw_crc32
|
||||
set_module_property VERSION 1.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Custom Instruction Modules"
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME nios2_hw_crc32
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL CRC_Custom_Instruction
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file CRC_Component.v VERILOG PATH hdl/CRC_Component.v
|
||||
add_fileset_file CRC_Custom_Instruction.v VERILOG PATH hdl/CRC_Custom_Instruction.v TOP_LEVEL_FILE
|
||||
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
add_parameter crc_width INTEGER 32
|
||||
set_parameter_property crc_width DEFAULT_VALUE 32
|
||||
set_parameter_property crc_width DISPLAY_NAME crc_width
|
||||
set_parameter_property crc_width TYPE INTEGER
|
||||
set_parameter_property crc_width UNITS None
|
||||
set_parameter_property crc_width HDL_PARAMETER true
|
||||
add_parameter polynomial_inital STD_LOGIC_VECTOR 4294967295
|
||||
set_parameter_property polynomial_inital DEFAULT_VALUE 4294967295
|
||||
set_parameter_property polynomial_inital DISPLAY_NAME polynomial_inital
|
||||
set_parameter_property polynomial_inital TYPE STD_LOGIC_VECTOR
|
||||
set_parameter_property polynomial_inital UNITS None
|
||||
set_parameter_property polynomial_inital ALLOWED_RANGES 0:17179869183
|
||||
set_parameter_property polynomial_inital HDL_PARAMETER true
|
||||
add_parameter polynomial STD_LOGIC_VECTOR 79764919
|
||||
set_parameter_property polynomial DEFAULT_VALUE 79764919
|
||||
set_parameter_property polynomial DISPLAY_NAME polynomial
|
||||
set_parameter_property polynomial TYPE STD_LOGIC_VECTOR
|
||||
set_parameter_property polynomial UNITS None
|
||||
set_parameter_property polynomial ALLOWED_RANGES 0:17179869183
|
||||
set_parameter_property polynomial HDL_PARAMETER true
|
||||
add_parameter reflected_input INTEGER 1
|
||||
set_parameter_property reflected_input DEFAULT_VALUE 1
|
||||
set_parameter_property reflected_input DISPLAY_NAME reflected_input
|
||||
set_parameter_property reflected_input TYPE INTEGER
|
||||
set_parameter_property reflected_input UNITS None
|
||||
set_parameter_property reflected_input HDL_PARAMETER true
|
||||
add_parameter reflected_output INTEGER 1
|
||||
set_parameter_property reflected_output DEFAULT_VALUE 1
|
||||
set_parameter_property reflected_output DISPLAY_NAME reflected_output
|
||||
set_parameter_property reflected_output TYPE INTEGER
|
||||
set_parameter_property reflected_output UNITS None
|
||||
set_parameter_property reflected_output HDL_PARAMETER true
|
||||
add_parameter xor_output STD_LOGIC_VECTOR 4294967295
|
||||
set_parameter_property xor_output DEFAULT_VALUE 4294967295
|
||||
set_parameter_property xor_output DISPLAY_NAME xor_output
|
||||
set_parameter_property xor_output TYPE STD_LOGIC_VECTOR
|
||||
set_parameter_property xor_output UNITS None
|
||||
set_parameter_property xor_output ALLOWED_RANGES 0:17179869183
|
||||
set_parameter_property xor_output HDL_PARAMETER true
|
||||
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point nios_custom_instruction_slave
|
||||
#
|
||||
add_interface nios_custom_instruction_slave nios_custom_instruction end
|
||||
set_interface_property nios_custom_instruction_slave clockCycle 0
|
||||
set_interface_property nios_custom_instruction_slave operands 1
|
||||
set_interface_property nios_custom_instruction_slave ENABLED true
|
||||
set_interface_property nios_custom_instruction_slave EXPORT_OF ""
|
||||
set_interface_property nios_custom_instruction_slave PORT_NAME_MAP ""
|
||||
set_interface_property nios_custom_instruction_slave CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property nios_custom_instruction_slave SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port nios_custom_instruction_slave clk clk Input 1
|
||||
add_interface_port nios_custom_instruction_slave clk_en clk_en Input 1
|
||||
add_interface_port nios_custom_instruction_slave dataa dataa Input 32
|
||||
add_interface_port nios_custom_instruction_slave done done Output 1
|
||||
add_interface_port nios_custom_instruction_slave n n Input 3
|
||||
add_interface_port nios_custom_instruction_slave reset reset Input 1
|
||||
add_interface_port nios_custom_instruction_slave result result Output 32
|
||||
add_interface_port nios_custom_instruction_slave start start Input 1
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
# (C) 2001-2015 Altera Corporation. All rights reserved.
|
||||
# Your use of Altera Corporation's design tools, logic functions and other
|
||||
# software and tools, and its AMPP partner logic functions, and any output
|
||||
# files any of the foregoing (including device programming or simulation
|
||||
# files), and any associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License Subscription
|
||||
# Agreement, Altera MegaCore Function License Agreement, or other applicable
|
||||
# license agreement, including, without limitation, that your use is for the
|
||||
# sole purpose of programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the applicable
|
||||
# agreement for further details.
|
||||
|
||||
|
||||
# TCL File Generated by Altera University Program
|
||||
# DO NOT MODIFY
|
||||
|
||||
set aup_version 15.1
|
||||
|
||||
# Create a new driver - this name must be different than the
|
||||
# hardware component name
|
||||
create_driver nios2_hw_crc32_driver
|
||||
|
||||
# Associate it with some hardware
|
||||
set_sw_property hw_class_name nios2_hw_crc32
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version $aup_version
|
||||
|
||||
# This driver is proclaimed to be compatible with 'component'
|
||||
# as old as version "1.0". The component hardware version is set in the
|
||||
# _hw.tcl file - If the hardware component version number is not equal
|
||||
# or greater than the min_compatable_hw_version number, the driver
|
||||
# source files will not be copied over to the BSP driver directory
|
||||
set_sw_property min_compatible_hw_version 1.0
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize false
|
||||
|
||||
# Location in generated BSP that sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
#
|
||||
# Source file listings...
|
||||
#
|
||||
|
||||
# C/C++ source files
|
||||
add_sw_property c_source HAL/src/ci_crc.c
|
||||
add_sw_property c_source HAL/src/crc.c
|
||||
|
||||
# Include files
|
||||
add_sw_property include_source HAL/inc/ci_crc.h
|
||||
add_sw_property include_source HAL/inc/crc.h
|
||||
|
||||
# This driver supports HAL type
|
||||
add_sw_property supported_bsp_type HAL
|
||||
|
||||
# End of file
|
||||
|
BIN
ip/osd_generator/bin/ASCII_KANA_8x8.bin
Normal file
BIN
ip/osd_generator/bin/ASCII_KANA_8x8.bin
Normal file
Binary file not shown.
BIN
ip/osd_generator/bin/IBM_VGA_8x8.bin
Normal file
BIN
ip/osd_generator/bin/IBM_VGA_8x8.bin
Normal file
Binary file not shown.
257
ip/osd_generator/bin/char_rom.hex
Normal file
257
ip/osd_generator/bin/char_rom.hex
Normal file
|
@ -0,0 +1,257 @@
|
|||
:080000000000000000000000F8
|
||||
:080001007E8199BD81A5817E7D
|
||||
:080002007EFFE7C3FFDBFF7E78
|
||||
:080003000010387CFEFEFE6CCB
|
||||
:080004000010387CFE7C38106E
|
||||
:080005007C387CFEFE387C38DB
|
||||
:080006007C387CFE7C381010F0
|
||||
:080007000000183C3C18000049
|
||||
:08000800FFFFE7C3C3E7FFFFA0
|
||||
:08000900003C664242663C0027
|
||||
:08000A00FFC399BDBD99C3FFBE
|
||||
:08000B0078CCCCCC7D0F070F6F
|
||||
:08000C00187E183C6666663C94
|
||||
:08000D00E0F07030303F333F9A
|
||||
:08000E00C0E66763637F637FB6
|
||||
:08000F00995A3CE7E73C5A99BD
|
||||
:080010000080E0F8FEF8E0803A
|
||||
:0800110000020E3EFE3E0E024D
|
||||
:08001200183C7E18187E3C1812
|
||||
:08001300006600666666666681
|
||||
:08001400001B1B1B7BDBDB7FE3
|
||||
:0800150078CC386C6C38633EB6
|
||||
:08001600007E7E7E0000000068
|
||||
:08001700FF183C7E187E3C1826
|
||||
:0800180000181818187E3C18AE
|
||||
:0800190000183C7E18181818AD
|
||||
:08001A000000180CFE0C180098
|
||||
:08001B0000003060FE603000BF
|
||||
:08001C000000FEC0C0C000009E
|
||||
:08001D0000002466FF662400C8
|
||||
:08001E000000FFFF7E3C18000A
|
||||
:08001F000000183C7EFFFF0009
|
||||
:080020000000000000000000D8
|
||||
:08002100003000303078783027
|
||||
:0800220000000000006C6C6C92
|
||||
:08002300006C6CFE6CFE6C6CBD
|
||||
:080024000030F80C78C07C30BC
|
||||
:0800250000C6663018CCC600CD
|
||||
:080026000076CCDC76386C3862
|
||||
:080027000000000000C0606051
|
||||
:08002800001830606060301820
|
||||
:08002900006030181818306067
|
||||
:08002A000000663CFF3C66008B
|
||||
:08002B0000003030FC30300011
|
||||
:08002C0060303000000000000C
|
||||
:08002D0000000000FC000000CF
|
||||
:08002E0000303000000000006A
|
||||
:08002F000080C06030180C06CF
|
||||
:08003000007CE6F6DECEC67C82
|
||||
:0800310000FC3030303070306B
|
||||
:0800320000FCCC60380CCC7816
|
||||
:080033000078CC0C380CCC78ED
|
||||
:08003400001E0CFECC6C3C1C0C
|
||||
:080035000078CC0C0CF8C0FCB3
|
||||
:080036000078CCCCF8C0603862
|
||||
:0800370000303030180CCCFC45
|
||||
:080038000078CCCC78CCCC7828
|
||||
:080039000070180C7CCCCC789F
|
||||
:08003A000030300000303000FE
|
||||
:08003B0060303000003030009D
|
||||
:08003C0000183060C0603018AC
|
||||
:08003D000000FC0000FC0000C3
|
||||
:08003E00006030180C1830605E
|
||||
:08003F0000300030180CCC78F1
|
||||
:080040000078C0DEDEDEC67CA4
|
||||
:0800410000CCCCFCCCCC7830E3
|
||||
:0800420000FC66667C6666FCAA
|
||||
:08004300003C66C0C0C0663C31
|
||||
:0800440000F86C6666666CF8BA
|
||||
:0800450000FE6268786862FEAB
|
||||
:0800460000F06068786862FEBA
|
||||
:08004700003E66CEC0C0663C1D
|
||||
:0800480000CCCCCCFCCCCCCCEC
|
||||
:080049000078303030303078CF
|
||||
:08004A000078CCCC0C0C0C1E5C
|
||||
:08004B0000E6666C786C66E6C5
|
||||
:08004C0000FE6662606060F0D6
|
||||
:08004D0000C6C6D6FEFEEEC699
|
||||
:08004E0000C6C6CEDEF6E6C6D0
|
||||
:08004F0000386CC6C6C66C380F
|
||||
:0800500000F060607C6666FCB4
|
||||
:08005100001C78DCCCCCCC785B
|
||||
:0800520000E6666C7C6666FCAA
|
||||
:080053000078CC1C70E0CC78B1
|
||||
:08005400007830303030B4FCBC
|
||||
:0800550000FCCCCCCCCCCCCCDF
|
||||
:08005600003078CCCCCCCCCCFE
|
||||
:0800570000C6EEFED6C6C6C6C7
|
||||
:0800580000C66C38386CC6C606
|
||||
:080059000078303078CCCCCCEB
|
||||
:08005A0000FE6632188CC6FEA0
|
||||
:08005B000078606060606078CD
|
||||
:08005C000002060C183060C020
|
||||
:08005D00007818181818187833
|
||||
:08005E0000000000C66C381020
|
||||
:08005F00FF000000000000009A
|
||||
:08006000000000000018303020
|
||||
:080061000076CC7C0C78000055
|
||||
:0800620000DC66667C6060E0D2
|
||||
:080063000078CCC0CC7800004D
|
||||
:080064000076CCCC7C0C0C1CD6
|
||||
:080065000078C0FCCC7800001B
|
||||
:0800660000F06060F0606C38EE
|
||||
:08006700F80C7CCCCC76000003
|
||||
:0800680000E66666766C60E0BC
|
||||
:080069000078303030700030E7
|
||||
:08006A0078CCCC0C0C0C000C4E
|
||||
:08006B0000E66C786C6660E0B1
|
||||
:08006C000078303030303070B4
|
||||
:08006D0000C6D6FEFECC000027
|
||||
:08006E0000CCCCCCCCF8000062
|
||||
:08006F000078CCCCCC78000035
|
||||
:08007000F0607C6666DC000014
|
||||
:080071001E0C7CCCCC760000D3
|
||||
:0800720000F0606676DC00007E
|
||||
:0800730000F80C78C07C0000CD
|
||||
:0800740000183430307C30101C
|
||||
:080075000076CCCCCCCC0000DD
|
||||
:08007600003078CCCCCC000076
|
||||
:08007700006CFEFED6C600007D
|
||||
:0800780000C66C386CC60000E4
|
||||
:08007900F80C7CCCCCCC00009B
|
||||
:08007A0000FC643098FC00005A
|
||||
:08007B00001C3030E030301CA5
|
||||
:08007C000018181800181818EC
|
||||
:08007D0000E030301C3030E0DF
|
||||
:08007E00000000000000DC7628
|
||||
:08007F0000FEC6C66C3810003B
|
||||
:08008000007C38FEFE7C381004
|
||||
:080081000010387CFEFEFE6C4D
|
||||
:08008200007C10D6FEFE3838A8
|
||||
:080083000010387CFE7C3810EF
|
||||
:08008400007884848484780074
|
||||
:080085000078FCFCFCFC780093
|
||||
:08008600003C40A8704CF02082
|
||||
:080087000064B4782078200029
|
||||
:0800880000408484848800001C
|
||||
:080089000030088870007000CF
|
||||
:08008A0000986020F0007000F6
|
||||
:08008B000068A47824F82000AD
|
||||
:08008C00001020A86458900048
|
||||
:08008D0000201894D4B8100003
|
||||
:08008E0000749870101C1000B2
|
||||
:08008F000038040478000000B1
|
||||
:08009000000000000000000068
|
||||
:08009100006492AA7C207C208F
|
||||
:0800920000408082828284009C
|
||||
:08009300003008044438003875
|
||||
:08009400009C602010F80070D0
|
||||
:080095000044A2A27C20FA2421
|
||||
:08009600003088484AF24440A2
|
||||
:0800970000788008FC10FC2039
|
||||
:080098000008102040201008B0
|
||||
:0800990000488484849E840465
|
||||
:08009A00007C800000000478E6
|
||||
:08009B00007880040408FE1047
|
||||
:08009C000070888480808080E0
|
||||
:08009D00001008384838FE0885
|
||||
:08009E00003C404844FE4444CC
|
||||
:08009F00003C404020FE284413
|
||||
:0800A000000000000000000058
|
||||
:0800A100006090600000000007
|
||||
:0800A2000000000020202038BE
|
||||
:0800A30000E020202000000015
|
||||
:0800A400002040800000000074
|
||||
:0800A5000000003030000000F3
|
||||
:0800A6000040201008F808F8E2
|
||||
:0800A7000080406010F0000031
|
||||
:0800A800002020A060201000E0
|
||||
:0800A9000040201090F020003F
|
||||
:0800AA0000F0202020F000000E
|
||||
:0800AB000020A0A060F020007D
|
||||
:0800AC000040405048F84000FC
|
||||
:0800AD0000F8101010700000B3
|
||||
:0800AE0000F010F010F000005A
|
||||
:0800AF0000201008A8A80000C1
|
||||
:0800B000000000007C8000004C
|
||||
:0800B10000402020302808F86F
|
||||
:0800B200002020A060201008CE
|
||||
:0800B300002010088888F820E5
|
||||
:0800B40000F820202020F800D4
|
||||
:0800B500001090503010F8100B
|
||||
:0800B600008848282828F820E2
|
||||
:0800B70000202020F820F820B1
|
||||
:0800B8000020100808884878B8
|
||||
:0800B900002010109050784067
|
||||
:0800BA0000F808080808F8002E
|
||||
:0800BB00002010105050F85015
|
||||
:0800BC0000E01008C808C000B4
|
||||
:0800BD00008850201008F80033
|
||||
:0800BE00003840405048F840B2
|
||||
:0800BF00004020100848888869
|
||||
:0800C000002010088878487840
|
||||
:0800C10000402020F820E010AF
|
||||
:0800C2000020100808A8A8A8FE
|
||||
:0800C3000040202020F800702D
|
||||
:0800C40000404048506040403C
|
||||
:0800C500004020202020F8205B
|
||||
:0800C60000F8000000007000CA
|
||||
:0800C70000885020D008F80069
|
||||
:0800C800002020E83008F820B8
|
||||
:0800C900008040201008080827
|
||||
:0800CA00008848484848102056
|
||||
:0800CB000078808080F880803D
|
||||
:0800CC0000402010080808F8AC
|
||||
:0800CD000000080810A040002B
|
||||
:0800CE000020A8A82020F82062
|
||||
:0800CF00001020500808F800A1
|
||||
:0800D0000008F000006000F0E0
|
||||
:0800D10000F888908040201027
|
||||
:0800D2000080502050080808CE
|
||||
:0800D3000018202020F820781D
|
||||
:0800D400004040504848F8408C
|
||||
:0800D50000F81010101070007B
|
||||
:0800D60000F80808F808F80022
|
||||
:0800D7000020100808F8007079
|
||||
:0800D800002010484848484888
|
||||
:0800D9000090585050505010E7
|
||||
:0800DA0000605048484040401E
|
||||
:0800DB0000F888888888F8000D
|
||||
:0800DC0000201008088888F8D4
|
||||
:0800DD0000E010080800C0005B
|
||||
:0800DE00000000000000489042
|
||||
:0800DF000000000000609060C9
|
||||
:0800E000008E90404E20F82034
|
||||
:0800E100007804047820FE10F1
|
||||
:0800E200001804020202FC00F8
|
||||
:0800E300001C2020201008FE83
|
||||
:0800E400007C808060382420BC
|
||||
:0800E500001C269C4444F22C8F
|
||||
:0800E600004E908080809E0016
|
||||
:0800E700004CAAB6D27C484887
|
||||
:0800E800004ED24E62D24C40E2
|
||||
:0800E9000044A2A29254380069
|
||||
:0800EA00004C968C84849E04F6
|
||||
:0800EB00003048444426E410F3
|
||||
:0800EC0000B2521420001020A4
|
||||
:0800ED0000020488502000000D
|
||||
:0800EE00004C968C849E841ED8
|
||||
:0800EF0000749870FC10FC1075
|
||||
:0800F0000048A4A47E14107066
|
||||
:0800F100001C62A26022F42051
|
||||
:0800F2000044A292AA7C4848D8
|
||||
:0800F30000182420F820F82079
|
||||
:0800F40000101024E26A5C48D0
|
||||
:0800F50000201C92D2B29C1005
|
||||
:0800F6000070947810101C103A
|
||||
:0800F700003884C4B8801060D9
|
||||
:0800F8000030084484848408F0
|
||||
:0800F90000384CB444381078C3
|
||||
:0800FA000026A46424F42C206C
|
||||
:0800FB0000380484782010781D
|
||||
:0800FC000044C24262DC4040F6
|
||||
:0800FD00008C5260202010105D
|
||||
:0800FE000000000000000000FA
|
||||
:0800FF000000000000000000F9
|
||||
:00000001FF
|
61
ip/osd_generator/inc/osd_generator_regs.h
Normal file
61
ip/osd_generator/inc/osd_generator_regs.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
//
|
||||
// Copyright (C) 2019-2020 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef OSD_GENERATOR_REGS_H_
|
||||
#define OSD_GENERATOR_REGS_H_
|
||||
|
||||
#define OSD_CHAR_ROWS 30
|
||||
#define OSD_CHAR_COLS 16
|
||||
#define OSD_CHAR_SECTIONS 2
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t enable:1;
|
||||
uint8_t status_refresh:1;
|
||||
uint8_t menu_active:1;
|
||||
uint8_t status_timeout:2;
|
||||
uint8_t x_offset:3;
|
||||
uint8_t y_offset:3;
|
||||
uint8_t x_size:2;
|
||||
uint8_t y_size:2;
|
||||
uint8_t border_color:2;
|
||||
uint32_t osd_rsv:15;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data;
|
||||
} osd_config_reg;
|
||||
|
||||
// char regs
|
||||
typedef struct {
|
||||
char data[OSD_CHAR_ROWS][OSD_CHAR_SECTIONS][OSD_CHAR_COLS];
|
||||
} osd_char_array;
|
||||
|
||||
typedef struct {
|
||||
uint32_t mask;
|
||||
} osd_enable_color_reg;
|
||||
|
||||
typedef struct {
|
||||
osd_char_array osd_array;
|
||||
osd_config_reg osd_config;
|
||||
osd_enable_color_reg osd_sec_enable[OSD_CHAR_SECTIONS];
|
||||
osd_enable_color_reg osd_row_color;
|
||||
} __attribute__((packed, __may_alias__)) osd_regs;
|
||||
|
||||
#endif //OSD_GENERATOR_REGS_H_
|
159
ip/osd_generator/osd_generator_hw.tcl
Normal file
159
ip/osd_generator/osd_generator_hw.tcl
Normal file
|
@ -0,0 +1,159 @@
|
|||
#
|
||||
# request TCL package from ACDS 16.1
|
||||
#
|
||||
package require -exact qsys 16.1
|
||||
|
||||
#
|
||||
# module
|
||||
#
|
||||
set_module_property DESCRIPTION "OSD generator"
|
||||
set_module_property NAME osd_generator
|
||||
#set_module_property VERSION 18.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Processors and Peripherals"
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME osd_generator
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
#add_parameter USE_MEMORY_BLOCKS INTEGER 1
|
||||
#set_parameter_property USE_MEMORY_BLOCKS DISPLAY_NAME "Use memory blocks for character array"
|
||||
#set_parameter_property USE_MEMORY_BLOCKS DISPLAY_HINT boolean
|
||||
#set_parameter_property USE_MEMORY_BLOCKS UNITS None
|
||||
#set_parameter_property USE_MEMORY_BLOCKS HDL_PARAMETER true
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL osd_generator_top
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file osd_generator_top.sv VERILOG PATH osd_generator_top.sv
|
||||
|
||||
add_fileset SIM_VERILOG SIM_VERILOG "" ""
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE false
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL osd_generator_top
|
||||
add_fileset_file osd_generator_top.sv VERILOG PATH osd_generator_top.sv
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
set_interface_property clock_sink EXPORT_OF ""
|
||||
set_interface_property clock_sink PORT_NAME_MAP ""
|
||||
set_interface_property clock_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock_sink clk_i clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset_sink
|
||||
#
|
||||
add_interface reset_sink reset end
|
||||
set_interface_property reset_sink associatedClock clock_sink
|
||||
set_interface_property reset_sink synchronousEdges DEASSERT
|
||||
set_interface_property reset_sink ENABLED true
|
||||
set_interface_property reset_sink EXPORT_OF ""
|
||||
set_interface_property reset_sink PORT_NAME_MAP ""
|
||||
set_interface_property reset_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset_sink rst_i reset Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avalon_s
|
||||
#
|
||||
add_interface avalon_s avalon end
|
||||
set_interface_property avalon_s addressUnits WORDS
|
||||
set_interface_property avalon_s associatedClock clock_sink
|
||||
set_interface_property avalon_s associatedReset reset_sink
|
||||
set_interface_property avalon_s bitsPerSymbol 8
|
||||
set_interface_property avalon_s burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_s burstcountUnits WORDS
|
||||
set_interface_property avalon_s explicitAddressSpan 0
|
||||
set_interface_property avalon_s holdTime 0
|
||||
set_interface_property avalon_s linewrapBursts false
|
||||
set_interface_property avalon_s maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_s maximumPendingWriteTransactions 0
|
||||
set_interface_property avalon_s readLatency 0
|
||||
set_interface_property avalon_s readWaitTime 1
|
||||
set_interface_property avalon_s setupTime 0
|
||||
set_interface_property avalon_s timingUnits Cycles
|
||||
set_interface_property avalon_s writeWaitTime 0
|
||||
set_interface_property avalon_s ENABLED true
|
||||
set_interface_property avalon_s EXPORT_OF ""
|
||||
set_interface_property avalon_s PORT_NAME_MAP ""
|
||||
set_interface_property avalon_s CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_s SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avalon_s avalon_s_address address Input 8
|
||||
add_interface_port avalon_s avalon_s_writedata writedata Input 32
|
||||
add_interface_port avalon_s avalon_s_readdata readdata Output 32
|
||||
add_interface_port avalon_s avalon_s_byteenable byteenable Input 4
|
||||
add_interface_port avalon_s avalon_s_write write Input 1
|
||||
add_interface_port avalon_s avalon_s_read read Input 1
|
||||
add_interface_port avalon_s avalon_s_chipselect chipselect Input 1
|
||||
add_interface_port avalon_s avalon_s_waitrequest_n waitrequest_n Output 1
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
# connection point bus
|
||||
#
|
||||
#add_sv_interface bus osd_if
|
||||
|
||||
# Setting the parameter property to add SV interface parameters
|
||||
#set_parameter_property my_interface_parameter SV_INTERFACE_PARAMETER bus
|
||||
|
||||
# Setting the port properties to add them to SV interface port set_port_property clk SV_INTERFACE_PORT bus #set_port_property p1 SV_INTERFACE_PORT bus
|
||||
#set_port_property p2 SV_INTERFACE_PORT bus
|
||||
#set_port_property p1 SV_INTERFACE_SIGNAL bus
|
||||
#set_port_property p2 SV_INTERFACE_SIGNAL bus
|
||||
|
||||
#Adding the SV Interface File
|
||||
#add_fileset_file osd_if.sv SYSTEM_VERILOG PATH osd_if.sv SYSTEMVERILOG_INTERFACE
|
||||
|
||||
|
||||
#
|
||||
# connection point osd_if
|
||||
#
|
||||
add_interface osd_if conduit end
|
||||
set_interface_property osd_if associatedClock ""
|
||||
set_interface_property osd_if associatedReset ""
|
||||
set_interface_property osd_if ENABLED true
|
||||
set_interface_property osd_if EXPORT_OF ""
|
||||
set_interface_property osd_if PORT_NAME_MAP ""
|
||||
set_interface_property osd_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property osd_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port osd_if vclk vclk Input 1
|
||||
add_interface_port osd_if xpos xpos Input 11
|
||||
add_interface_port osd_if ypos ypos Input 11
|
||||
add_interface_port osd_if osd_enable osd_enable Output 1
|
||||
add_interface_port osd_if osd_color osd_color Output 2
|
54
ip/osd_generator/osd_generator_sw.tcl
Normal file
54
ip/osd_generator/osd_generator_sw.tcl
Normal file
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# osd_generator_sw.tcl
|
||||
#
|
||||
|
||||
# Create a new driver
|
||||
create_driver osd_generator_driver
|
||||
|
||||
# Associate it with some hardware known as "opencores_i2c"
|
||||
set_sw_property hw_class_name osd_generator
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version 1.0
|
||||
|
||||
# This driver may be incompatible with versions of hardware less
|
||||
# than specified below. Updates to hardware and device drivers
|
||||
# rendering the driver incompatible with older versions of
|
||||
# hardware are noted with this property assignment.
|
||||
#
|
||||
# Multiple-Version compatibility was introduced in version 7.1;
|
||||
# prior versions are therefore excluded.
|
||||
set_sw_property min_compatible_hw_version 1.0
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize false
|
||||
|
||||
# Location in generated BSP that above sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
|
||||
# Interrupt properties:
|
||||
# This peripheral has an IRQ output but the driver doesn't currently
|
||||
# have any interrupt service routine. To ensure that the BSP tools
|
||||
# do not otherwise limit the BSP functionality for users of the
|
||||
# Nios II enhanced interrupt port, these settings advertise
|
||||
# compliance with both legacy and enhanced interrupt APIs, and to state
|
||||
# that any driver ISR supports preemption. If an interrupt handler
|
||||
# is added to this driver, these must be re-examined for validity.
|
||||
set_sw_property isr_preemption_supported true
|
||||
set_sw_property supported_interrupt_apis "legacy_interrupt_api enhanced_interrupt_api"
|
||||
|
||||
#
|
||||
# Source file listings...
|
||||
#
|
||||
|
||||
# C/C++ source files
|
||||
|
||||
# Include files
|
||||
add_sw_property include_source inc/osd_generator_regs.h
|
||||
|
||||
# This driver supports HAL & UCOSII BSP (OS) types
|
||||
add_sw_property supported_bsp_type HAL
|
||||
add_sw_property supported_bsp_type UCOSII
|
||||
|
||||
# End of file
|
238
ip/osd_generator/osd_generator_top.sv
Normal file
238
ip/osd_generator/osd_generator_top.sv
Normal file
|
@ -0,0 +1,238 @@
|
|||
//
|
||||
// Copyright (C) 2019-2020 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
module osd_generator_top (
|
||||
// common
|
||||
input clk_i,
|
||||
input rst_i,
|
||||
// avalon slave
|
||||
input [31:0] avalon_s_writedata,
|
||||
output [31:0] avalon_s_readdata,
|
||||
input [7:0] avalon_s_address,
|
||||
input [3:0] avalon_s_byteenable,
|
||||
input avalon_s_write,
|
||||
input avalon_s_read,
|
||||
input avalon_s_chipselect,
|
||||
output avalon_s_waitrequest_n,
|
||||
// OSD interface
|
||||
input vclk,
|
||||
input [10:0] xpos,
|
||||
input [10:0] ypos,
|
||||
output reg osd_enable,
|
||||
output reg [1:0] osd_color
|
||||
);
|
||||
|
||||
localparam CHAR_ROWS = 30;
|
||||
localparam CHAR_COLS = 16;
|
||||
localparam CHAR_SECTIONS = 2;
|
||||
localparam CHAR_SEC_SEPARATOR = 2;
|
||||
|
||||
localparam BG_BLACK = 2'h0;
|
||||
localparam BG_BLUE = 2'h1;
|
||||
localparam BG_YELLOW = 2'h2;
|
||||
localparam BG_WHITE = 2'h3;
|
||||
|
||||
localparam OSD_CONFIG_REGNUM = 8'hf0;
|
||||
localparam OSD_ROW_LSEC_ENABLE_REGNUM = 8'hf1;
|
||||
localparam OSD_ROW_RSEC_ENABLE_REGNUM = 8'hf2;
|
||||
localparam OSD_ROW_COLOR_REGNUM = 8'hf3;
|
||||
|
||||
reg [31:0] osd_config;
|
||||
reg [31:0] config_reg[OSD_ROW_LSEC_ENABLE_REGNUM:OSD_ROW_COLOR_REGNUM] /* synthesis ramstyle = "logic" */;
|
||||
|
||||
reg [10:0] xpos_osd_area_scaled, xpos_text_scaled;
|
||||
reg [10:0] ypos_osd_area_scaled, ypos_text_scaled;
|
||||
reg [7:0] x_ptr[2:5], y_ptr[2:5] /* synthesis ramstyle = "logic" */;
|
||||
reg osd_text_act_pp[2:6], osd_act_pp[3:6];
|
||||
reg [14:0] to_ctr, to_ctr_ms;
|
||||
reg char_px;
|
||||
|
||||
wire render_enable = osd_config[0];
|
||||
wire status_refresh = osd_config[1];
|
||||
wire menu_active = osd_config[2];
|
||||
wire [1:0] status_timeout = osd_config[4:3];
|
||||
wire [2:0] x_offset = osd_config[7:5];
|
||||
wire [2:0] y_offset = osd_config[10:8];
|
||||
wire [1:0] x_size = osd_config[12:11];
|
||||
wire [1:0] y_size = osd_config[14:13];
|
||||
wire [1:0] border_color = osd_config[16:15];
|
||||
|
||||
wire [10:0] xpos_scaled_w = (xpos >> x_size)-({3'h0, x_offset} << 3);
|
||||
wire [10:0] ypos_scaled_w = (ypos >> y_size)-({3'h0, y_offset} << 3);
|
||||
wire [7:0] rom_rdaddr;
|
||||
wire [0:7] char_data[7:0];
|
||||
wire [4:0] char_row = (ypos_text_scaled >> 3);
|
||||
wire [5:0] char_col = (xpos_text_scaled >> 3) - (((xpos_text_scaled >> 3) >= CHAR_COLS) ? CHAR_SEC_SEPARATOR : 0);
|
||||
wire [9:0] char_idx = 32*char_row + char_col;
|
||||
|
||||
assign avalon_s_waitrequest_n = 1'b1;
|
||||
|
||||
char_array char_array_inst (
|
||||
.byteena_a(avalon_s_byteenable),
|
||||
.data(avalon_s_writedata),
|
||||
.rdaddress(char_idx),
|
||||
.rdclock(vclk),
|
||||
.wraddress(avalon_s_address),
|
||||
.wrclock(clk_i),
|
||||
.wren(avalon_s_chipselect && avalon_s_write && (avalon_s_address < CHAR_ROWS*CHAR_COLS*CHAR_SECTIONS)),
|
||||
.q(rom_rdaddr)
|
||||
);
|
||||
|
||||
char_rom char_rom_inst (
|
||||
.clock(vclk),
|
||||
.address(rom_rdaddr),
|
||||
.q({char_data[7],char_data[6],char_data[5],char_data[4],char_data[3],char_data[2],char_data[1],char_data[0]})
|
||||
);
|
||||
|
||||
// Pipeline structure
|
||||
// | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|
||||
// |----------|----------|---------|---------|---------|---------|--------|
|
||||
// > POS_TEXT | POS_AREA | | | | | |
|
||||
// > | PTR | PTR | PTR | PTR | | |
|
||||
// > | ENABLE | ENABLE | ENABLE | ENABLE | ENABLE | ENABLE |
|
||||
// > | INDEX | INDEX | | | | |
|
||||
// > | | | CHARROM | CHARROM | CHAR_PX | COLOR |
|
||||
integer idx, pp_idx;
|
||||
always @(posedge vclk) begin
|
||||
xpos_text_scaled <= xpos_scaled_w;
|
||||
ypos_text_scaled <= ypos_scaled_w;
|
||||
|
||||
xpos_osd_area_scaled <= xpos_text_scaled + 3'h4;
|
||||
ypos_osd_area_scaled <= ypos_text_scaled + 3'h4;
|
||||
|
||||
x_ptr[2] <= xpos_text_scaled[7:0];
|
||||
y_ptr[2] <= ypos_text_scaled[7:0];
|
||||
for(pp_idx = 3; pp_idx <= 5; pp_idx = pp_idx+1) begin
|
||||
x_ptr[pp_idx] <= x_ptr[pp_idx-1];
|
||||
y_ptr[pp_idx] <= y_ptr[pp_idx-1];
|
||||
end
|
||||
|
||||
osd_text_act_pp[2] <= render_enable &
|
||||
(menu_active || (to_ctr_ms > 0)) &
|
||||
(((xpos_text_scaled < 8*CHAR_COLS) & config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][ypos_text_scaled/8]) |
|
||||
((xpos_text_scaled >= 8*(CHAR_COLS+CHAR_SEC_SEPARATOR)) & (xpos_text_scaled < 8*(2*CHAR_COLS+CHAR_SEC_SEPARATOR)) & config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_text_scaled/8])) &
|
||||
(ypos_text_scaled < 8*CHAR_ROWS);
|
||||
for(pp_idx = 3; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
osd_text_act_pp[pp_idx] <= osd_text_act_pp[pp_idx-1];
|
||||
end
|
||||
|
||||
osd_act_pp[3] <= render_enable &
|
||||
(menu_active || (to_ctr_ms > 0)) &
|
||||
(((xpos_osd_area_scaled/8 < (CHAR_COLS+1)) & config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8) ? ((ypos_osd_area_scaled/8)-1) : 0]) |
|
||||
((xpos_osd_area_scaled/8 >= (CHAR_COLS+1)) & (xpos_osd_area_scaled/8 < (2*CHAR_COLS+CHAR_SEC_SEPARATOR+1)) & (config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8)-1] | config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_osd_area_scaled/8]))) &
|
||||
(ypos_osd_area_scaled < 8*(CHAR_ROWS+1));
|
||||
for(pp_idx = 4; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
osd_act_pp[pp_idx] <= osd_act_pp[pp_idx-1];
|
||||
end
|
||||
|
||||
char_px <= char_data[y_ptr[5]][x_ptr[5]];
|
||||
|
||||
osd_enable <= osd_act_pp[6];
|
||||
|
||||
if (osd_text_act_pp[6]) begin
|
||||
if (char_px) begin
|
||||
osd_color <= config_reg[OSD_ROW_COLOR_REGNUM][char_row] ? BG_YELLOW : BG_WHITE;
|
||||
end else begin
|
||||
osd_color <= BG_BLUE;
|
||||
end
|
||||
end else begin // border
|
||||
osd_color <= border_color;
|
||||
end
|
||||
end
|
||||
|
||||
// OSD status timeout counters
|
||||
always @(posedge clk_i)
|
||||
begin
|
||||
if (status_refresh) begin
|
||||
to_ctr <= 15'd0;
|
||||
case (status_timeout)
|
||||
default: to_ctr_ms <= 2000; // 2s
|
||||
2'b01: to_ctr_ms <= 5000; // 5s
|
||||
2'b10: to_ctr_ms <= 10000; // 10s
|
||||
2'b11: to_ctr_ms <= 0; // off
|
||||
endcase
|
||||
end else begin
|
||||
if (to_ctr == 27000-1) begin
|
||||
to_ctr <= 0;
|
||||
if (to_ctr_ms != 15'h0)
|
||||
to_ctr_ms <= to_ctr_ms - 1'b1;
|
||||
end else begin
|
||||
to_ctr <= to_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// Avalon register interface
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
osd_config <= 32'h0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==OSD_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
osd_config[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
osd_config[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
osd_config[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
osd_config[7:0] <= avalon_s_writedata[7:0];
|
||||
end else begin
|
||||
osd_config[1] <= 1'b0; // reset timer refresh bit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
genvar i;
|
||||
generate
|
||||
for (i=OSD_ROW_LSEC_ENABLE_REGNUM; i <= OSD_ROW_COLOR_REGNUM; i++) begin : gen_reg
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
config_reg[i] <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==i)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
config_reg[i][31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
config_reg[i][23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
config_reg[i][15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
config_reg[i][7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
|
||||
always @(*) begin
|
||||
if (avalon_s_chipselect && avalon_s_read) begin
|
||||
case (avalon_s_address)
|
||||
OSD_CONFIG_REGNUM: avalon_s_readdata = osd_config;
|
||||
OSD_ROW_LSEC_ENABLE_REGNUM: avalon_s_readdata = config_reg[OSD_ROW_LSEC_ENABLE_REGNUM];
|
||||
OSD_ROW_RSEC_ENABLE_REGNUM: avalon_s_readdata = config_reg[OSD_ROW_RSEC_ENABLE_REGNUM];
|
||||
OSD_ROW_COLOR_REGNUM: avalon_s_readdata = config_reg[OSD_ROW_COLOR_REGNUM];
|
||||
default: avalon_s_readdata = 32'h00000000;
|
||||
endcase
|
||||
end else begin
|
||||
avalon_s_readdata = 32'h00000000;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
47
ip/pll_reconfig/inc/pll_reconfig_regs.h
Normal file
47
ip/pll_reconfig/inc/pll_reconfig_regs.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// Copyright (C) 2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef PLL_RECONFIG_REGS_H_
|
||||
#define PLL_RECONFIG_REGS_H_
|
||||
|
||||
#include <alt_types.h>
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u8 reset:1;
|
||||
alt_u8 update:1;
|
||||
alt_u8 t_config_id:4;
|
||||
alt_u32 pll_reconfig_rsv:21;
|
||||
alt_u8 c_config_id:4;
|
||||
alt_u8 busy:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} pll_config_status_reg;
|
||||
|
||||
// char regs
|
||||
typedef struct {
|
||||
char data[160];
|
||||
} pll_config_data_regs;
|
||||
|
||||
typedef struct {
|
||||
pll_config_status_reg pll_config_status;
|
||||
pll_config_data_regs pll_config_data;
|
||||
} __attribute__((packed, __may_alias__)) pll_reconfig_regs;
|
||||
|
||||
#endif //OSD_GENERATOR_REGS_H_
|
151
ip/pll_reconfig/pll_reconfig_hw.tcl
Normal file
151
ip/pll_reconfig/pll_reconfig_hw.tcl
Normal file
|
@ -0,0 +1,151 @@
|
|||
#
|
||||
# request TCL package from ACDS 16.1
|
||||
#
|
||||
package require -exact qsys 16.1
|
||||
|
||||
#
|
||||
# module
|
||||
#
|
||||
set_module_property DESCRIPTION "PLL reconfig"
|
||||
set_module_property NAME pll_reconfig
|
||||
#set_module_property VERSION 18.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Processors and Peripherals"
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME pll_reconfig
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL pll_reconfig_top
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file pll_reconfig_top.sv VERILOG PATH pll_reconfig_top.sv
|
||||
|
||||
add_fileset SIM_VERILOG SIM_VERILOG "" ""
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE false
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL pll_reconfig_top
|
||||
add_fileset_file pll_reconfig_top.sv VERILOG PATH pll_reconfig_top.sv
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
set_interface_property clock_sink EXPORT_OF ""
|
||||
set_interface_property clock_sink PORT_NAME_MAP ""
|
||||
set_interface_property clock_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock_sink clk_i clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset_sink
|
||||
#
|
||||
add_interface reset_sink reset end
|
||||
set_interface_property reset_sink associatedClock clock_sink
|
||||
set_interface_property reset_sink synchronousEdges DEASSERT
|
||||
set_interface_property reset_sink ENABLED true
|
||||
set_interface_property reset_sink EXPORT_OF ""
|
||||
set_interface_property reset_sink PORT_NAME_MAP ""
|
||||
set_interface_property reset_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset_sink rst_i reset Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avalon_s
|
||||
#
|
||||
add_interface avalon_s avalon end
|
||||
set_interface_property avalon_s addressUnits WORDS
|
||||
set_interface_property avalon_s associatedClock clock_sink
|
||||
set_interface_property avalon_s associatedReset reset_sink
|
||||
set_interface_property avalon_s bitsPerSymbol 8
|
||||
set_interface_property avalon_s burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_s burstcountUnits WORDS
|
||||
set_interface_property avalon_s explicitAddressSpan 0
|
||||
set_interface_property avalon_s holdTime 0
|
||||
set_interface_property avalon_s linewrapBursts false
|
||||
set_interface_property avalon_s maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_s maximumPendingWriteTransactions 0
|
||||
set_interface_property avalon_s readLatency 0
|
||||
set_interface_property avalon_s readWaitTime 1
|
||||
set_interface_property avalon_s setupTime 0
|
||||
set_interface_property avalon_s timingUnits Cycles
|
||||
set_interface_property avalon_s writeWaitTime 0
|
||||
set_interface_property avalon_s ENABLED true
|
||||
set_interface_property avalon_s EXPORT_OF ""
|
||||
set_interface_property avalon_s PORT_NAME_MAP ""
|
||||
set_interface_property avalon_s CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_s SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avalon_s avalon_s_address address Input 3
|
||||
add_interface_port avalon_s avalon_s_writedata writedata Input 32
|
||||
add_interface_port avalon_s avalon_s_readdata readdata Output 32
|
||||
add_interface_port avalon_s avalon_s_byteenable byteenable Input 4
|
||||
add_interface_port avalon_s avalon_s_write write Input 1
|
||||
add_interface_port avalon_s avalon_s_read read Input 1
|
||||
add_interface_port avalon_s avalon_s_chipselect chipselect Input 1
|
||||
add_interface_port avalon_s avalon_s_waitrequest_n waitrequest_n Output 1
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
# connection point bus
|
||||
#
|
||||
#add_sv_interface bus pll_reconfig_if
|
||||
|
||||
# Setting the parameter property to add SV interface parameters
|
||||
#set_parameter_property my_interface_parameter SV_INTERFACE_PARAMETER bus
|
||||
|
||||
# Setting the port properties to add them to SV interface port set_port_property clk SV_INTERFACE_PORT bus #set_port_property p1 SV_INTERFACE_PORT bus
|
||||
#set_port_property p2 SV_INTERFACE_PORT bus
|
||||
#set_port_property p1 SV_INTERFACE_SIGNAL bus
|
||||
#set_port_property p2 SV_INTERFACE_SIGNAL bus
|
||||
|
||||
#Adding the SV Interface File
|
||||
#add_fileset_file pll_reconfig_if.sv SYSTEM_VERILOG PATH pll_reconfig_if.sv SYSTEMVERILOG_INTERFACE
|
||||
|
||||
|
||||
#
|
||||
# connection point pll_reconfig_if
|
||||
#
|
||||
add_interface pll_reconfig_if conduit end
|
||||
set_interface_property pll_reconfig_if associatedClock ""
|
||||
set_interface_property pll_reconfig_if associatedReset ""
|
||||
set_interface_property pll_reconfig_if ENABLED true
|
||||
set_interface_property pll_reconfig_if EXPORT_OF ""
|
||||
set_interface_property pll_reconfig_if PORT_NAME_MAP ""
|
||||
set_interface_property pll_reconfig_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property pll_reconfig_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port pll_reconfig_if areset areset Output 1
|
||||
add_interface_port pll_reconfig_if scanclk scanclk Output 1
|
||||
add_interface_port pll_reconfig_if scanclkena scanclkena Output 1
|
||||
add_interface_port pll_reconfig_if configupdate configupdate Output 1
|
||||
add_interface_port pll_reconfig_if scandata scandata Output 1
|
||||
add_interface_port pll_reconfig_if scandone scandone Input 1
|
54
ip/pll_reconfig/pll_reconfig_sw.tcl
Normal file
54
ip/pll_reconfig/pll_reconfig_sw.tcl
Normal file
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# pll_reconfig_sw.tcl
|
||||
#
|
||||
|
||||
# Create a new driver
|
||||
create_driver pll_reconfig_driver
|
||||
|
||||
# Associate it with some hardware known as "opencores_i2c"
|
||||
set_sw_property hw_class_name pll_reconfig
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version 1.0
|
||||
|
||||
# This driver may be incompatible with versions of hardware less
|
||||
# than specified below. Updates to hardware and device drivers
|
||||
# rendering the driver incompatible with older versions of
|
||||
# hardware are noted with this property assignment.
|
||||
#
|
||||
# Multiple-Version compatibility was introduced in version 7.1;
|
||||
# prior versions are therefore excluded.
|
||||
set_sw_property min_compatible_hw_version 7.1
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize false
|
||||
|
||||
# Location in generated BSP that above sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
|
||||
# Interrupt properties:
|
||||
# This peripheral has an IRQ output but the driver doesn't currently
|
||||
# have any interrupt service routine. To ensure that the BSP tools
|
||||
# do not otherwise limit the BSP functionality for users of the
|
||||
# Nios II enhanced interrupt port, these settings advertise
|
||||
# compliance with both legacy and enhanced interrupt APIs, and to state
|
||||
# that any driver ISR supports preemption. If an interrupt handler
|
||||
# is added to this driver, these must be re-examined for validity.
|
||||
set_sw_property isr_preemption_supported true
|
||||
set_sw_property supported_interrupt_apis "legacy_interrupt_api enhanced_interrupt_api"
|
||||
|
||||
#
|
||||
# Source file listings...
|
||||
#
|
||||
|
||||
# C/C++ source files
|
||||
|
||||
# Include files
|
||||
add_sw_property include_source inc/pll_reconfig_regs.h
|
||||
|
||||
# This driver supports HAL & UCOSII BSP (OS) types
|
||||
add_sw_property supported_bsp_type HAL
|
||||
add_sw_property supported_bsp_type UCOSII
|
||||
|
||||
# End of file
|
195
ip/pll_reconfig/pll_reconfig_top.sv
Normal file
195
ip/pll_reconfig/pll_reconfig_top.sv
Normal file
|
@ -0,0 +1,195 @@
|
|||
//
|
||||
// Copyright (C) 2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
module pll_reconfig_top (
|
||||
// common
|
||||
input clk_i,
|
||||
input rst_i,
|
||||
// avalon slave
|
||||
input [31:0] avalon_s_writedata,
|
||||
output [31:0] avalon_s_readdata,
|
||||
input [2:0] avalon_s_address,
|
||||
input [3:0] avalon_s_byteenable,
|
||||
input avalon_s_write,
|
||||
input avalon_s_read,
|
||||
input avalon_s_chipselect,
|
||||
output avalon_s_waitrequest_n,
|
||||
// reconfig interface
|
||||
output areset,
|
||||
output scanclk,
|
||||
output reg scanclkena,
|
||||
output reg configupdate,
|
||||
output scandata,
|
||||
input scandone
|
||||
);
|
||||
|
||||
localparam PLL_CONFIG_DATA_BITS = 8'd144;
|
||||
localparam PLL_CONFIG_DATA_REGS = 5;
|
||||
|
||||
localparam PLL_CONFIG_STATUS_REGNUM = 3'h0;
|
||||
localparam PLL_CONFIG_DATA_STARTREG = 3'h1;
|
||||
|
||||
localparam STATE_IDLE = 2'h0;
|
||||
localparam STATE_SHIFT = 2'h1;
|
||||
localparam STATE_WAITRESP = 2'h2;
|
||||
|
||||
reg [31:0] pll_config_status;
|
||||
reg [31:0] config_data[0:(PLL_CONFIG_DATA_REGS-1)] /* synthesis ramstyle = "logic" */;
|
||||
reg areset_strobe;
|
||||
reg [1:0] state;
|
||||
reg scan_shift;
|
||||
reg scandone_prev;
|
||||
reg configupdate_pre;
|
||||
reg [7:0] shift_ctr;
|
||||
|
||||
wire pll_reset = pll_config_status[0];
|
||||
wire start_update = pll_config_status[1];
|
||||
wire [3:0] t_config_id = pll_config_status[5:2];
|
||||
wire [3:0] c_config_id = pll_config_status[30:27];
|
||||
wire config_busy = pll_config_status[31];
|
||||
|
||||
assign areset = pll_reset | areset_strobe;
|
||||
assign scanclk = clk_i;
|
||||
assign scandata = config_data[0][16];
|
||||
|
||||
assign avalon_s_waitrequest_n = 1'b1;
|
||||
|
||||
|
||||
// Avalon register interface
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
pll_config_status[7:0] <= 8'h0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==PLL_CONFIG_STATUS_REGNUM)) begin
|
||||
/*if (avalon_s_byteenable[3])
|
||||
pll_config_status[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
pll_config_status[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
pll_config_status[15:8] <= avalon_s_writedata[15:8];*/
|
||||
if (avalon_s_byteenable[0])
|
||||
pll_config_status[7:0] <= avalon_s_writedata[7:0];
|
||||
end else begin
|
||||
pll_config_status[1] <= 1'b0; // reset start_update bit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
genvar i;
|
||||
generate
|
||||
for (i = 0; i < PLL_CONFIG_DATA_REGS; i = i + 1) begin : genreg
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
config_data[i] <= 32'h0;
|
||||
end else begin
|
||||
if (!scan_shift) begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==(PLL_CONFIG_DATA_STARTREG+PLL_CONFIG_DATA_REGS-1-i))) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
config_data[i][31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
config_data[i][23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
config_data[i][15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
config_data[i][7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end else begin
|
||||
if (i==(PLL_CONFIG_DATA_REGS-1)) begin
|
||||
config_data[i] <= {1'b0, config_data[i][31:1]};
|
||||
end else begin
|
||||
config_data[i] <= {config_data[i+1][0], config_data[i][31:1]};
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// Main FSM
|
||||
always @(posedge clk_i or posedge rst_i)
|
||||
begin
|
||||
if (rst_i) begin
|
||||
state <= STATE_IDLE;
|
||||
scanclkena <= 1'b0;
|
||||
configupdate_pre <= 1'b0;
|
||||
configupdate <= 1'b0;
|
||||
areset_strobe <= 1'b0;
|
||||
scan_shift <= 1'b0;
|
||||
scandone_prev <= 1'b0;
|
||||
pll_config_status[31] <= 1'b0;
|
||||
end else begin
|
||||
case (state)
|
||||
STATE_IDLE:
|
||||
begin
|
||||
areset_strobe <= 1'b0;
|
||||
|
||||
if (start_update) begin
|
||||
pll_config_status[31] <= 1'b1;
|
||||
scanclkena <= 1'b1;
|
||||
shift_ctr <= PLL_CONFIG_DATA_BITS;
|
||||
state <= STATE_SHIFT;
|
||||
end else begin
|
||||
pll_config_status[31] <= 1'b0;
|
||||
end
|
||||
end
|
||||
STATE_SHIFT:
|
||||
begin
|
||||
scan_shift <= 1'b1;
|
||||
if (shift_ctr > 0) begin
|
||||
shift_ctr <= shift_ctr - 1'b1;
|
||||
end else begin
|
||||
scan_shift <= 1'b0;
|
||||
scanclkena <= 1'b0;
|
||||
configupdate_pre <= 1'b1;
|
||||
state <= STATE_WAITRESP;
|
||||
end
|
||||
end
|
||||
STATE_WAITRESP:
|
||||
begin
|
||||
configupdate_pre <= 1'b0;
|
||||
if (pll_reset) begin
|
||||
state <= STATE_IDLE;
|
||||
end else if (scandone_prev) begin
|
||||
areset_strobe <= 1'b1;
|
||||
pll_config_status[30:27] <= t_config_id;
|
||||
state <= STATE_IDLE;
|
||||
end
|
||||
end
|
||||
default:
|
||||
state <= STATE_IDLE;
|
||||
endcase
|
||||
|
||||
scandone_prev <= scandone;
|
||||
configupdate <= configupdate_pre;
|
||||
end
|
||||
end
|
||||
|
||||
always @(*) begin
|
||||
if (avalon_s_chipselect && avalon_s_read) begin
|
||||
case (avalon_s_address)
|
||||
PLL_CONFIG_STATUS_REGNUM: avalon_s_readdata = pll_config_status;
|
||||
default: avalon_s_readdata = 32'h00000000;
|
||||
endcase
|
||||
end else begin
|
||||
avalon_s_readdata = 32'h00000000;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
1
ip/pulpino_qsys
Submodule
1
ip/pulpino_qsys
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b11dd7718e6d367cbaef8a362ce206510fd87ed0
|
137
ip/sc_config/inc/sc_config_regs.h
Normal file
137
ip/sc_config/inc/sc_config_regs.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
//
|
||||
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef SC_CONFIG_REGS_H_
|
||||
#define SC_CONFIG_REGS_H_
|
||||
|
||||
#include <alt_types.h>
|
||||
|
||||
// bit-fields coded as little-endian
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 vmax:11;
|
||||
alt_u8 interlace_flag:1;
|
||||
alt_u8 sc_rsv2:4;
|
||||
alt_u8 fpga_vsyncgen:2;
|
||||
alt_u16 vmax_tvp:11;
|
||||
alt_u8 sc_rsv:2;
|
||||
alt_u8 vsync_flag:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sc_status_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 pcnt_frame:20;
|
||||
alt_u16 sc_rsv:12;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sc_status2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 lt_lat_result:16;
|
||||
alt_u16 lt_stb_result:12;
|
||||
alt_u8 lt_rsv:3;
|
||||
alt_u8 lt_finished:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} lt_status_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 h_active:11;
|
||||
alt_u16 h_backporch:9;
|
||||
alt_u8 h_synclen:8;
|
||||
alt_u8 h_l3_240x360:1;
|
||||
alt_u8 h_l5fmt:1;
|
||||
alt_u8 h_multmode:2;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} h_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 h_opt_startoff:10;
|
||||
alt_u8 h_opt_sample_mult:3;
|
||||
alt_u8 h_opt_sample_sel:3;
|
||||
alt_u8 h_opt_scale:3;
|
||||
alt_u16 h_mask:11;
|
||||
alt_u8 h_rsv:2;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} h_config2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 v_active:11;
|
||||
alt_u8 v_backporch:8;
|
||||
alt_u8 v_synclen:3;
|
||||
alt_u8 v_mask:6;
|
||||
alt_u8 v_rsv:1;
|
||||
alt_u8 v_multmode:3;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} v_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u8 mask_br:4;
|
||||
alt_u8 mask_color:3;
|
||||
alt_u8 rev_lpf_str:5;
|
||||
alt_u8 panasonic_hack:1;
|
||||
alt_u32 misc_rsv:19;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} misc_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 sl_l_str_arr:20;
|
||||
alt_u8 sl_l_overlay:5;
|
||||
alt_u8 sl_hybr_str:5;
|
||||
alt_u8 sl_method:1;
|
||||
alt_u8 sl_no_altern:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sl_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 sl_c_str_arr:24;
|
||||
alt_u8 sl_c_overlay:6;
|
||||
alt_u8 sl_rsv:1;
|
||||
alt_u8 sl_altiv:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sl_config2_reg;
|
||||
|
||||
typedef struct {
|
||||
sc_status_reg sc_status;
|
||||
sc_status2_reg sc_status2;
|
||||
lt_status_reg lt_status;
|
||||
h_config_reg h_config;
|
||||
h_config2_reg h_config2;
|
||||
v_config_reg v_config;
|
||||
misc_config_reg misc_config;
|
||||
sl_config_reg sl_config;
|
||||
sl_config2_reg sl_config2;
|
||||
} __attribute__((packed, __may_alias__)) sc_regs;
|
||||
|
||||
#endif //SC_CONFIG_REGS_H_
|
154
ip/sc_config/sc_config_hw.tcl
Normal file
154
ip/sc_config/sc_config_hw.tcl
Normal file
|
@ -0,0 +1,154 @@
|
|||
#
|
||||
# request TCL package from ACDS 16.1
|
||||
#
|
||||
package require -exact qsys 16.1
|
||||
|
||||
#
|
||||
# module
|
||||
#
|
||||
set_module_property DESCRIPTION "Scanconverter config"
|
||||
set_module_property NAME sc_config
|
||||
#set_module_property VERSION 18.0
|
||||
set_module_property INTERNAL false
|
||||
set_module_property OPAQUE_ADDRESS_MAP true
|
||||
set_module_property GROUP "Interface Protocols"
|
||||
set_module_property AUTHOR ""
|
||||
set_module_property DISPLAY_NAME sc_config
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
set_module_property EDITABLE true
|
||||
set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL sc_config_top
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_FILE_OVERWRITE_MODE false
|
||||
add_fileset_file sc_config_top.sv VERILOG PATH sc_config_top.sv
|
||||
|
||||
add_fileset SIM_VERILOG SIM_VERILOG "" ""
|
||||
set_fileset_property SIM_VERILOG ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE false
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL sc_config_top
|
||||
add_fileset_file sc_config_top.sv VERILOG PATH sc_config_top.sv
|
||||
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# display items
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
set_interface_property clock_sink EXPORT_OF ""
|
||||
set_interface_property clock_sink PORT_NAME_MAP ""
|
||||
set_interface_property clock_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port clock_sink clk_i clk Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point reset_sink
|
||||
#
|
||||
add_interface reset_sink reset end
|
||||
set_interface_property reset_sink associatedClock clock_sink
|
||||
set_interface_property reset_sink synchronousEdges DEASSERT
|
||||
set_interface_property reset_sink ENABLED true
|
||||
set_interface_property reset_sink EXPORT_OF ""
|
||||
set_interface_property reset_sink PORT_NAME_MAP ""
|
||||
set_interface_property reset_sink CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property reset_sink SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port reset_sink rst_i reset Input 1
|
||||
|
||||
|
||||
#
|
||||
# connection point avalon_s
|
||||
#
|
||||
add_interface avalon_s avalon end
|
||||
set_interface_property avalon_s addressUnits WORDS
|
||||
set_interface_property avalon_s associatedClock clock_sink
|
||||
set_interface_property avalon_s associatedReset reset_sink
|
||||
set_interface_property avalon_s bitsPerSymbol 8
|
||||
set_interface_property avalon_s burstOnBurstBoundariesOnly false
|
||||
set_interface_property avalon_s burstcountUnits WORDS
|
||||
set_interface_property avalon_s explicitAddressSpan 0
|
||||
set_interface_property avalon_s holdTime 0
|
||||
set_interface_property avalon_s linewrapBursts false
|
||||
set_interface_property avalon_s maximumPendingReadTransactions 0
|
||||
set_interface_property avalon_s maximumPendingWriteTransactions 0
|
||||
set_interface_property avalon_s readLatency 0
|
||||
set_interface_property avalon_s readWaitTime 1
|
||||
set_interface_property avalon_s setupTime 0
|
||||
set_interface_property avalon_s timingUnits Cycles
|
||||
set_interface_property avalon_s writeWaitTime 0
|
||||
set_interface_property avalon_s ENABLED true
|
||||
set_interface_property avalon_s EXPORT_OF ""
|
||||
set_interface_property avalon_s PORT_NAME_MAP ""
|
||||
set_interface_property avalon_s CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_s SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avalon_s avalon_s_address address Input 4
|
||||
add_interface_port avalon_s avalon_s_writedata writedata Input 32
|
||||
add_interface_port avalon_s avalon_s_readdata readdata Output 32
|
||||
add_interface_port avalon_s avalon_s_byteenable byteenable Input 4
|
||||
add_interface_port avalon_s avalon_s_write write Input 1
|
||||
add_interface_port avalon_s avalon_s_read read Input 1
|
||||
add_interface_port avalon_s avalon_s_chipselect chipselect Input 1
|
||||
add_interface_port avalon_s avalon_s_waitrequest_n waitrequest_n Output 1
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isFlash 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isMemoryDevice 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isNonVolatileStorage 0
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
# connection point bus
|
||||
#
|
||||
#add_sv_interface bus sc_if
|
||||
|
||||
# Setting the parameter property to add SV interface parameters
|
||||
#set_parameter_property my_interface_parameter SV_INTERFACE_PARAMETER bus
|
||||
|
||||
# Setting the port properties to add them to SV interface port set_port_property clk SV_INTERFACE_PORT bus #set_port_property p1 SV_INTERFACE_PORT bus
|
||||
#set_port_property p2 SV_INTERFACE_PORT bus
|
||||
#set_port_property p1 SV_INTERFACE_SIGNAL bus
|
||||
#set_port_property p2 SV_INTERFACE_SIGNAL bus
|
||||
|
||||
#Adding the SV Interface File
|
||||
#add_fileset_file sc_if.sv SYSTEM_VERILOG PATH sc_if.sv SYSTEMVERILOG_INTERFACE
|
||||
|
||||
|
||||
#
|
||||
# connection point sc_if
|
||||
#
|
||||
add_interface sc_if conduit end
|
||||
set_interface_property sc_if associatedClock ""
|
||||
set_interface_property sc_if associatedReset ""
|
||||
set_interface_property sc_if ENABLED true
|
||||
set_interface_property sc_if EXPORT_OF ""
|
||||
set_interface_property sc_if PORT_NAME_MAP ""
|
||||
set_interface_property sc_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property sc_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port sc_if sc_status_i sc_status_i Input 32
|
||||
add_interface_port sc_if sc_status2_i sc_status2_i Input 32
|
||||
add_interface_port sc_if lt_status_i lt_status_i Input 32
|
||||
add_interface_port sc_if h_config_o h_config_o Output 32
|
||||
add_interface_port sc_if h_config2_o h_config2_o Output 32
|
||||
add_interface_port sc_if v_config_o v_config_o Output 32
|
||||
add_interface_port sc_if misc_config_o misc_config_o Output 32
|
||||
add_interface_port sc_if sl_config_o sl_config_o Output 32
|
||||
add_interface_port sc_if sl_config2_o sl_config2_o Output 32
|
54
ip/sc_config/sc_config_sw.tcl
Normal file
54
ip/sc_config/sc_config_sw.tcl
Normal file
|
@ -0,0 +1,54 @@
|
|||
#
|
||||
# opencores_i2c_sw.tcl
|
||||
#
|
||||
|
||||
# Create a new driver
|
||||
create_driver sc_config_driver
|
||||
|
||||
# Associate it with some hardware known as "opencores_i2c"
|
||||
set_sw_property hw_class_name sc_config
|
||||
|
||||
# The version of this driver
|
||||
set_sw_property version 1.0
|
||||
|
||||
# This driver may be incompatible with versions of hardware less
|
||||
# than specified below. Updates to hardware and device drivers
|
||||
# rendering the driver incompatible with older versions of
|
||||
# hardware are noted with this property assignment.
|
||||
#
|
||||
# Multiple-Version compatibility was introduced in version 7.1;
|
||||
# prior versions are therefore excluded.
|
||||
set_sw_property min_compatible_hw_version 7.1
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize false
|
||||
|
||||
# Location in generated BSP that above sources will be copied into
|
||||
set_sw_property bsp_subdirectory drivers
|
||||
|
||||
|
||||
# Interrupt properties:
|
||||
# This peripheral has an IRQ output but the driver doesn't currently
|
||||
# have any interrupt service routine. To ensure that the BSP tools
|
||||
# do not otherwise limit the BSP functionality for users of the
|
||||
# Nios II enhanced interrupt port, these settings advertise
|
||||
# compliance with both legacy and enhanced interrupt APIs, and to state
|
||||
# that any driver ISR supports preemption. If an interrupt handler
|
||||
# is added to this driver, these must be re-examined for validity.
|
||||
set_sw_property isr_preemption_supported true
|
||||
set_sw_property supported_interrupt_apis "legacy_interrupt_api enhanced_interrupt_api"
|
||||
|
||||
#
|
||||
# Source file listings...
|
||||
#
|
||||
|
||||
# C/C++ source files
|
||||
|
||||
# Include files
|
||||
add_sw_property include_source inc/sc_config_regs.h
|
||||
|
||||
# This driver supports HAL & UCOSII BSP (OS) types
|
||||
add_sw_property supported_bsp_type HAL
|
||||
add_sw_property supported_bsp_type UCOSII
|
||||
|
||||
# End of file
|
179
ip/sc_config/sc_config_top.sv
Normal file
179
ip/sc_config/sc_config_top.sv
Normal file
|
@ -0,0 +1,179 @@
|
|||
//
|
||||
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
module sc_config_top(
|
||||
// common
|
||||
input clk_i,
|
||||
input rst_i,
|
||||
// avalon slave
|
||||
input [31:0] avalon_s_writedata,
|
||||
output [31:0] avalon_s_readdata,
|
||||
input [3:0] avalon_s_address,
|
||||
input [3:0] avalon_s_byteenable,
|
||||
input avalon_s_write,
|
||||
input avalon_s_read,
|
||||
input avalon_s_chipselect,
|
||||
output avalon_s_waitrequest_n,
|
||||
// SC interface
|
||||
input [31:0] sc_status_i,
|
||||
input [31:0] sc_status2_i,
|
||||
input [31:0] lt_status_i,
|
||||
output reg [31:0] h_config_o,
|
||||
output reg [31:0] h_config2_o,
|
||||
output reg [31:0] v_config_o,
|
||||
output reg [31:0] misc_config_o,
|
||||
output reg [31:0] sl_config_o,
|
||||
output reg [31:0] sl_config2_o
|
||||
);
|
||||
|
||||
localparam SC_STATUS_REGNUM = 4'h0;
|
||||
localparam SC_STATUS2_REGNUM = 4'h1;
|
||||
localparam LT_STATUS_REGNUM = 4'h2;
|
||||
localparam H_CONFIG_REGNUM = 4'h3;
|
||||
localparam H_CONFIG2_REGNUM = 4'h4;
|
||||
localparam V_CONFIG_REGNUM = 4'h5;
|
||||
localparam MISC_CONFIG_REGNUM = 4'h6;
|
||||
localparam SL_CONFIG_REGNUM = 4'h7;
|
||||
localparam SL_CONFIG2_REGNUM = 4'h8;
|
||||
|
||||
|
||||
assign avalon_s_waitrequest_n = 1'b1;
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
h_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==H_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
h_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
h_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
h_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
h_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
h_config2_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==H_CONFIG2_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
h_config2_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
h_config2_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
h_config2_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
h_config2_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
v_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==V_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
v_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
v_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
v_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
v_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
misc_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==MISC_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
misc_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
misc_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
misc_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
misc_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
sl_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==SL_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
sl_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
sl_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
sl_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
sl_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
sl_config2_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==SL_CONFIG2_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
sl_config2_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
sl_config2_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
sl_config2_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
sl_config2_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(*) begin
|
||||
if (avalon_s_chipselect && avalon_s_read) begin
|
||||
case (avalon_s_address)
|
||||
SC_STATUS_REGNUM: avalon_s_readdata = sc_status_i;
|
||||
SC_STATUS2_REGNUM: avalon_s_readdata = sc_status2_i;
|
||||
LT_STATUS_REGNUM: avalon_s_readdata = lt_status_i;
|
||||
H_CONFIG_REGNUM: avalon_s_readdata = h_config_o;
|
||||
H_CONFIG2_REGNUM: avalon_s_readdata = h_config2_o;
|
||||
V_CONFIG_REGNUM: avalon_s_readdata = v_config_o;
|
||||
MISC_CONFIG_REGNUM: avalon_s_readdata = misc_config_o;
|
||||
SL_CONFIG_REGNUM: avalon_s_readdata = sl_config_o;
|
||||
SL_CONFIG2_REGNUM: avalon_s_readdata = sl_config2_o;
|
||||
default: avalon_s_readdata = 32'h00000000;
|
||||
endcase
|
||||
end else begin
|
||||
avalon_s_readdata = 32'h00000000;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
6
ossc.cof
6
ossc.cof
|
@ -10,14 +10,14 @@
|
|||
<user_name>Page_0</user_name>
|
||||
<page_flags>1</page_flags>
|
||||
<bit0>
|
||||
<sof_filename>output_files/ossc.sof</sof_filename>
|
||||
<sof_filename>output_files/ossc.sof<compress_bitstream>1</compress_bitstream></sof_filename>
|
||||
</bit0>
|
||||
</sof_data>
|
||||
<version>9</version>
|
||||
<version>10</version>
|
||||
<create_cvp_file>0</create_cvp_file>
|
||||
<create_hps_iocsr>0</create_hps_iocsr>
|
||||
<auto_create_rpd>0</auto_create_rpd>
|
||||
<create_fif_file>0</create_fif_file>
|
||||
<rpd_little_endian>1</rpd_little_endian>
|
||||
<options>
|
||||
<map_file>1</map_file>
|
||||
</options>
|
||||
|
|
55
ossc.qsf
55
ossc.qsf
|
@ -41,7 +41,7 @@ set_global_assignment -name DEVICE EP4CE15E22C8
|
|||
set_global_assignment -name TOP_LEVEL_ENTITY ossc
|
||||
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 13.1
|
||||
set_global_assignment -name PROJECT_CREATION_TIME_DATE "17:27:03 MAY 17, 2014"
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION 15.1.0
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION "20.1.1 Lite Edition"
|
||||
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
|
||||
set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
|
||||
set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
|
||||
|
@ -57,7 +57,7 @@ set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"
|
|||
|
||||
|
||||
set_location_assignment PIN_25 -to clk27
|
||||
set_location_assignment PIN_99 -to reset_n
|
||||
set_location_assignment PIN_99 -to hw_reset_n
|
||||
set_location_assignment PIN_23 -to ir_rx
|
||||
|
||||
#============================================================
|
||||
|
@ -162,12 +162,6 @@ set_location_assignment PIN_129 -to btn[1]
|
|||
set_location_assignment PIN_128 -to btn[0]
|
||||
|
||||
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to G_in
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to FID_in
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to HSYNC_in
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to R_in
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to VSYNC_in
|
||||
set_instance_assignment -name PLL_COMPENSATE ON -to B_in
|
||||
|
||||
|
||||
set_global_assignment -name USE_CONFIGURATION_DEVICE ON
|
||||
|
@ -185,15 +179,15 @@ set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE EPCS16
|
|||
set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
|
||||
set_global_assignment -name VERILOG_SHOW_LMF_MAPPING_MESSAGES OFF
|
||||
|
||||
set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS ON
|
||||
set_global_assignment -name SMART_RECOMPILE OFF
|
||||
set_global_assignment -name TIMING_ANALYZER_MULTICORNER_ANALYSIS ON
|
||||
set_global_assignment -name SMART_RECOMPILE ON
|
||||
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT NORMAL
|
||||
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC OFF
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION OFF
|
||||
|
||||
set_global_assignment -name OPTIMIZATION_MODE BALANCED
|
||||
set_global_assignment -name OPTIMIZATION_MODE "AGGRESSIVE PERFORMANCE"
|
||||
set_global_assignment -name ALLOW_REGISTER_RETIMING OFF
|
||||
|
||||
set_global_assignment -name ENABLE_OCT_DONE OFF
|
||||
|
@ -211,25 +205,46 @@ set_global_assignment -name DEVICE_FILTER_PIN_COUNT 144
|
|||
set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE 50%
|
||||
|
||||
|
||||
|
||||
#set_location_assignment PLL_4 -to "scanconverter:scanconverter_inst|pll_3x:pll_linetriple|altpll:altpll_component|pll_3x_altpll:auto_generated|pll1"
|
||||
#set_location_assignment PLL_3 -to "scanconverter:scanconverter_inst|pll_3x_lowfreq:pll_linetriple_lowfreq|altpll:altpll_component|pll_3x_lowfreq_altpll:auto_generated|pll1"
|
||||
#set_location_assignment PLL_1 -to "scanconverter:scanconverter_inst|pll_2x:pll_linedouble|altpll:altpll_component|pll_2x_altpll:auto_generated|pll1"
|
||||
|
||||
|
||||
set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON
|
||||
set_global_assignment -name PLACEMENT_EFFORT_MULTIPLIER 8.0
|
||||
set_global_assignment -name ROUTER_EFFORT_MULTIPLIER 2.0
|
||||
set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE SPEED
|
||||
set_global_assignment -name ENABLE_SIGNALTAP OFF
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE output_files/ossc_la.stp
|
||||
|
||||
set_global_assignment -name FITTER_EFFORT "AUTO FIT"
|
||||
set_global_assignment -name SEED 2
|
||||
|
||||
|
||||
|
||||
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_BD[0]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_BD[3]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_BD[7]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_GD[7]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[1]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[5]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[7]
|
||||
set_global_assignment -name VERILOG_FILE rtl/videogen.v
|
||||
set_global_assignment -name QIP_FILE software/sys_controller/mem_init/meminit.qip
|
||||
set_global_assignment -name VERILOG_FILE rtl/ir_rcv.v
|
||||
set_global_assignment -name SDC_FILE ossc.sdc
|
||||
set_global_assignment -name QSYS_FILE sys.qsys
|
||||
set_global_assignment -name VERILOG_FILE rtl/ossc.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/scanconverter.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/lat_tester.v
|
||||
set_global_assignment -name QIP_FILE sys/synthesis/sys.qip
|
||||
set_global_assignment -name QIP_FILE software/sys_controller/mem_init/meminit.qip
|
||||
set_global_assignment -name QIP_FILE rtl/linebuf.qip
|
||||
set_global_assignment -name QIP_FILE rtl/char_rom.qip
|
||||
set_global_assignment -name QIP_FILE rtl/pll_2x.qip
|
||||
set_global_assignment -name QIP_FILE rtl/pll_3x.qip
|
||||
set_global_assignment -name QIP_FILE rtl/pll_3x_lowfreq.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_hybr_ref_pre.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_hybr_ref.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_sl.qip
|
||||
set_global_assignment -name SDC_FILE ossc.sdc
|
||||
set_global_assignment -name CDF_FILE output_files/Chain1.cdf
|
||||
|
||||
|
||||
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/ossc_la.stp
|
||||
set_global_assignment -name QIP_FILE rtl/char_array.qip
|
||||
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
128
ossc.sdc
128
ossc.sdc
|
@ -2,90 +2,92 @@
|
|||
|
||||
create_clock -period 27MHz -name clk27 [get_ports clk27]
|
||||
|
||||
set_input_delay -clock clk27 0 [get_ports {sda scl ir_rx HDMI_TX_INT_N SD_CMD SD_DAT* btn* *ALTERA_DATA0}]
|
||||
set_input_delay -clock clk27 0 [get_ports {sda scl SD_CMD SD_DAT* *ALTERA_DATA0}]
|
||||
set_false_path -from [get_ports {btn* ir_rx HDMI_TX_INT_N HDMI_TX_MODE}]
|
||||
set_false_path -to {sys:sys_inst|sys_pio_1:pio_1|readdata*}
|
||||
|
||||
|
||||
### Scanconverter clock constraints ###
|
||||
|
||||
create_clock -period 108MHz -name pclk_hdtv [get_ports PCLK_in]
|
||||
create_clock -period 27MHz -name pclk_ldtv_hs_M0 [get_ports PCLK_in] -add
|
||||
create_clock -period 20MHz -name pclk_ldtv_hs_M1 [get_ports PCLK_in] -add
|
||||
create_clock -period 13.5MHz -name pclk_sdtv [get_ports PCLK_in] -add
|
||||
create_clock -period 6.7MHz -name pclk_ldtv_M2 [get_ports PCLK_in] -add
|
||||
create_clock -period 5.4MHz -name pclk_ldtv_M3 [get_ports PCLK_in] -add
|
||||
create_clock -period 108MHz -name pclk_1x [get_ports PCLK_in]
|
||||
create_clock -period 54MHz -name pclk_2x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 54MHz -name pclk_3x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 33MHz -name pclk_4x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 33MHz -name pclk_5x_source [get_ports PCLK_in] -add
|
||||
|
||||
#derive_pll_clocks
|
||||
create_generated_clock -master_clock pclk_sdtv -source {scanconverter_inst|pll_linedouble|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 2 -duty_cycle 50.00 -name pclk_2x {scanconverter_inst|pll_linedouble|altpll_component|auto_generated|pll1|clk[0]}
|
||||
create_generated_clock -master_clock pclk_ldtv_hs_M0 -source {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 3 -duty_cycle 50.00 -name pclk_3x_M0 {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|clk[0]}
|
||||
create_generated_clock -master_clock pclk_ldtv_hs_M1 -source {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 3 -duty_cycle 50.00 -name pclk_3x_M1 {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -master_clock pclk_ldtv_hs_M1 -source {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 4 -duty_cycle 50.00 -name pclk_4x_M1 {scanconverter_inst|pll_linetriple|altpll_component|auto_generated|pll1|clk[1]}
|
||||
create_generated_clock -master_clock pclk_ldtv_M2 -source {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 3 -duty_cycle 50.00 -name pclk_3x_h1x_M2 {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|clk[0]}
|
||||
create_generated_clock -master_clock pclk_ldtv_M2 -source {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 12 -duty_cycle 50.00 -name pclk_3x_h4x_M2 {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|clk[1]}
|
||||
create_generated_clock -master_clock pclk_ldtv_M3 -source {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 3 -duty_cycle 50.00 -name pclk_3x_h1x_M3 {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -master_clock pclk_ldtv_M3 -source {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 15 -duty_cycle 50.00 -name pclk_3x_h5x_M3 {scanconverter_inst|pll_linetriple_lowfreq|altpll_component|auto_generated|pll1|clk[2]}
|
||||
create_generated_clock -name pclk_2x -master_clock pclk_2x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 2 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -name pclk_3x -master_clock pclk_3x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 3 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -name pclk_4x -master_clock pclk_4x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 4 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[1]} -add
|
||||
create_generated_clock -name pclk_5x -master_clock pclk_5x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 5 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[1]} -add
|
||||
create_generated_clock -name pclk_27mhz -master_clock clk27 -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 1 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
|
||||
# retrieve post-mapping clkmux output pin
|
||||
set clkmux_output [get_pins scanconverter_inst|clkctrl1|outclk]
|
||||
|
||||
# specify postmux clocks which clock postprocess pipeline
|
||||
create_generated_clock -name pclk_1x_postmux -master_clock pclk_1x -source [get_pins scanconverter_inst|clkctrl1|inclk[0]] -multiply_by 1 $clkmux_output
|
||||
create_generated_clock -name pclk_2x_postmux -master_clock pclk_2x -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_3x_postmux -master_clock pclk_3x -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_4x_postmux -master_clock pclk_4x -source [get_pins scanconverter_inst|clkctrl1|inclk[3]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_5x_postmux -master_clock pclk_5x -source [get_pins scanconverter_inst|clkctrl1|inclk[3]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_27mhz_postmux -master_clock pclk_27mhz -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
|
||||
# specify output clocks that drive PCLK output pin
|
||||
set pclk_out_port [get_ports HDMI_TX_PCLK]
|
||||
create_generated_clock -name pclk_1x_out -master_clock pclk_1x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port
|
||||
create_generated_clock -name pclk_2x_out -master_clock pclk_2x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_3x_out -master_clock pclk_3x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_4x_out -master_clock pclk_4x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_5x_out -master_clock pclk_5x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_27mhz_out -master_clock pclk_27mhz_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
|
||||
derive_clock_uncertainty
|
||||
|
||||
# input delay constraints
|
||||
set critinputs [get_ports {R_in* G_in* B_in* FID_in HSYNC_in VSYNC_in}]
|
||||
set_input_delay -clock pclk_sdtv -min 0 $critinputs
|
||||
set_input_delay -clock pclk_sdtv -max 1.5 $critinputs
|
||||
set_input_delay -clock pclk_hdtv -min 0 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_hdtv -max 1.5 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_M2 -min 0 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_M2 -max 1.5 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_M3 -min 0 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_M3 -max 1.5 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_hs_M0 -min 0 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_hs_M0 -max 1.5 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_hs_M1 -min 0 $critinputs -add_delay
|
||||
set_input_delay -clock pclk_ldtv_hs_M1 -max 1.5 $critinputs -add_delay
|
||||
set TVP_dmin 0
|
||||
set TVP_dmax 1.5
|
||||
set critinputs [get_ports {R_in* G_in* B_in* HSYNC_in VSYNC_in FID_in}]
|
||||
foreach_in_collection c [get_clocks "pclk_1x pclk_*_source"] {
|
||||
set_input_delay -clock $c -min $TVP_dmin $critinputs -add_delay
|
||||
set_input_delay -clock $c -max $TVP_dmax $critinputs -add_delay
|
||||
}
|
||||
|
||||
# output delay constraints (TODO: add vsync)
|
||||
set critoutputs_hdmi {HDMI_TX_RD* HDMI_TX_GD* HDMI_TX_BD* HDMI_TX_DE HDMI_TX_HS}
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_hdtv 0 $critoutputs_hdmi
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_2x 0 $critoutputs_hdmi -add_delay
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_3x_M0 0 $critoutputs_hdmi -add_delay
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_4x_M1 0 $critoutputs_hdmi -add_delay
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_3x_h4x_M2 0 $critoutputs_hdmi -add_delay
|
||||
set_output_delay -reference_pin HDMI_TX_PCLK -clock pclk_3x_h5x_M3 0 $critoutputs_hdmi -add_delay
|
||||
# output delay constraints as documented in the IT6613 datasheet
|
||||
# -- increased IT_Tsu from 1.0 to 1.5 due to #52
|
||||
set IT_Tsu 1.5
|
||||
set IT_Th -0.5
|
||||
set critoutputs_hdmi [get_ports {HDMI_TX_RD* HDMI_TX_GD* HDMI_TX_BD* HDMI_TX_DE HDMI_TX_HS HDMI_TX_VS}]
|
||||
foreach_in_collection c [get_clocks pclk_*_out] {
|
||||
set_output_delay -clock $c -min $IT_Th $critoutputs_hdmi -add
|
||||
set_output_delay -clock $c -max $IT_Tsu $critoutputs_hdmi -add
|
||||
}
|
||||
set_false_path -to [remove_from_collection [all_outputs] $critoutputs_hdmi]
|
||||
|
||||
|
||||
### CPU/scanconverter clock relations ###
|
||||
|
||||
# Set pixel clocks as exclusive clocks
|
||||
set_clock_groups -exclusive \
|
||||
-group {pclk_hdtv} \
|
||||
-group {pclk_sdtv pclk_2x} \
|
||||
-group {pclk_ldtv_hs_M0 pclk_3x_M0} \
|
||||
-group {pclk_ldtv_hs_M1 pclk_3x_M1 pclk_4x_M1} \
|
||||
-group {pclk_ldtv_M2 pclk_3x_h1x_M2 pclk_3x_h4x_M2} \
|
||||
-group {pclk_ldtv_M3 pclk_3x_h1x_M3 pclk_3x_h5x_M3}
|
||||
|
||||
# Treat CPU clock asynchronous to pixel clocks
|
||||
set_clock_groups -asynchronous -group {clk27}
|
||||
set_clock_groups -asynchronous -group \
|
||||
{clk27 pclk_27mhz pclk_27mhz_postmux pclk_27mhz_out} \
|
||||
{pclk_1x pclk_1x_postmux pclk_1x_out} \
|
||||
{pclk_2x_source pclk_2x pclk_2x_postmux pclk_2x_out} \
|
||||
{pclk_3x_source pclk_3x pclk_3x_postmux pclk_3x_out} \
|
||||
{pclk_4x_source pclk_4x pclk_4x_postmux pclk_4x_out} \
|
||||
{pclk_5x_source pclk_5x pclk_5x_postmux pclk_5x_out}
|
||||
|
||||
# Filter out impossible output mux combinations
|
||||
set clkmuxregs [get_cells {scanconverter:scanconverter_inst|R_out[*] scanconverter:scanconverter_inst|G_out[*] scanconverter:scanconverter_inst|B_out[*] scanconverter:scanconverter_inst|HSYNC_out scanconverter:scanconverter_inst|DATA_enable scanconverter:scanconverter_inst|*_pp1*}]
|
||||
set clkmuxnodes [get_pins {scanconverter_inst|linebuf_*|altsyncram_*|auto_generated|ram_*|portbaddr*}]
|
||||
set_false_path -from [get_clocks {pclk_ldtv* pclk_sdtv}] -through $clkmuxregs
|
||||
set_false_path -from pclk_3x_M1 -through [remove_from_collection $clkmuxregs {scanconverter:scanconverter_inst|DATA_enable_pp1* scanconverter:scanconverter_inst|HSYNC_pp1*}] -to pclk_4x_M1
|
||||
set_false_path -from pclk_3x_M1 -through $clkmuxnodes -to pclk_4x_M1
|
||||
# Ignore paths from registers which are updated only at leading edge of vsync
|
||||
set_false_path -from [get_registers {scanconverter_inst|H_* scanconverter_inst|V_* scanconverter_inst|X_* scanconverter_inst|SL_* scanconverter_inst|LT_POS_*}]
|
||||
|
||||
# Ignore paths from registers which are updated only at the end of vsync
|
||||
set_false_path -from [get_cells {scanconverter_inst|H_* scanconverter_inst|V_* scanconverter:scanconverter_inst|lines_*}]
|
||||
# Ignore paths from registers which are updated only at leading edge of hsync
|
||||
#set_false_path -from [get_registers {scanconverter:scanconverter_inst|line_idx scanconverter:scanconverter_inst|line_out_idx* scanconverter:scanconverter_inst|hmax*}]
|
||||
|
||||
# Ignore paths from registers which are updated only at the end of hsync
|
||||
set_false_path -from [get_cells {scanconverter:scanconverter_inst|vcnt_* scanconverter:scanconverter_inst|line_idx}]
|
||||
# Ignore paths that cross clock domains from 3x to 2x and 5x to 4x, since they share a clock line, but cannot co-occur.
|
||||
set_false_path -from [get_clocks {pclk_3x*}] -to [get_registers {scanconverter:scanconverter_inst|*_2x*}]
|
||||
set_false_path -from [get_clocks {pclk_5x*}] -to [get_registers {scanconverter:scanconverter_inst|*_4x*}]
|
||||
|
||||
# Ignore following clock transfers
|
||||
set_false_path -from [get_clocks pclk_2x] -to [get_clocks pclk_sdtv]
|
||||
set_false_path -from [get_clocks pclk_3x_M*] -to [get_clocks {pclk_ldtv_hs_M*}]
|
||||
set_false_path -from [get_clocks pclk_4x_M1] -to [get_clocks {pclk_ldtv_hs_M1 pclk_3x_M1}]
|
||||
set_false_path -from [get_clocks pclk_3x_h4x_M2] -to [get_clocks {pclk_ldtv_M2 pclk_3x_h1x_M2}]
|
||||
set_false_path -from [get_clocks pclk_3x_h5x_M3] -to [get_clocks {pclk_ldtv_M3 pclk_3x_h1x_M3}]
|
||||
set_false_path -from [get_clocks pclk_3x_h1x_M*] -to [get_clocks {pclk_ldtv_M*}]
|
||||
# Ignore paths to latency tester sync regs
|
||||
set_false_path -to [get_registers {lat_tester:lt0|mode_synced* lat_tester:lt0|VSYNC_in_* lat_tester:lt0|trigger_*}]
|
||||
|
||||
|
||||
### JTAG Signal Constraints ###
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Workspace Name="ossc" Database="">
|
||||
<CodeLite_Workspace Name="ossc" Database="" Version="10.0.0">
|
||||
<Project Name="ossc_rtl" Path="ossc_rtl.project" Active="No"/>
|
||||
<Project Name="ossc_sw_bsp" Path="ossc_sw_bsp.project" Active="No"/>
|
||||
<Project Name="ossc_sw" Path="software/ossc_sw.project" Active="Yes"/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Project Name="ossc_rtl" InternalType="">
|
||||
<CodeLite_Project Name="ossc_rtl" InternalType="" Version="11000">
|
||||
<VirtualDirectory Name="ip">
|
||||
<VirtualDirectory Name="nios2_hw_crc">
|
||||
<VirtualDirectory Name="hdl">
|
||||
|
@ -24,6 +24,23 @@
|
|||
</VirtualDirectory>
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
<VirtualDirectory Name="rtl">
|
||||
<File Name="rtl/ir_rcv.v"/>
|
||||
<File Name="rtl/ossc.v"/>
|
||||
<File Name="rtl/pll_2x.v"/>
|
||||
<File Name="rtl/pll_3x_lowfreq.v"/>
|
||||
<File Name="rtl/pll_3x_lowfreq_bb.v"/>
|
||||
<File Name="rtl/linebuf_inst.v"/>
|
||||
<File Name="rtl/videogen.v"/>
|
||||
<File Name="rtl/timescale.v"/>
|
||||
<File Name="rtl/pll_2x_bb.v"/>
|
||||
<File Name="rtl/linebuf.v"/>
|
||||
<File Name="rtl/pll_3x.v"/>
|
||||
<File Name="rtl/scanconverter.v"/>
|
||||
<File Name="rtl/linebuf_bb.v"/>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="Debug"/>
|
||||
<Dependencies Name="Release"/>
|
||||
<Settings Type="Dynamic Library">
|
||||
<GlobalSettings>
|
||||
<Compiler Options="" C_Options="" Assembler="">
|
||||
|
@ -41,6 +58,7 @@
|
|||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -79,6 +97,7 @@
|
|||
<Linker Options="-O2" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -111,21 +130,4 @@
|
|||
</Completion>
|
||||
</Configuration>
|
||||
</Settings>
|
||||
<VirtualDirectory Name="rtl">
|
||||
<File Name="rtl/ir_rcv.v"/>
|
||||
<File Name="rtl/ossc.v"/>
|
||||
<File Name="rtl/pll_2x.v"/>
|
||||
<File Name="rtl/pll_3x_lowfreq.v"/>
|
||||
<File Name="rtl/pll_3x_lowfreq_bb.v"/>
|
||||
<File Name="rtl/linebuf_inst.v"/>
|
||||
<File Name="rtl/videogen.v"/>
|
||||
<File Name="rtl/timescale.v"/>
|
||||
<File Name="rtl/pll_2x_bb.v"/>
|
||||
<File Name="rtl/linebuf.v"/>
|
||||
<File Name="rtl/pll_3x.v"/>
|
||||
<File Name="rtl/scanconverter.v"/>
|
||||
<File Name="rtl/linebuf_bb.v"/>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="Debug"/>
|
||||
<Dependencies Name="Release"/>
|
||||
</CodeLite_Project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Project Name="ossc_sw_bsp" InternalType="">
|
||||
<CodeLite_Project Name="ossc_sw_bsp" InternalType="" Version="11000">
|
||||
<Plugins>
|
||||
<Plugin Name="qmake">
|
||||
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
|
||||
|
@ -26,24 +26,41 @@
|
|||
}]]]>
|
||||
</Plugin>
|
||||
</Plugins>
|
||||
<Reconciliation>
|
||||
<Regexes/>
|
||||
<Excludepaths/>
|
||||
<Ignorefiles/>
|
||||
<Extensions>
|
||||
<![CDATA[*.cpp;*.c;*.h;*.hpp;*.xrc;*.wxcp;*.fbp]]>
|
||||
</Extensions>
|
||||
<Topleveldir>/home/markus/Code/ossc/software</Topleveldir>
|
||||
</Reconciliation>
|
||||
<VirtualDirectory Name="software">
|
||||
<VirtualDirectory Name="sys_controller_bsp">
|
||||
<VirtualDirectory Name="drivers">
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_epcq_controller2_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_epcq_controller2.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/pll_reconfig_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/osd_generator_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/sc_config_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_timer_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_timer.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_jtag_uart.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_jtag_uart_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/ci_crc.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/crc.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_epcq_controller_mod_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_jtag_uart_fd.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_epcq_controller_mod.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/i2c_opencores_regs.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/i2c_opencores.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/Altera_UP_SD_Card_Avalon_Interface_mod.h"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/inc/altera_avalon_pio_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_epcq_controller_mod.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_epcq_controller2.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_avalon_timer_vars.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_avalon_timer_ts.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_avalon_timer_sc.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_avalon_jtag_uart_read.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/altera_avalon_jtag_uart_ioctl.c"/>
|
||||
<File Name="software/sys_controller_bsp/drivers/src/ci_crc.c"/>
|
||||
|
@ -191,62 +208,6 @@
|
|||
<File Name="software/sys_controller_bsp/system.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ip">
|
||||
<VirtualDirectory Name="i2c_opencores">
|
||||
<VirtualDirectory Name="HAL">
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/i2c_opencores/HAL/inc/i2c_opencores.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="ip/i2c_opencores/HAL/src/i2c_opencores.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="Docs">
|
||||
<File Name="ip/i2c_opencores/Docs/I2C_tests.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/i2c_opencores/inc/i2c_opencores_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="nios2_hw_crc">
|
||||
<VirtualDirectory Name="HAL">
|
||||
<VirtualDirectory Name="doc">
|
||||
<File Name="ip/nios2_hw_crc/HAL/doc/crc_main.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/nios2_hw_crc/HAL/inc/ci_crc.h"/>
|
||||
<File Name="ip/nios2_hw_crc/HAL/inc/crc.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="ip/nios2_hw_crc/HAL/src/ci_crc.c"/>
|
||||
<File Name="ip/nios2_hw_crc/HAL/src/crc.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="altera_up_sd_card_avalon_interface_mod">
|
||||
<VirtualDirectory Name="HAL">
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/altera_up_sd_card_avalon_interface_mod/HAL/inc/Altera_UP_SD_Card_Avalon_Interface_mod.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="ip/altera_up_sd_card_avalon_interface_mod/HAL/src/Altera_UP_SD_Card_Avalon_Interface_mod.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="altera_epcq_controller_mod">
|
||||
<VirtualDirectory Name="HAL">
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/altera_epcq_controller_mod/HAL/inc/altera_epcq_controller_mod.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="ip/altera_epcq_controller_mod/HAL/src/altera_epcq_controller_mod.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="ip/altera_epcq_controller_mod/inc/altera_epcq_controller_mod_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
<Dependencies Name="Debug"/>
|
||||
|
@ -268,6 +229,7 @@
|
|||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -281,7 +243,7 @@
|
|||
<CustomBuild Enabled="yes">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>nios2-bsp-generate-files --bsp-dir . --settings settings.bsp</BuildCommand>
|
||||
<BuildCommand>make</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
|
@ -306,6 +268,7 @@
|
|||
<Linker Options="-O2" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -319,7 +282,7 @@
|
|||
<CustomBuild Enabled="yes">
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>nios2-bsp-generate-files --bsp-dir ./ --settings settings.bsp</BuildCommand>
|
||||
<BuildCommand>make</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "ALTPLL"
|
||||
set_global_assignment -name IP_TOOL_VERSION "15.1"
|
||||
set_global_assignment -name IP_TOOL_NAME "RAM: 2-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll_3x_lowfreq.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_3x_lowfreq_bb.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_3x_lowfreq.ppf"]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "char_array.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_array_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_array_bb.v"]
|
223
rtl/char_array.v
Normal file
223
rtl/char_array.v
Normal file
|
@ -0,0 +1,223 @@
|
|||
// megafunction wizard: %RAM: 2-PORT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: altsyncram
|
||||
|
||||
// ============================================================
|
||||
// File Name: char_array.v
|
||||
// Megafunction Name(s):
|
||||
// altsyncram
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// altera_mf
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module char_array (
|
||||
byteena_a,
|
||||
data,
|
||||
rdaddress,
|
||||
rdclock,
|
||||
wraddress,
|
||||
wrclock,
|
||||
wren,
|
||||
q);
|
||||
|
||||
input [3:0] byteena_a;
|
||||
input [31:0] data;
|
||||
input [9:0] rdaddress;
|
||||
input rdclock;
|
||||
input [7:0] wraddress;
|
||||
input wrclock;
|
||||
input wren;
|
||||
output [7:0] q;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri1 [3:0] byteena_a;
|
||||
tri1 wrclock;
|
||||
tri0 wren;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
`endif
|
||||
|
||||
wire [7:0] sub_wire0;
|
||||
wire [7:0] q = sub_wire0[7:0];
|
||||
|
||||
altsyncram altsyncram_component (
|
||||
.address_a (wraddress),
|
||||
.address_b (rdaddress),
|
||||
.byteena_a (byteena_a),
|
||||
.clock0 (wrclock),
|
||||
.clock1 (rdclock),
|
||||
.data_a (data),
|
||||
.wren_a (wren),
|
||||
.q_b (sub_wire0),
|
||||
.aclr0 (1'b0),
|
||||
.aclr1 (1'b0),
|
||||
.addressstall_a (1'b0),
|
||||
.addressstall_b (1'b0),
|
||||
.byteena_b (1'b1),
|
||||
.clocken0 (1'b1),
|
||||
.clocken1 (1'b1),
|
||||
.clocken2 (1'b1),
|
||||
.clocken3 (1'b1),
|
||||
.data_b ({8{1'b1}}),
|
||||
.eccstatus (),
|
||||
.q_a (),
|
||||
.rden_a (1'b1),
|
||||
.rden_b (1'b1),
|
||||
.wren_b (1'b0));
|
||||
defparam
|
||||
altsyncram_component.address_aclr_b = "NONE",
|
||||
altsyncram_component.address_reg_b = "CLOCK1",
|
||||
altsyncram_component.byte_size = 8,
|
||||
altsyncram_component.clock_enable_input_a = "BYPASS",
|
||||
altsyncram_component.clock_enable_input_b = "BYPASS",
|
||||
altsyncram_component.clock_enable_output_b = "BYPASS",
|
||||
altsyncram_component.intended_device_family = "Cyclone IV E",
|
||||
altsyncram_component.lpm_type = "altsyncram",
|
||||
altsyncram_component.numwords_a = 256,
|
||||
altsyncram_component.numwords_b = 1024,
|
||||
altsyncram_component.operation_mode = "DUAL_PORT",
|
||||
altsyncram_component.outdata_aclr_b = "NONE",
|
||||
altsyncram_component.outdata_reg_b = "CLOCK1",
|
||||
altsyncram_component.power_up_uninitialized = "FALSE",
|
||||
altsyncram_component.widthad_a = 8,
|
||||
altsyncram_component.widthad_b = 10,
|
||||
altsyncram_component.width_a = 32,
|
||||
altsyncram_component.width_b = 8,
|
||||
altsyncram_component.width_byteena_a = 4;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRdata NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRq NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRrren NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRwraddress NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRwren NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Clock NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Clock_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Clock_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_B"
|
||||
// Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
|
||||
// Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: MEMSIZE NUMERIC "8192"
|
||||
// Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: MIFfilename STRING ""
|
||||
// Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "2"
|
||||
// Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2"
|
||||
// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3"
|
||||
// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3"
|
||||
// Retrieval info: PRIVATE: REGdata NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: REGq NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: REGrdaddress NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: REGrren NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: REGwraddress NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: REGwren NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: UseDPRAM NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: VarWidth NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "32"
|
||||
// Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "32"
|
||||
// Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: enable NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: ADDRESS_ACLR_B STRING "NONE"
|
||||
// Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK1"
|
||||
// Retrieval info: CONSTANT: BYTE_SIZE NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
// Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256"
|
||||
// Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "1024"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "DUAL_PORT"
|
||||
// Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE"
|
||||
// Retrieval info: CONSTANT: OUTDATA_REG_B STRING "CLOCK1"
|
||||
// Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE"
|
||||
// Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "10"
|
||||
// Retrieval info: CONSTANT: WIDTH_A NUMERIC "32"
|
||||
// Retrieval info: CONSTANT: WIDTH_B NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "4"
|
||||
// Retrieval info: USED_PORT: byteena_a 0 0 4 0 INPUT VCC "byteena_a[3..0]"
|
||||
// Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..0]"
|
||||
// Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
|
||||
// Retrieval info: USED_PORT: rdaddress 0 0 10 0 INPUT NODEFVAL "rdaddress[9..0]"
|
||||
// Retrieval info: USED_PORT: rdclock 0 0 0 0 INPUT NODEFVAL "rdclock"
|
||||
// Retrieval info: USED_PORT: wraddress 0 0 8 0 INPUT NODEFVAL "wraddress[7..0]"
|
||||
// Retrieval info: USED_PORT: wrclock 0 0 0 0 INPUT VCC "wrclock"
|
||||
// Retrieval info: USED_PORT: wren 0 0 0 0 INPUT GND "wren"
|
||||
// Retrieval info: CONNECT: @address_a 0 0 8 0 wraddress 0 0 8 0
|
||||
// Retrieval info: CONNECT: @address_b 0 0 10 0 rdaddress 0 0 10 0
|
||||
// Retrieval info: CONNECT: @byteena_a 0 0 4 0 byteena_a 0 0 4 0
|
||||
// Retrieval info: CONNECT: @clock0 0 0 0 0 wrclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @clock1 0 0 0 0 rdclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @data_a 0 0 32 0 data 0 0 32 0
|
||||
// Retrieval info: CONNECT: @wren_a 0 0 0 0 wren 0 0 0 0
|
||||
// Retrieval info: CONNECT: q 0 0 8 0 @q_b 0 0 8 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
6
rtl/char_rom.qip
Normal file
6
rtl/char_rom.qip
Normal file
|
@ -0,0 +1,6 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "char_rom.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_rom_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_rom_bb.v"]
|
165
rtl/char_rom.v
Normal file
165
rtl/char_rom.v
Normal file
|
@ -0,0 +1,165 @@
|
|||
// megafunction wizard: %ROM: 1-PORT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: altsyncram
|
||||
|
||||
// ============================================================
|
||||
// File Name: char_rom.v
|
||||
// Megafunction Name(s):
|
||||
// altsyncram
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// altera_mf
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module char_rom (
|
||||
address,
|
||||
clock,
|
||||
q);
|
||||
|
||||
input [7:0] address;
|
||||
input clock;
|
||||
output [63:0] q;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri1 clock;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
`endif
|
||||
|
||||
wire [63:0] sub_wire0;
|
||||
wire [63:0] q = sub_wire0[63:0];
|
||||
|
||||
altsyncram altsyncram_component (
|
||||
.address_a (address),
|
||||
.clock0 (clock),
|
||||
.q_a (sub_wire0),
|
||||
.aclr0 (1'b0),
|
||||
.aclr1 (1'b0),
|
||||
.address_b (1'b1),
|
||||
.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_a ({64{1'b1}}),
|
||||
.data_b (1'b1),
|
||||
.eccstatus (),
|
||||
.q_b (),
|
||||
.rden_a (1'b1),
|
||||
.rden_b (1'b1),
|
||||
.wren_a (1'b0),
|
||||
.wren_b (1'b0));
|
||||
defparam
|
||||
altsyncram_component.address_aclr_a = "NONE",
|
||||
altsyncram_component.clock_enable_input_a = "BYPASS",
|
||||
altsyncram_component.clock_enable_output_a = "BYPASS",
|
||||
`ifdef NO_PLI
|
||||
altsyncram_component.init_file = "./ip/osd_generator/bin/char_rom.rif"
|
||||
`else
|
||||
altsyncram_component.init_file = "./ip/osd_generator/bin/char_rom.hex"
|
||||
`endif
|
||||
,
|
||||
altsyncram_component.intended_device_family = "Cyclone IV E",
|
||||
altsyncram_component.lpm_hint = "ENABLE_RUNTIME_MOD=NO",
|
||||
altsyncram_component.lpm_type = "altsyncram",
|
||||
altsyncram_component.numwords_a = 256,
|
||||
altsyncram_component.operation_mode = "ROM",
|
||||
altsyncram_component.outdata_aclr_a = "NONE",
|
||||
altsyncram_component.outdata_reg_a = "CLOCK0",
|
||||
altsyncram_component.widthad_a = 8,
|
||||
altsyncram_component.width_a = 64,
|
||||
altsyncram_component.width_byteena_a = 1;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: AclrAddr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: AclrByte NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: AclrOutput NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: BlankMemory NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: Clken NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
|
||||
// Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
|
||||
// Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: MIFfilename STRING "./ip/osd_generator/bin/char_rom.hex"
|
||||
// Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "256"
|
||||
// Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: RegAddr NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: RegOutput NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: SingleClock NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: UseDQRAM NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WidthAddr NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthData NUMERIC "64"
|
||||
// Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: ADDRESS_ACLR_A STRING "NONE"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: INIT_FILE STRING "./ip/osd_generator/bin/char_rom.hex"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=NO"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
// Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "ROM"
|
||||
// Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
|
||||
// Retrieval info: CONSTANT: OUTDATA_REG_A STRING "CLOCK0"
|
||||
// Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: WIDTH_A NUMERIC "64"
|
||||
// Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
|
||||
// Retrieval info: USED_PORT: address 0 0 8 0 INPUT NODEFVAL "address[7..0]"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
|
||||
// Retrieval info: USED_PORT: q 0 0 64 0 OUTPUT NODEFVAL "q[63..0]"
|
||||
// Retrieval info: CONNECT: @address_a 0 0 8 0 address 0 0 8 0
|
||||
// Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: q 0 0 64 0 @q_a 0 0 64 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
18
rtl/ir_rcv.v
18
rtl/ir_rcv.v
|
@ -38,7 +38,7 @@ parameter LEADCODE_HI_TIMEOUT = 160000; //5.9ms
|
|||
parameter LEADCODE_HI_RPT_THOLD = 54000; //2.0ms
|
||||
parameter RPT_RELEASE_THOLD = 3240000; //120ms
|
||||
parameter BIT_ONE_THOLD = 27000; //1.0ms
|
||||
parameter BIT_DETECT_THOLD = 10800; //0.4ms
|
||||
parameter BIT_DETECT_THOLD = 7628; //0.28ms
|
||||
parameter IDLE_THOLD = 141480; //5.24ms
|
||||
|
||||
reg [1:0] state; // 3 states
|
||||
|
@ -49,8 +49,6 @@ reg [17:0] leadvrf_cnt; // max. 9.7ms
|
|||
reg [17:0] datarcv_cnt; // max. 9.7ms
|
||||
reg [21:0] rpt_cnt; // max. 155ms
|
||||
|
||||
reg ir_rx_r;
|
||||
|
||||
// activity when signal is low
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
|
@ -58,7 +56,7 @@ begin
|
|||
act_cnt <= 0;
|
||||
else
|
||||
begin
|
||||
if ((state == `STATE_IDLE) & (~ir_rx_r))
|
||||
if ((state == `STATE_IDLE) & (~ir_rx))
|
||||
act_cnt <= act_cnt + 1'b1;
|
||||
else
|
||||
act_cnt <= 0;
|
||||
|
@ -72,7 +70,7 @@ begin
|
|||
leadvrf_cnt <= 0;
|
||||
else
|
||||
begin
|
||||
if ((state == `STATE_LEADVERIFY) & ir_rx_r)
|
||||
if ((state == `STATE_LEADVERIFY) & ir_rx)
|
||||
leadvrf_cnt <= leadvrf_cnt + 1'b1;
|
||||
else
|
||||
leadvrf_cnt <= 0;
|
||||
|
@ -93,7 +91,7 @@ begin
|
|||
begin
|
||||
if (state == `STATE_DATARCV)
|
||||
begin
|
||||
if (ir_rx_r)
|
||||
if (ir_rx)
|
||||
datarcv_cnt <= datarcv_cnt + 1'b1;
|
||||
else
|
||||
datarcv_cnt <= 0;
|
||||
|
@ -145,17 +143,15 @@ begin
|
|||
state <= `STATE_IDLE;
|
||||
rpt_cnt <= 0;
|
||||
ir_code_cnt <= 0;
|
||||
ir_rx_r <= 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
rpt_cnt <= rpt_cnt + 1'b1;
|
||||
ir_rx_r <= ir_rx;
|
||||
|
||||
case (state)
|
||||
`STATE_IDLE:
|
||||
begin
|
||||
if ((act_cnt >= LEADCODE_LO_THOLD) & ir_rx_r)
|
||||
if ((act_cnt >= LEADCODE_LO_THOLD) & ir_rx)
|
||||
state <= `STATE_LEADVERIFY;
|
||||
if (rpt_cnt >= RPT_RELEASE_THOLD)
|
||||
ir_code_cnt <= 0;
|
||||
|
@ -165,10 +161,10 @@ begin
|
|||
if (leadvrf_cnt == LEADCODE_HI_RPT_THOLD)
|
||||
begin
|
||||
if (ir_code != 0)
|
||||
ir_code_cnt <= ir_code_cnt + 1;
|
||||
ir_code_cnt <= ir_code_cnt + 1'b1;
|
||||
rpt_cnt <= 0;
|
||||
end
|
||||
if (!ir_rx_r)
|
||||
if (!ir_rx)
|
||||
state <= (leadvrf_cnt >= LEADCODE_HI_THOLD) ? `STATE_DATARCV : `STATE_IDLE;
|
||||
else if (leadvrf_cnt >= LEADCODE_HI_TIMEOUT)
|
||||
state <= `STATE_IDLE;
|
||||
|
|
111
rtl/lat_tester.v
Normal file
111
rtl/lat_tester.v
Normal file
|
@ -0,0 +1,111 @@
|
|||
//
|
||||
// Copyright (C) 2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
`define LT_STATE_IDLE 2'h0
|
||||
`define LT_STATE_LAT_MEAS 2'h1
|
||||
`define LT_STATE_STB_MEAS 2'h2
|
||||
`define LT_STATE_FINISHED 2'h3
|
||||
|
||||
module lat_tester (
|
||||
input clk27,
|
||||
input pclk,
|
||||
input active,
|
||||
input armed,
|
||||
input sensor,
|
||||
input trigger,
|
||||
input VSYNC_in,
|
||||
input [1:0] mode_in,
|
||||
output reg [2:0] mode_synced,
|
||||
output reg [15:0] lat_result,
|
||||
output reg [11:0] stb_result,
|
||||
output trig_waiting,
|
||||
output reg finished
|
||||
);
|
||||
|
||||
reg VSYNC_in_L, VSYNC_in_LL, trigger_L, trigger_LL;
|
||||
reg [8:0] clk27_ctr;
|
||||
reg [1:0] state;
|
||||
|
||||
assign trig_waiting = (state == `LT_STATE_LAT_MEAS);
|
||||
|
||||
always @(posedge pclk) begin
|
||||
VSYNC_in_L <= VSYNC_in;
|
||||
VSYNC_in_LL <= VSYNC_in_L;
|
||||
end
|
||||
|
||||
always @(posedge pclk) begin
|
||||
if (VSYNC_in_LL && !VSYNC_in_L)
|
||||
mode_synced <= mode_in;
|
||||
end
|
||||
|
||||
always @(posedge clk27) begin
|
||||
trigger_L <= trigger;
|
||||
trigger_LL <= trigger_L;
|
||||
end
|
||||
|
||||
always @(posedge clk27) begin
|
||||
if (!active) begin
|
||||
state <= `LT_STATE_IDLE;
|
||||
end else begin
|
||||
case (state)
|
||||
default: begin //STATE_IDLE
|
||||
finished <= 1'b0;
|
||||
lat_result <= 0;
|
||||
stb_result <= 0;
|
||||
clk27_ctr <= 0;
|
||||
if (armed && trigger_LL)
|
||||
state <= `LT_STATE_LAT_MEAS;
|
||||
end
|
||||
`LT_STATE_LAT_MEAS: begin
|
||||
if (sensor==0) begin
|
||||
state <= `LT_STATE_STB_MEAS;
|
||||
clk27_ctr <= 0;
|
||||
end else if (lat_result==16'hffff) begin
|
||||
state <= `LT_STATE_FINISHED;
|
||||
end else begin
|
||||
if (clk27_ctr == 270-1) begin
|
||||
clk27_ctr <= 0;
|
||||
lat_result <= lat_result + 1'b1;
|
||||
end else begin
|
||||
clk27_ctr <= clk27_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
`LT_STATE_STB_MEAS: begin
|
||||
if (((sensor==1) && (stb_result >= 12'd100)) || (stb_result == 12'hfff)) begin
|
||||
state <= `LT_STATE_FINISHED;
|
||||
end else begin
|
||||
if (clk27_ctr == 270-1) begin
|
||||
clk27_ctr <= 0;
|
||||
stb_result <= stb_result + 1'b1;
|
||||
end else begin
|
||||
clk27_ctr <= clk27_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
`LT_STATE_FINISHED: begin
|
||||
finished <= 1'b1;
|
||||
if (!armed)
|
||||
state <= `LT_STATE_IDLE;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
26
rtl/lat_tester_includes.v
Normal file
26
rtl/lat_tester_includes.v
Normal file
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// Copyright (C) 2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
`define LT_POS_NONE 2'b00
|
||||
`define LT_POS_TOPLEFT 2'b01
|
||||
`define LT_POS_CENTER 2'b10
|
||||
`define LT_POS_BOTTOMRIGHT 2'b11
|
||||
|
||||
`define LT_WIDTH_DIV 4'h8
|
||||
`define LT_HEIGHT_DIV 4'h8
|
|
@ -1,5 +1,5 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "RAM: 2-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "15.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "linebuf.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "linebuf_inst.v"]
|
||||
|
|
|
@ -14,24 +14,24 @@
|
|||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 15.1.0 Build 185 10/21/2015 SJ Lite Edition
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and its AMPP partner logic
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera MegaCore Function License Agreement, or other
|
||||
//applicable license agreement, including, without limitation,
|
||||
//that your use is for the sole purpose of programming logic
|
||||
//devices manufactured by Altera and sold by Altera or its
|
||||
//authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
|
|
5
rtl/lpm_mult_4_hybr_ref.qip
Normal file
5
rtl/lpm_mult_4_hybr_ref.qip
Normal file
|
@ -0,0 +1,5 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_bb.v"]
|
117
rtl/lpm_mult_4_hybr_ref.v
Normal file
117
rtl/lpm_mult_4_hybr_ref.v
Normal file
|
@ -0,0 +1,117 @@
|
|||
// megafunction wizard: %LPM_MULT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_hybr_ref.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// lpm
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_hybr_ref (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
result);
|
||||
|
||||
input clock;
|
||||
input [8:0] dataa;
|
||||
input [7:0] datab;
|
||||
output [8:0] result;
|
||||
|
||||
wire [8:0] sub_wire0;
|
||||
wire [8:0] result = sub_wire0[8:0];
|
||||
|
||||
lpm_mult lpm_mult_component (
|
||||
.clock (clock),
|
||||
.dataa (dataa),
|
||||
.datab (datab),
|
||||
.result (sub_wire0),
|
||||
.aclr (1'b0),
|
||||
.clken (1'b1),
|
||||
.sclr (1'b0),
|
||||
.sum (1'b0));
|
||||
defparam
|
||||
lpm_mult_component.lpm_hint = "MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_pipeline = 1,
|
||||
lpm_mult_component.lpm_representation = "UNSIGNED",
|
||||
lpm_mult_component.lpm_type = "LPM_MULT",
|
||||
lpm_mult_component.lpm_widtha = 9,
|
||||
lpm_mult_component.lpm_widthb = 8,
|
||||
lpm_mult_component.lpm_widthp = 9;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: AutoSizeResult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: B_isConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ConstantB NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Latency NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: SignedMult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: USE_MULT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: ValidConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WidthA NUMERIC "9"
|
||||
// Retrieval info: PRIVATE: WidthB NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthP NUMERIC "9"
|
||||
// Retrieval info: PRIVATE: aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: clken NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: new_diagram STRING "1"
|
||||
// Retrieval info: PRIVATE: optimize NUMERIC "1"
|
||||
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "UNSIGNED"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "9"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "9"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
// Retrieval info: USED_PORT: dataa 0 0 9 0 INPUT NODEFVAL "dataa[8..0]"
|
||||
// Retrieval info: USED_PORT: datab 0 0 8 0 INPUT NODEFVAL "datab[7..0]"
|
||||
// Retrieval info: USED_PORT: result 0 0 9 0 OUTPUT NODEFVAL "result[8..0]"
|
||||
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @dataa 0 0 9 0 dataa 0 0 9 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 8 0 datab 0 0 8 0
|
||||
// Retrieval info: CONNECT: result 0 0 9 0 @result 0 0 9 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: lpm
|
5
rtl/lpm_mult_4_hybr_ref_pre.qip
Normal file
5
rtl/lpm_mult_4_hybr_ref_pre.qip
Normal file
|
@ -0,0 +1,5 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_pre.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_pre_bb.v"]
|
117
rtl/lpm_mult_4_hybr_ref_pre.v
Normal file
117
rtl/lpm_mult_4_hybr_ref_pre.v
Normal file
|
@ -0,0 +1,117 @@
|
|||
// megafunction wizard: %LPM_MULT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_hybr_ref_pre.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// lpm
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_hybr_ref_pre (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
result);
|
||||
|
||||
input clock;
|
||||
input [7:0] dataa;
|
||||
input [4:0] datab;
|
||||
output [8:0] result;
|
||||
|
||||
wire [8:0] sub_wire0;
|
||||
wire [8:0] result = sub_wire0[8:0];
|
||||
|
||||
lpm_mult lpm_mult_component (
|
||||
.clock (clock),
|
||||
.dataa (dataa),
|
||||
.datab (datab),
|
||||
.result (sub_wire0),
|
||||
.aclr (1'b0),
|
||||
.clken (1'b1),
|
||||
.sclr (1'b0),
|
||||
.sum (1'b0));
|
||||
defparam
|
||||
lpm_mult_component.lpm_hint = "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_pipeline = 1,
|
||||
lpm_mult_component.lpm_representation = "UNSIGNED",
|
||||
lpm_mult_component.lpm_type = "LPM_MULT",
|
||||
lpm_mult_component.lpm_widtha = 8,
|
||||
lpm_mult_component.lpm_widthb = 5,
|
||||
lpm_mult_component.lpm_widthp = 9;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: AutoSizeResult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: B_isConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ConstantB NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Latency NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: SignedMult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: USE_MULT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: ValidConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WidthA NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthB NUMERIC "5"
|
||||
// Retrieval info: PRIVATE: WidthP NUMERIC "9"
|
||||
// Retrieval info: PRIVATE: aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: clken NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: new_diagram STRING "1"
|
||||
// Retrieval info: PRIVATE: optimize NUMERIC "1"
|
||||
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "UNSIGNED"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "5"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "9"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
// Retrieval info: USED_PORT: dataa 0 0 8 0 INPUT NODEFVAL "dataa[7..0]"
|
||||
// Retrieval info: USED_PORT: datab 0 0 5 0 INPUT NODEFVAL "datab[4..0]"
|
||||
// Retrieval info: USED_PORT: result 0 0 9 0 OUTPUT NODEFVAL "result[8..0]"
|
||||
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @dataa 0 0 8 0 dataa 0 0 8 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 5 0 datab 0 0 5 0
|
||||
// Retrieval info: CONNECT: result 0 0 9 0 @result 0 0 9 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: lpm
|
|
@ -1,5 +1,5 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "ALTPLL"
|
||||
set_global_assignment -name IP_TOOL_VERSION "15.1"
|
||||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll_3x.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_3x.ppf"]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_sl.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_sl_bb.v"]
|
117
rtl/lpm_mult_4_sl.v
Normal file
117
rtl/lpm_mult_4_sl.v
Normal file
|
@ -0,0 +1,117 @@
|
|||
// megafunction wizard: %LPM_MULT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_sl.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// lpm
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_sl (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
result);
|
||||
|
||||
input clock;
|
||||
input [7:0] dataa;
|
||||
input [7:0] datab;
|
||||
output [7:0] result;
|
||||
|
||||
wire [7:0] sub_wire0;
|
||||
wire [7:0] result = sub_wire0[7:0];
|
||||
|
||||
lpm_mult lpm_mult_component (
|
||||
.clock (clock),
|
||||
.dataa (dataa),
|
||||
.datab (datab),
|
||||
.result (sub_wire0),
|
||||
.aclr (1'b0),
|
||||
.clken (1'b1),
|
||||
.sclr (1'b0),
|
||||
.sum (1'b0));
|
||||
defparam
|
||||
lpm_mult_component.lpm_hint = "MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_pipeline = 1,
|
||||
lpm_mult_component.lpm_representation = "UNSIGNED",
|
||||
lpm_mult_component.lpm_type = "LPM_MULT",
|
||||
lpm_mult_component.lpm_widtha = 8,
|
||||
lpm_mult_component.lpm_widthb = 8,
|
||||
lpm_mult_component.lpm_widthp = 8;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: AutoSizeResult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: B_isConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ConstantB NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Latency NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: SignedMult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: USE_MULT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: ValidConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WidthA NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthB NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthP NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: clken NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: new_diagram STRING "1"
|
||||
// Retrieval info: PRIVATE: optimize NUMERIC "1"
|
||||
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "UNSIGNED"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "8"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
// Retrieval info: USED_PORT: dataa 0 0 8 0 INPUT NODEFVAL "dataa[7..0]"
|
||||
// Retrieval info: USED_PORT: datab 0 0 8 0 INPUT NODEFVAL "datab[7..0]"
|
||||
// Retrieval info: USED_PORT: result 0 0 8 0 OUTPUT NODEFVAL "result[7..0]"
|
||||
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @dataa 0 0 8 0 dataa 0 0 8 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 8 0 datab 0 0 8 0
|
||||
// Retrieval info: CONNECT: result 0 0 8 0 @result 0 0 8 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: lpm
|
390
rtl/ossc.v
390
rtl/ossc.v
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
|
@ -18,7 +18,7 @@
|
|||
//
|
||||
|
||||
//`define DEBUG
|
||||
`define VIDEOGEN
|
||||
`define PO_RESET_WIDTH 27 //1us
|
||||
|
||||
module ossc (
|
||||
input clk27,
|
||||
|
@ -33,16 +33,16 @@ module ossc (
|
|||
input VSYNC_in,
|
||||
input HSYNC_in,
|
||||
input PCLK_in,
|
||||
output [7:0] HDMI_TX_RD,
|
||||
output [7:0] HDMI_TX_GD,
|
||||
output [7:0] HDMI_TX_BD,
|
||||
output HDMI_TX_DE,
|
||||
output HDMI_TX_HS,
|
||||
output HDMI_TX_VS,
|
||||
output HDMI_TX_PCLK,
|
||||
output reg [7:0] HDMI_TX_RD,
|
||||
output reg [7:0] HDMI_TX_GD,
|
||||
output reg [7:0] HDMI_TX_BD,
|
||||
output reg HDMI_TX_DE,
|
||||
output reg HDMI_TX_HS,
|
||||
output reg HDMI_TX_VS,
|
||||
input HDMI_TX_INT_N,
|
||||
input HDMI_TX_MODE,
|
||||
output reset_n,
|
||||
output hw_reset_n,
|
||||
output LED_G,
|
||||
output LED_R,
|
||||
output LCD_RS,
|
||||
|
@ -53,146 +53,312 @@ module ossc (
|
|||
inout [3:0] SD_DAT
|
||||
);
|
||||
|
||||
wire cpu_reset_n;
|
||||
wire [7:0] sys_ctrl;
|
||||
wire h_unstable;
|
||||
wire [2:0] pclk_lock;
|
||||
wire [2:0] pll_lock_lost;
|
||||
wire [31:0] h_info;
|
||||
wire [31:0] v_info;
|
||||
wire [10:0] lines_out;
|
||||
|
||||
wire [15:0] sys_ctrl;
|
||||
wire h_unstable, pll_lock_lost;
|
||||
wire [31:0] h_config, h_config2, v_config, misc_config, sl_config, sl_config2;
|
||||
wire [10:0] vmax, vmax_tvp;
|
||||
wire [1:0] fpga_vsyncgen;
|
||||
wire ilace_flag, vsync_flag;
|
||||
wire [19:0] pcnt_frame;
|
||||
|
||||
wire [15:0] ir_code;
|
||||
wire [7:0] ir_code_cnt;
|
||||
|
||||
wire [7:0] R_out, G_out, B_out;
|
||||
wire HSYNC_out;
|
||||
wire VSYNC_out;
|
||||
wire [7:0] R_out_sc, G_out_sc, B_out_sc;
|
||||
wire HSYNC_out_sc;
|
||||
wire VSYNC_out_sc;
|
||||
wire PCLK_out;
|
||||
wire DATA_enable;
|
||||
wire DE_out_sc;
|
||||
|
||||
wire [7:0] R_out_videogen, G_out_videogen, B_out_videogen;
|
||||
wire HSYNC_out_videogen;
|
||||
wire VSYNC_out_videogen;
|
||||
wire PCLK_out_videogen;
|
||||
wire DATA_enable_videogen;
|
||||
wire [7:0] R_out_vg, G_out_vg, B_out_vg;
|
||||
wire HSYNC_out_vg;
|
||||
wire VSYNC_out_vg;
|
||||
wire DE_out_vg;
|
||||
|
||||
wire [7:0] lcd_ctrl;
|
||||
|
||||
reg [3:0] reset_n_ctr;
|
||||
reg reset_n_reg = 1'b1;
|
||||
reg [7:0] po_reset_ctr = 0;
|
||||
reg po_reset_n = 1'b0;
|
||||
wire jtagm_reset_req;
|
||||
wire sys_reset_n = (po_reset_n & ~jtagm_reset_req);
|
||||
|
||||
`ifdef DEBUG
|
||||
assign LED_R = HSYNC_in;
|
||||
assign LED_G = VSYNC_in;
|
||||
`else
|
||||
assign LED_R = (pll_lock_lost != 3'b000)|h_unstable;
|
||||
assign LED_G = (ir_code == 0);
|
||||
`endif
|
||||
reg [7:0] R_in_L, G_in_L, B_in_L;
|
||||
reg HSYNC_in_L, VSYNC_in_L, FID_in_L;
|
||||
|
||||
assign LCD_CS_N = lcd_ctrl[0];
|
||||
assign LCD_RS = lcd_ctrl[1];
|
||||
assign LCD_BL = sys_ctrl[1]; //reset_n in v1.2 PCB
|
||||
reg [1:0] btn_L, btn_LL;
|
||||
reg ir_rx_L, ir_rx_LL, HDMI_TX_INT_N_L, HDMI_TX_INT_N_LL, HDMI_TX_MODE_L, HDMI_TX_MODE_LL;
|
||||
|
||||
assign reset_n = sys_ctrl[0]; //HDMI_TX_RST_N in v1.2 PCB
|
||||
wire lt_sensor = btn_LL[1];
|
||||
wire lt_active = sys_ctrl[15];
|
||||
wire lt_armed = sys_ctrl[14];
|
||||
wire lt_trigger = HDMI_TX_DE & HDMI_TX_GD[0];
|
||||
wire [1:0] lt_mode = sys_ctrl[13:12];
|
||||
wire [1:0] lt_mode_synced;
|
||||
wire [15:0] lt_lat_result;
|
||||
wire [11:0] lt_stb_result;
|
||||
wire lt_trig_waiting;
|
||||
wire lt_finished;
|
||||
|
||||
`ifdef VIDEOGEN
|
||||
wire videogen_sel;
|
||||
assign videogen_sel = ~sys_ctrl[2];
|
||||
assign HDMI_TX_RD = videogen_sel ? R_out_videogen : R_out;
|
||||
assign HDMI_TX_GD = videogen_sel ? G_out_videogen : G_out;
|
||||
assign HDMI_TX_BD = videogen_sel ? B_out_videogen : B_out;
|
||||
assign HDMI_TX_HS = videogen_sel ? HSYNC_out_videogen : HSYNC_out;
|
||||
assign HDMI_TX_VS = videogen_sel ? VSYNC_out_videogen : VSYNC_out;
|
||||
assign HDMI_TX_PCLK = videogen_sel ? PCLK_out_videogen : PCLK_out;
|
||||
assign HDMI_TX_DE = videogen_sel ? DATA_enable_videogen : DATA_enable;
|
||||
`else
|
||||
assign HDMI_TX_RD = R_out;
|
||||
assign HDMI_TX_GD = G_out;
|
||||
assign HDMI_TX_BD = B_out;
|
||||
assign HDMI_TX_HS = HSYNC_out;
|
||||
assign HDMI_TX_VS = VSYNC_out;
|
||||
assign HDMI_TX_PCLK = PCLK_out;
|
||||
assign HDMI_TX_DE = DATA_enable;
|
||||
`endif
|
||||
wire remote_event = sys_ctrl[8];
|
||||
reg remove_event_prev;
|
||||
reg [14:0] to_ctr, to_ctr_ms;
|
||||
wire lcd_bl_timeout;
|
||||
|
||||
always @(posedge clk27)
|
||||
wire [1:0] osd_color;
|
||||
wire osd_enable_pre;
|
||||
wire osd_enable = osd_enable_pre & ~lt_active;
|
||||
wire [10:0] xpos, xpos_sc, xpos_vg;
|
||||
wire [10:0] ypos, ypos_sc, ypos_vg;
|
||||
|
||||
wire pll_areset, pll_scanclk, pll_scanclkena, pll_configupdate, pll_scandata, pll_scandone, pll_activeclock;
|
||||
|
||||
|
||||
// Latch inputs from TVP7002 (synchronized to PCLK_in)
|
||||
always @(posedge PCLK_in or negedge hw_reset_n)
|
||||
begin
|
||||
if (reset_n_ctr == 4'b1000)
|
||||
reset_n_reg <= 1'b1;
|
||||
else
|
||||
begin
|
||||
reset_n_ctr <= reset_n_ctr + 1'b1;
|
||||
reset_n_reg <= 1'b0;
|
||||
end
|
||||
if (!hw_reset_n) begin
|
||||
R_in_L <= 8'h00;
|
||||
G_in_L <= 8'h00;
|
||||
B_in_L <= 8'h00;
|
||||
HSYNC_in_L <= 1'b0;
|
||||
VSYNC_in_L <= 1'b0;
|
||||
FID_in_L <= 1'b0;
|
||||
end else begin
|
||||
R_in_L <= R_in;
|
||||
G_in_L <= G_in;
|
||||
B_in_L <= B_in;
|
||||
HSYNC_in_L <= HSYNC_in;
|
||||
VSYNC_in_L <= VSYNC_in;
|
||||
FID_in_L <= FID_in;
|
||||
end
|
||||
end
|
||||
|
||||
// Insert synchronizers to async inputs (synchronize to CPU clock)
|
||||
always @(posedge clk27 or negedge po_reset_n)
|
||||
begin
|
||||
if (!po_reset_n) begin
|
||||
btn_L <= 2'b00;
|
||||
btn_LL <= 2'b00;
|
||||
ir_rx_L <= 1'b0;
|
||||
ir_rx_LL <= 1'b0;
|
||||
HDMI_TX_INT_N_L <= 1'b0;
|
||||
HDMI_TX_INT_N_LL <= 1'b0;
|
||||
HDMI_TX_MODE_L <= 1'b0;
|
||||
HDMI_TX_MODE_LL <= 1'b0;
|
||||
end else begin
|
||||
btn_L <= btn;
|
||||
btn_LL <= btn_L;
|
||||
ir_rx_L <= ir_rx;
|
||||
ir_rx_LL <= ir_rx_L;
|
||||
HDMI_TX_INT_N_L <= HDMI_TX_INT_N;
|
||||
HDMI_TX_INT_N_LL <= HDMI_TX_INT_N_L;
|
||||
HDMI_TX_MODE_L <= HDMI_TX_MODE;
|
||||
HDMI_TX_MODE_LL <= HDMI_TX_MODE_L;
|
||||
end
|
||||
end
|
||||
|
||||
// Power-on reset pulse generation (not strictly necessary)
|
||||
always @(posedge clk27)
|
||||
begin
|
||||
if (po_reset_ctr == `PO_RESET_WIDTH)
|
||||
po_reset_n <= 1'b1;
|
||||
else
|
||||
po_reset_ctr <= po_reset_ctr + 1'b1;
|
||||
end
|
||||
|
||||
assign hw_reset_n = sys_ctrl[0]; //HDMI_TX_RST_N in v1.2 PCB
|
||||
|
||||
|
||||
`ifdef DEBUG
|
||||
assign LED_R = HSYNC_in_L;
|
||||
assign LED_G = VSYNC_in_L;
|
||||
`else
|
||||
assign LED_R = lt_active ? lt_trig_waiting : (pll_lock_lost|h_unstable);
|
||||
assign LED_G = lt_active ? ~lt_sensor : (ir_code == 0);
|
||||
`endif
|
||||
|
||||
assign SD_DAT[3] = sys_ctrl[7]; //SD_SPI_SS_N
|
||||
assign LCD_CS_N = sys_ctrl[6];
|
||||
assign LCD_RS = sys_ctrl[5];
|
||||
wire lcd_bl_on = sys_ctrl[4]; //hw_reset_n in v1.2 PCB
|
||||
wire [1:0] lcd_bl_time = sys_ctrl[3:2];
|
||||
assign LCD_BL = lcd_bl_on ? (~lcd_bl_timeout | lt_active) : 1'b0;
|
||||
|
||||
wire enable_sc = sys_ctrl[1];
|
||||
assign xpos = enable_sc ? xpos_sc : xpos_vg;
|
||||
assign ypos = enable_sc ? ypos_sc : ypos_vg;
|
||||
assign HDMI_TX_PCLK = PCLK_out;
|
||||
|
||||
always @(posedge PCLK_out) begin
|
||||
if (osd_enable) begin
|
||||
if (osd_color == 2'h0) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'h000000;
|
||||
end else if (osd_color == 2'h1) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'h0000ff;
|
||||
end else if (osd_color == 2'h2) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'hffff00;
|
||||
end else begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'hffffff;
|
||||
end
|
||||
end else if (enable_sc) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {R_out_sc, G_out_sc, B_out_sc};
|
||||
end else begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {R_out_vg, G_out_vg, B_out_vg};
|
||||
end
|
||||
|
||||
HDMI_TX_HS <= enable_sc ? HSYNC_out_sc : HSYNC_out_vg;
|
||||
HDMI_TX_VS <= enable_sc ? VSYNC_out_sc : VSYNC_out_vg;
|
||||
HDMI_TX_DE <= enable_sc ? DE_out_sc : DE_out_vg;
|
||||
end
|
||||
|
||||
// LCD backlight timeout counters
|
||||
always @(posedge clk27)
|
||||
begin
|
||||
if (remote_event != remove_event_prev) begin
|
||||
to_ctr <= 15'd0;
|
||||
to_ctr_ms <= 15'd0;
|
||||
end else begin
|
||||
if (to_ctr == 27000-1) begin
|
||||
to_ctr <= 0;
|
||||
if (to_ctr_ms < 15'h7fff)
|
||||
to_ctr_ms <= to_ctr_ms + 1'b1;
|
||||
end else begin
|
||||
to_ctr <= to_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
case (lcd_bl_time)
|
||||
default: lcd_bl_timeout <= 0; //off
|
||||
2'b01: lcd_bl_timeout <= (to_ctr_ms >= 3000); //3s
|
||||
2'b10: lcd_bl_timeout <= (to_ctr_ms >= 10000); //10s
|
||||
2'b11: lcd_bl_timeout <= (to_ctr_ms >= 30000); //30s
|
||||
endcase
|
||||
|
||||
remove_event_prev <= remote_event;
|
||||
end
|
||||
|
||||
assign cpu_reset_n = reset_n_reg;
|
||||
|
||||
sys sys_inst(
|
||||
.clk_clk (clk27),
|
||||
.reset_reset_n (cpu_reset_n),
|
||||
.pio_0_sys_ctrl_out_export (sys_ctrl),
|
||||
.pio_1_controls_in_export ({ir_code_cnt, 5'b00000, HDMI_TX_MODE, btn, ir_code}),
|
||||
.pio_2_horizontal_info_out_export (h_info),
|
||||
.pio_3_vertical_info_out_export (v_info),
|
||||
.pio_4_linecount_in_export ({VSYNC_out, 13'h0000, fpga_vsyncgen, 5'h00, lines_out}),
|
||||
.pio_5_lcd_ctrl_out_export (lcd_ctrl),
|
||||
.i2c_opencores_0_export_scl_pad_io (scl),
|
||||
.i2c_opencores_0_export_sda_pad_io (sda),
|
||||
.sdcard_0_b_SD_cmd (SD_CMD),
|
||||
.sdcard_0_b_SD_dat (SD_DAT[0]),
|
||||
.sdcard_0_b_SD_dat3 (SD_DAT[3]),
|
||||
.sdcard_0_o_SD_clock (SD_CLK)
|
||||
.clk_clk (clk27),
|
||||
.reset_reset_n (sys_reset_n),
|
||||
.pulpino_0_config_testmode_i (1'b0),
|
||||
.pulpino_0_config_fetch_enable_i (1'b1),
|
||||
.pulpino_0_config_clock_gating_i (1'b0),
|
||||
.pulpino_0_config_boot_addr_i (32'h00010000),
|
||||
.master_0_master_reset_reset (jtagm_reset_req),
|
||||
.i2c_opencores_0_export_scl_pad_io (scl),
|
||||
.i2c_opencores_0_export_sda_pad_io (sda),
|
||||
.i2c_opencores_0_export_spi_miso_pad_i (1'b0),
|
||||
.i2c_opencores_1_export_scl_pad_io (SD_CLK),
|
||||
.i2c_opencores_1_export_sda_pad_io (SD_CMD),
|
||||
.i2c_opencores_1_export_spi_miso_pad_i (SD_DAT[0]),
|
||||
.pio_0_sys_ctrl_out_export (sys_ctrl),
|
||||
.pio_1_controls_in_export ({ir_code_cnt, 4'b0000, pll_activeclock, HDMI_TX_MODE_LL, btn_LL, ir_code}),
|
||||
.sc_config_0_sc_if_sc_status_i ({vsync_flag, 2'b00, vmax_tvp, fpga_vsyncgen, 4'h0, ilace_flag, vmax}),
|
||||
.sc_config_0_sc_if_sc_status2_i ({12'h000, pcnt_frame}),
|
||||
.sc_config_0_sc_if_lt_status_i ({lt_finished, 3'h0, lt_stb_result, lt_lat_result}),
|
||||
.sc_config_0_sc_if_h_config_o (h_config),
|
||||
.sc_config_0_sc_if_h_config2_o (h_config2),
|
||||
.sc_config_0_sc_if_v_config_o (v_config),
|
||||
.sc_config_0_sc_if_misc_config_o (misc_config),
|
||||
.sc_config_0_sc_if_sl_config_o (sl_config),
|
||||
.sc_config_0_sc_if_sl_config2_o (sl_config2),
|
||||
.osd_generator_0_osd_if_vclk (PCLK_out),
|
||||
.osd_generator_0_osd_if_xpos (xpos),
|
||||
.osd_generator_0_osd_if_ypos (ypos),
|
||||
.osd_generator_0_osd_if_osd_enable (osd_enable_pre),
|
||||
.osd_generator_0_osd_if_osd_color (osd_color),
|
||||
.pll_reconfig_0_pll_reconfig_if_areset (pll_areset),
|
||||
.pll_reconfig_0_pll_reconfig_if_scanclk (pll_scanclk),
|
||||
.pll_reconfig_0_pll_reconfig_if_scanclkena (pll_scanclkena),
|
||||
.pll_reconfig_0_pll_reconfig_if_configupdate (pll_configupdate),
|
||||
.pll_reconfig_0_pll_reconfig_if_scandata (pll_scandata),
|
||||
.pll_reconfig_0_pll_reconfig_if_scandone (pll_scandone)
|
||||
);
|
||||
|
||||
scanconverter scanconverter_inst (
|
||||
.reset_n (reset_n),
|
||||
.HSYNC_in (HSYNC_in),
|
||||
.VSYNC_in (VSYNC_in),
|
||||
.reset_n (hw_reset_n),
|
||||
.PCLK_in (PCLK_in),
|
||||
.FID_in (FID_in),
|
||||
.R_in (R_in),
|
||||
.G_in (G_in),
|
||||
.B_in (B_in),
|
||||
.h_info (h_info),
|
||||
.v_info (v_info),
|
||||
.R_out (R_out),
|
||||
.G_out (G_out),
|
||||
.B_out (B_out),
|
||||
.HSYNC_out (HSYNC_out),
|
||||
.VSYNC_out (VSYNC_out),
|
||||
.clk27 (clk27),
|
||||
.enable_sc (enable_sc),
|
||||
.HSYNC_in (HSYNC_in_L),
|
||||
.VSYNC_in (VSYNC_in_L),
|
||||
.FID_in (FID_in_L),
|
||||
.R_in (R_in_L),
|
||||
.G_in (G_in_L),
|
||||
.B_in (B_in_L),
|
||||
.h_config (h_config),
|
||||
.h_config2 (h_config2),
|
||||
.v_config (v_config),
|
||||
.misc_config (misc_config),
|
||||
.sl_config (sl_config),
|
||||
.sl_config2 (sl_config2),
|
||||
.R_out (R_out_sc),
|
||||
.G_out (G_out_sc),
|
||||
.B_out (B_out_sc),
|
||||
.PCLK_out (PCLK_out),
|
||||
.DATA_enable (DATA_enable),
|
||||
.HSYNC_out (HSYNC_out_sc),
|
||||
.VSYNC_out (VSYNC_out_sc),
|
||||
.DE_out (DE_out_sc),
|
||||
.h_unstable (h_unstable),
|
||||
.fpga_vsyncgen (fpga_vsyncgen),
|
||||
.pclk_lock (pclk_lock),
|
||||
.pll_lock_lost (pll_lock_lost),
|
||||
.lines_out (lines_out)
|
||||
.vmax (vmax),
|
||||
.vmax_tvp (vmax_tvp),
|
||||
.pcnt_frame (pcnt_frame),
|
||||
.ilace_flag (ilace_flag),
|
||||
.vsync_flag (vsync_flag),
|
||||
.lt_active (lt_active),
|
||||
.lt_mode (lt_mode_synced),
|
||||
.xpos (xpos_sc),
|
||||
.ypos (ypos_sc),
|
||||
.pll_areset (pll_areset),
|
||||
.pll_scanclk (pll_scanclk),
|
||||
.pll_scanclkena (pll_scanclkena),
|
||||
.pll_configupdate (pll_configupdate),
|
||||
.pll_scandata (pll_scandata),
|
||||
.pll_scandone (pll_scandone),
|
||||
.pll_activeclock (pll_activeclock)
|
||||
);
|
||||
|
||||
ir_rcv ir0 (
|
||||
.clk27 (clk27),
|
||||
.reset_n (reset_n_reg),
|
||||
.ir_rx (ir_rx),
|
||||
.reset_n (po_reset_n),
|
||||
.ir_rx (ir_rx_LL),
|
||||
.ir_code (ir_code),
|
||||
.ir_code_ack (),
|
||||
.ir_code_cnt (ir_code_cnt)
|
||||
);
|
||||
|
||||
`ifdef VIDEOGEN
|
||||
videogen vg0 (
|
||||
lat_tester lt0 (
|
||||
.clk27 (clk27),
|
||||
.reset_n (reset_n_reg & videogen_sel),
|
||||
.R_out (R_out_videogen),
|
||||
.G_out (G_out_videogen),
|
||||
.B_out (B_out_videogen),
|
||||
.HSYNC_out (HSYNC_out_videogen),
|
||||
.VSYNC_out (VSYNC_out_videogen),
|
||||
.PCLK_out (PCLK_out_videogen),
|
||||
.ENABLE_out (DATA_enable_videogen)
|
||||
.pclk (PCLK_out),
|
||||
.active (lt_active),
|
||||
.armed (lt_armed),
|
||||
.sensor (lt_sensor),
|
||||
.trigger (lt_trigger),
|
||||
.VSYNC_in (HDMI_TX_VS),
|
||||
.mode_in (lt_mode),
|
||||
.mode_synced (lt_mode_synced),
|
||||
.lat_result (lt_lat_result),
|
||||
.stb_result (lt_stb_result),
|
||||
.trig_waiting (lt_trig_waiting),
|
||||
.finished (lt_finished)
|
||||
);
|
||||
|
||||
videogen vg0 (
|
||||
.clk27 (PCLK_out),
|
||||
.reset_n (po_reset_n & ~enable_sc),
|
||||
.lt_active (lt_active),
|
||||
.lt_mode (lt_mode_synced),
|
||||
.R_out (R_out_vg),
|
||||
.G_out (G_out_vg),
|
||||
.B_out (B_out_vg),
|
||||
.HSYNC_out (HSYNC_out_vg),
|
||||
.VSYNC_out (VSYNC_out_vg),
|
||||
.DE_out (DE_out_vg),
|
||||
.xpos (xpos_vg),
|
||||
.ypos (ypos_vg)
|
||||
);
|
||||
`endif
|
||||
|
||||
endmodule
|
||||
|
|
|
@ -3,9 +3,19 @@
|
|||
<pinplan intended_family="Cyclone IV E" variation_name="pll_2x" megafunction_name="ALTPLL" specifies="all_ports">
|
||||
<global>
|
||||
<pin name="areset" direction="input" scope="external" />
|
||||
<pin name="clkswitch" direction="input" scope="external" />
|
||||
<pin name="configupdate" direction="input" scope="external" />
|
||||
<pin name="inclk0" direction="input" scope="external" source="clock" />
|
||||
<pin name="inclk1" direction="input" scope="external" source="clock" />
|
||||
<pin name="scanclk" direction="input" scope="external" source="clock" />
|
||||
<pin name="scanclkena" direction="input" scope="external" />
|
||||
<pin name="scandata" direction="input" scope="external" />
|
||||
<pin name="activeclock" direction="output" scope="external" />
|
||||
<pin name="c0" direction="output" scope="external" source="clock" />
|
||||
<pin name="c1" direction="output" scope="external" source="clock" />
|
||||
<pin name="locked" direction="output" scope="external" />
|
||||
<pin name="scandataout" direction="output" scope="external" />
|
||||
<pin name="scandone" direction="output" scope="external" />
|
||||
|
||||
</global>
|
||||
</pinplan>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
set_global_assignment -name IP_TOOL_NAME "ALTPLL"
|
||||
set_global_assignment -name IP_TOOL_VERSION "15.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll_2x.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x_bb.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x.ppf"]
|
||||
|
|
230
rtl/pll_2x.v
230
rtl/pll_2x.v
|
@ -14,24 +14,24 @@
|
|||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 15.1.0 Build 185 10/21/2015 SJ Lite Edition
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and its AMPP partner logic
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera MegaCore Function License Agreement, or other
|
||||
//applicable license agreement, including, without limitation,
|
||||
//that your use is for the sole purpose of programming logic
|
||||
//devices manufactured by Altera and sold by Altera or its
|
||||
//authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
|
@ -39,42 +39,79 @@
|
|||
// synopsys translate_on
|
||||
module pll_2x (
|
||||
areset,
|
||||
clkswitch,
|
||||
configupdate,
|
||||
inclk0,
|
||||
inclk1,
|
||||
scanclk,
|
||||
scanclkena,
|
||||
scandata,
|
||||
activeclock,
|
||||
c0,
|
||||
locked);
|
||||
c1,
|
||||
locked,
|
||||
scandataout,
|
||||
scandone);
|
||||
|
||||
input areset;
|
||||
input clkswitch;
|
||||
input configupdate;
|
||||
input inclk0;
|
||||
input inclk1;
|
||||
input scanclk;
|
||||
input scanclkena;
|
||||
input scandata;
|
||||
output activeclock;
|
||||
output c0;
|
||||
output c1;
|
||||
output locked;
|
||||
output scandataout;
|
||||
output scandone;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri0 areset;
|
||||
tri0 clkswitch;
|
||||
tri0 configupdate;
|
||||
tri0 scanclkena;
|
||||
tri0 scandata;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
`endif
|
||||
|
||||
wire [4:0] sub_wire0;
|
||||
wire sub_wire2;
|
||||
wire [0:0] sub_wire5 = 1'h0;
|
||||
wire [0:0] sub_wire1 = sub_wire0[0:0];
|
||||
wire c0 = sub_wire1;
|
||||
wire locked = sub_wire2;
|
||||
wire sub_wire3 = inclk0;
|
||||
wire [1:0] sub_wire4 = {sub_wire5, sub_wire3};
|
||||
wire sub_wire0;
|
||||
wire [4:0] sub_wire1;
|
||||
wire sub_wire4;
|
||||
wire sub_wire5;
|
||||
wire sub_wire6;
|
||||
wire sub_wire9 = inclk1;
|
||||
wire activeclock = sub_wire0;
|
||||
wire [1:1] sub_wire3 = sub_wire1[1:1];
|
||||
wire [0:0] sub_wire2 = sub_wire1[0:0];
|
||||
wire c0 = sub_wire2;
|
||||
wire c1 = sub_wire3;
|
||||
wire locked = sub_wire4;
|
||||
wire scandataout = sub_wire5;
|
||||
wire scandone = sub_wire6;
|
||||
wire sub_wire7 = inclk0;
|
||||
wire [1:0] sub_wire8 = {sub_wire9, sub_wire7};
|
||||
|
||||
altpll altpll_component (
|
||||
.areset (areset),
|
||||
.inclk (sub_wire4),
|
||||
.clk (sub_wire0),
|
||||
.locked (sub_wire2),
|
||||
.activeclock (),
|
||||
.clkswitch (clkswitch),
|
||||
.configupdate (configupdate),
|
||||
.inclk (sub_wire8),
|
||||
.scanclk (scanclk),
|
||||
.scanclkena (scanclkena),
|
||||
.scandata (scandata),
|
||||
.activeclock (sub_wire0),
|
||||
.clk (sub_wire1),
|
||||
.locked (sub_wire4),
|
||||
.scandataout (sub_wire5),
|
||||
.scandone (sub_wire6),
|
||||
.clkbad (),
|
||||
.clkena ({6{1'b1}}),
|
||||
.clkloss (),
|
||||
.clkswitch (1'b0),
|
||||
.configupdate (1'b0),
|
||||
.enable0 (),
|
||||
.enable1 (),
|
||||
.extclk (),
|
||||
|
@ -91,11 +128,6 @@ module pll_2x (
|
|||
.phaseupdown (1'b1),
|
||||
.pllena (1'b1),
|
||||
.scanaclr (1'b0),
|
||||
.scanclk (1'b0),
|
||||
.scanclkena (1'b1),
|
||||
.scandata (1'b0),
|
||||
.scandataout (),
|
||||
.scandone (),
|
||||
.scanread (1'b0),
|
||||
.scanwrite (1'b0),
|
||||
.sclkout0 (),
|
||||
|
@ -106,25 +138,30 @@ module pll_2x (
|
|||
altpll_component.bandwidth_type = "HIGH",
|
||||
altpll_component.clk0_divide_by = 1,
|
||||
altpll_component.clk0_duty_cycle = 50,
|
||||
altpll_component.clk0_multiply_by = 2,
|
||||
altpll_component.clk0_multiply_by = 1,
|
||||
altpll_component.clk0_phase_shift = "0",
|
||||
altpll_component.clk1_divide_by = 1,
|
||||
altpll_component.clk1_duty_cycle = 50,
|
||||
altpll_component.clk1_multiply_by = 1,
|
||||
altpll_component.clk1_phase_shift = "0",
|
||||
altpll_component.compensate_clock = "CLK0",
|
||||
altpll_component.inclk0_input_frequency = 74074,
|
||||
altpll_component.inclk0_input_frequency = 37037,
|
||||
altpll_component.inclk1_input_frequency = 37037,
|
||||
altpll_component.intended_device_family = "Cyclone IV E",
|
||||
altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll_2x",
|
||||
altpll_component.lpm_type = "altpll",
|
||||
altpll_component.operation_mode = "SOURCE_SYNCHRONOUS",
|
||||
altpll_component.operation_mode = "NORMAL",
|
||||
altpll_component.pll_type = "AUTO",
|
||||
altpll_component.port_activeclock = "PORT_UNUSED",
|
||||
altpll_component.port_activeclock = "PORT_USED",
|
||||
altpll_component.port_areset = "PORT_USED",
|
||||
altpll_component.port_clkbad0 = "PORT_UNUSED",
|
||||
altpll_component.port_clkbad1 = "PORT_UNUSED",
|
||||
altpll_component.port_clkloss = "PORT_UNUSED",
|
||||
altpll_component.port_clkswitch = "PORT_UNUSED",
|
||||
altpll_component.port_configupdate = "PORT_UNUSED",
|
||||
altpll_component.port_clkswitch = "PORT_USED",
|
||||
altpll_component.port_configupdate = "PORT_USED",
|
||||
altpll_component.port_fbin = "PORT_UNUSED",
|
||||
altpll_component.port_inclk0 = "PORT_USED",
|
||||
altpll_component.port_inclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_inclk1 = "PORT_USED",
|
||||
altpll_component.port_locked = "PORT_USED",
|
||||
altpll_component.port_pfdena = "PORT_UNUSED",
|
||||
altpll_component.port_phasecounterselect = "PORT_UNUSED",
|
||||
|
@ -133,15 +170,15 @@ module pll_2x (
|
|||
altpll_component.port_phaseupdown = "PORT_UNUSED",
|
||||
altpll_component.port_pllena = "PORT_UNUSED",
|
||||
altpll_component.port_scanaclr = "PORT_UNUSED",
|
||||
altpll_component.port_scanclk = "PORT_UNUSED",
|
||||
altpll_component.port_scanclkena = "PORT_UNUSED",
|
||||
altpll_component.port_scandata = "PORT_UNUSED",
|
||||
altpll_component.port_scandataout = "PORT_UNUSED",
|
||||
altpll_component.port_scandone = "PORT_UNUSED",
|
||||
altpll_component.port_scanclk = "PORT_USED",
|
||||
altpll_component.port_scanclkena = "PORT_USED",
|
||||
altpll_component.port_scandata = "PORT_USED",
|
||||
altpll_component.port_scandataout = "PORT_USED",
|
||||
altpll_component.port_scandone = "PORT_USED",
|
||||
altpll_component.port_scanread = "PORT_UNUSED",
|
||||
altpll_component.port_scanwrite = "PORT_UNUSED",
|
||||
altpll_component.port_clk0 = "PORT_USED",
|
||||
altpll_component.port_clk1 = "PORT_UNUSED",
|
||||
altpll_component.port_clk1 = "PORT_USED",
|
||||
altpll_component.port_clk2 = "PORT_UNUSED",
|
||||
altpll_component.port_clk3 = "PORT_UNUSED",
|
||||
altpll_component.port_clk4 = "PORT_UNUSED",
|
||||
|
@ -156,8 +193,16 @@ module pll_2x (
|
|||
altpll_component.port_extclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk2 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk3 = "PORT_UNUSED",
|
||||
altpll_component.primary_clock = "inclk0",
|
||||
altpll_component.self_reset_on_loss_lock = "OFF",
|
||||
altpll_component.width_clock = 5;
|
||||
altpll_component.switch_over_type = "MANUAL",
|
||||
altpll_component.width_clock = 5,
|
||||
`ifdef NO_PLI
|
||||
altpll_component.scan_chain_mif_file = "pll_2x.rif"
|
||||
`else
|
||||
altpll_component.scan_chain_mif_file = "pll_2x.hex"
|
||||
`endif
|
||||
;
|
||||
|
||||
|
||||
endmodule
|
||||
|
@ -165,7 +210,7 @@ endmodule
|
|||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
|
||||
|
@ -177,13 +222,16 @@ endmodule
|
|||
// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "7"
|
||||
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "8"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "27.000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "27.000000"
|
||||
// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
|
||||
// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
|
||||
|
@ -191,9 +239,9 @@ endmodule
|
|||
// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
|
||||
// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "13.500"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "27.000"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "27.000"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
|
||||
|
@ -204,18 +252,26 @@ endmodule
|
|||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "ps"
|
||||
// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "2"
|
||||
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "ps"
|
||||
// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
|
||||
|
@ -226,8 +282,8 @@ endmodule
|
|||
// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
|
||||
// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll_2x.mif"
|
||||
// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll_2x.hex"
|
||||
// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
|
||||
// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
|
||||
|
@ -236,37 +292,45 @@ endmodule
|
|||
// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
|
||||
// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
|
||||
// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
|
||||
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "HIGH"
|
||||
// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "2"
|
||||
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
|
||||
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "74074"
|
||||
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "37037"
|
||||
// Retrieval info: CONSTANT: INCLK1_INPUT_FREQUENCY NUMERIC "37037"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "SOURCE_SYNCHRONOUS"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "NORMAL"
|
||||
// Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO"
|
||||
// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED"
|
||||
|
@ -275,15 +339,15 @@ endmodule
|
|||
// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
|
||||
|
@ -298,24 +362,48 @@ endmodule
|
|||
// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PRIMARY_CLOCK STRING "inclk0"
|
||||
// Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF"
|
||||
// Retrieval info: CONSTANT: SWITCH_OVER_TYPE STRING "MANUAL"
|
||||
// Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5"
|
||||
// Retrieval info: CONSTANT: scan_chain_mif_file STRING "pll_2x.hex"
|
||||
// Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]"
|
||||
// Retrieval info: USED_PORT: activeclock 0 0 0 0 OUTPUT GND "activeclock"
|
||||
// Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset"
|
||||
// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
|
||||
// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
|
||||
// Retrieval info: USED_PORT: clkswitch 0 0 0 0 INPUT GND "clkswitch"
|
||||
// Retrieval info: USED_PORT: configupdate 0 0 0 0 INPUT GND "configupdate"
|
||||
// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
|
||||
// Retrieval info: USED_PORT: inclk1 0 0 0 0 INPUT_CLK_EXT GND "inclk1"
|
||||
// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked"
|
||||
// Retrieval info: USED_PORT: scanclk 0 0 0 0 INPUT_CLK_EXT VCC "scanclk"
|
||||
// Retrieval info: USED_PORT: scanclkena 0 0 0 0 INPUT GND "scanclkena"
|
||||
// Retrieval info: USED_PORT: scandata 0 0 0 0 INPUT GND "scandata"
|
||||
// Retrieval info: USED_PORT: scandataout 0 0 0 0 OUTPUT VCC "scandataout"
|
||||
// Retrieval info: USED_PORT: scandone 0 0 0 0 OUTPUT VCC "scandone"
|
||||
// Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
|
||||
// Retrieval info: CONNECT: @clkswitch 0 0 0 0 clkswitch 0 0 0 0
|
||||
// Retrieval info: CONNECT: @configupdate 0 0 0 0 configupdate 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 1 inclk1 0 0 0 0
|
||||
// Retrieval info: CONNECT: @scanclk 0 0 0 0 scanclk 0 0 0 0
|
||||
// Retrieval info: CONNECT: @scanclkena 0 0 0 0 scanclkena 0 0 0 0
|
||||
// Retrieval info: CONNECT: @scandata 0 0 0 0 scandata 0 0 0 0
|
||||
// Retrieval info: CONNECT: activeclock 0 0 0 0 @activeclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
|
||||
// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
|
||||
// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
|
||||
// Retrieval info: CONNECT: scandataout 0 0 0 0 @scandataout 0 0 0 0
|
||||
// Retrieval info: CONNECT: scandone 0 0 0 0 @scandone 0 0 0 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.ppf TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.mif TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.hex TRUE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
// Retrieval info: CBX_MODULE_PREFIX: ON
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE pinplan>
|
||||
<pinplan intended_family="Cyclone IV E" variation_name="pll_3x" megafunction_name="ALTPLL" specifies="all_ports">
|
||||
<global>
|
||||
<pin name="areset" direction="input" scope="external" />
|
||||
<pin name="inclk0" direction="input" scope="external" source="clock" />
|
||||
<pin name="c0" direction="output" scope="external" source="clock" />
|
||||
<pin name="c1" direction="output" scope="external" source="clock" />
|
||||
<pin name="locked" direction="output" scope="external" />
|
||||
|
||||
</global>
|
||||
</pinplan>
|
349
rtl/pll_3x.v
349
rtl/pll_3x.v
|
@ -1,349 +0,0 @@
|
|||
// megafunction wizard: %ALTPLL%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: altpll
|
||||
|
||||
// ============================================================
|
||||
// File Name: pll_3x.v
|
||||
// Megafunction Name(s):
|
||||
// altpll
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// altera_mf
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 15.1.0 Build 185 10/21/2015 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and its AMPP partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera MegaCore Function License Agreement, or other
|
||||
//applicable license agreement, including, without limitation,
|
||||
//that your use is for the sole purpose of programming logic
|
||||
//devices manufactured by Altera and sold by Altera or its
|
||||
//authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module pll_3x (
|
||||
areset,
|
||||
inclk0,
|
||||
c0,
|
||||
c1,
|
||||
locked);
|
||||
|
||||
input areset;
|
||||
input inclk0;
|
||||
output c0;
|
||||
output c1;
|
||||
output locked;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri0 areset;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
`endif
|
||||
|
||||
wire [4:0] sub_wire0;
|
||||
wire sub_wire3;
|
||||
wire [0:0] sub_wire6 = 1'h0;
|
||||
wire [1:1] sub_wire2 = sub_wire0[1:1];
|
||||
wire [0:0] sub_wire1 = sub_wire0[0:0];
|
||||
wire c0 = sub_wire1;
|
||||
wire c1 = sub_wire2;
|
||||
wire locked = sub_wire3;
|
||||
wire sub_wire4 = inclk0;
|
||||
wire [1:0] sub_wire5 = {sub_wire6, sub_wire4};
|
||||
|
||||
altpll altpll_component (
|
||||
.areset (areset),
|
||||
.inclk (sub_wire5),
|
||||
.clk (sub_wire0),
|
||||
.locked (sub_wire3),
|
||||
.activeclock (),
|
||||
.clkbad (),
|
||||
.clkena ({6{1'b1}}),
|
||||
.clkloss (),
|
||||
.clkswitch (1'b0),
|
||||
.configupdate (1'b0),
|
||||
.enable0 (),
|
||||
.enable1 (),
|
||||
.extclk (),
|
||||
.extclkena ({4{1'b1}}),
|
||||
.fbin (1'b1),
|
||||
.fbmimicbidir (),
|
||||
.fbout (),
|
||||
.fref (),
|
||||
.icdrclk (),
|
||||
.pfdena (1'b1),
|
||||
.phasecounterselect ({4{1'b1}}),
|
||||
.phasedone (),
|
||||
.phasestep (1'b1),
|
||||
.phaseupdown (1'b1),
|
||||
.pllena (1'b1),
|
||||
.scanaclr (1'b0),
|
||||
.scanclk (1'b0),
|
||||
.scanclkena (1'b1),
|
||||
.scandata (1'b0),
|
||||
.scandataout (),
|
||||
.scandone (),
|
||||
.scanread (1'b0),
|
||||
.scanwrite (1'b0),
|
||||
.sclkout0 (),
|
||||
.sclkout1 (),
|
||||
.vcooverrange (),
|
||||
.vcounderrange ());
|
||||
defparam
|
||||
altpll_component.bandwidth_type = "HIGH",
|
||||
altpll_component.clk0_divide_by = 1,
|
||||
altpll_component.clk0_duty_cycle = 50,
|
||||
altpll_component.clk0_multiply_by = 3,
|
||||
altpll_component.clk0_phase_shift = "0",
|
||||
altpll_component.clk1_divide_by = 1,
|
||||
altpll_component.clk1_duty_cycle = 50,
|
||||
altpll_component.clk1_multiply_by = 4,
|
||||
altpll_component.clk1_phase_shift = "0",
|
||||
altpll_component.compensate_clock = "CLK0",
|
||||
altpll_component.inclk0_input_frequency = 37037,
|
||||
altpll_component.intended_device_family = "Cyclone IV E",
|
||||
altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll_3x",
|
||||
altpll_component.lpm_type = "altpll",
|
||||
altpll_component.operation_mode = "SOURCE_SYNCHRONOUS",
|
||||
altpll_component.pll_type = "AUTO",
|
||||
altpll_component.port_activeclock = "PORT_UNUSED",
|
||||
altpll_component.port_areset = "PORT_USED",
|
||||
altpll_component.port_clkbad0 = "PORT_UNUSED",
|
||||
altpll_component.port_clkbad1 = "PORT_UNUSED",
|
||||
altpll_component.port_clkloss = "PORT_UNUSED",
|
||||
altpll_component.port_clkswitch = "PORT_UNUSED",
|
||||
altpll_component.port_configupdate = "PORT_UNUSED",
|
||||
altpll_component.port_fbin = "PORT_UNUSED",
|
||||
altpll_component.port_inclk0 = "PORT_USED",
|
||||
altpll_component.port_inclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_locked = "PORT_USED",
|
||||
altpll_component.port_pfdena = "PORT_UNUSED",
|
||||
altpll_component.port_phasecounterselect = "PORT_UNUSED",
|
||||
altpll_component.port_phasedone = "PORT_UNUSED",
|
||||
altpll_component.port_phasestep = "PORT_UNUSED",
|
||||
altpll_component.port_phaseupdown = "PORT_UNUSED",
|
||||
altpll_component.port_pllena = "PORT_UNUSED",
|
||||
altpll_component.port_scanaclr = "PORT_UNUSED",
|
||||
altpll_component.port_scanclk = "PORT_UNUSED",
|
||||
altpll_component.port_scanclkena = "PORT_UNUSED",
|
||||
altpll_component.port_scandata = "PORT_UNUSED",
|
||||
altpll_component.port_scandataout = "PORT_UNUSED",
|
||||
altpll_component.port_scandone = "PORT_UNUSED",
|
||||
altpll_component.port_scanread = "PORT_UNUSED",
|
||||
altpll_component.port_scanwrite = "PORT_UNUSED",
|
||||
altpll_component.port_clk0 = "PORT_USED",
|
||||
altpll_component.port_clk1 = "PORT_USED",
|
||||
altpll_component.port_clk2 = "PORT_UNUSED",
|
||||
altpll_component.port_clk3 = "PORT_UNUSED",
|
||||
altpll_component.port_clk4 = "PORT_UNUSED",
|
||||
altpll_component.port_clk5 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena0 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena1 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena2 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena3 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena4 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena5 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk0 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk2 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk3 = "PORT_UNUSED",
|
||||
altpll_component.self_reset_on_loss_lock = "OFF",
|
||||
altpll_component.width_clock = 5;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "High"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "0"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "1"
|
||||
// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "7"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "81.000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "108.000000"
|
||||
// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
|
||||
// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
|
||||
// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "27.000"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "deg"
|
||||
// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "3"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "4"
|
||||
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
|
||||
// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll_2x.mif"
|
||||
// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
|
||||
// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0"
|
||||
// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000"
|
||||
// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
|
||||
// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
|
||||
// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
|
||||
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "HIGH"
|
||||
// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "3"
|
||||
// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "4"
|
||||
// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
|
||||
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "37037"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "SOURCE_SYNCHRONOUS"
|
||||
// Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO"
|
||||
// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF"
|
||||
// Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5"
|
||||
// Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]"
|
||||
// Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset"
|
||||
// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
|
||||
// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
|
||||
// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
|
||||
// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked"
|
||||
// Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
|
||||
// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
|
||||
// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
|
||||
// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x.ppf TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
// Retrieval info: CBX_MODULE_PREFIX: ON
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE pinplan>
|
||||
<pinplan intended_family="Cyclone IV E" variation_name="pll_3x_lowfreq" megafunction_name="ALTPLL" specifies="all_ports">
|
||||
<global>
|
||||
<pin name="areset" direction="input" scope="external" />
|
||||
<pin name="inclk0" direction="input" scope="external" source="clock" />
|
||||
<pin name="c0" direction="output" scope="external" source="clock" />
|
||||
<pin name="c1" direction="output" scope="external" source="clock" />
|
||||
<pin name="c2" direction="output" scope="external" source="clock" />
|
||||
<pin name="locked" direction="output" scope="external" />
|
||||
|
||||
</global>
|
||||
</pinplan>
|
|
@ -1,377 +0,0 @@
|
|||
// megafunction wizard: %ALTPLL%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: altpll
|
||||
|
||||
// ============================================================
|
||||
// File Name: pll_3x_lowfreq.v
|
||||
// Megafunction Name(s):
|
||||
// altpll
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// altera_mf
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 15.1.0 Build 185 10/21/2015 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and its AMPP partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera MegaCore Function License Agreement, or other
|
||||
//applicable license agreement, including, without limitation,
|
||||
//that your use is for the sole purpose of programming logic
|
||||
//devices manufactured by Altera and sold by Altera or its
|
||||
//authorized distributors. Please refer to the applicable
|
||||
//agreement for further details.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module pll_3x_lowfreq (
|
||||
areset,
|
||||
inclk0,
|
||||
c0,
|
||||
c1,
|
||||
c2,
|
||||
locked);
|
||||
|
||||
input areset;
|
||||
input inclk0;
|
||||
output c0;
|
||||
output c1;
|
||||
output c2;
|
||||
output locked;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri0 areset;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
`endif
|
||||
|
||||
wire [4:0] sub_wire0;
|
||||
wire sub_wire4;
|
||||
wire [0:0] sub_wire7 = 1'h0;
|
||||
wire [2:2] sub_wire3 = sub_wire0[2:2];
|
||||
wire [1:1] sub_wire2 = sub_wire0[1:1];
|
||||
wire [0:0] sub_wire1 = sub_wire0[0:0];
|
||||
wire c0 = sub_wire1;
|
||||
wire c1 = sub_wire2;
|
||||
wire c2 = sub_wire3;
|
||||
wire locked = sub_wire4;
|
||||
wire sub_wire5 = inclk0;
|
||||
wire [1:0] sub_wire6 = {sub_wire7, sub_wire5};
|
||||
|
||||
altpll altpll_component (
|
||||
.areset (areset),
|
||||
.inclk (sub_wire6),
|
||||
.clk (sub_wire0),
|
||||
.locked (sub_wire4),
|
||||
.activeclock (),
|
||||
.clkbad (),
|
||||
.clkena ({6{1'b1}}),
|
||||
.clkloss (),
|
||||
.clkswitch (1'b0),
|
||||
.configupdate (1'b0),
|
||||
.enable0 (),
|
||||
.enable1 (),
|
||||
.extclk (),
|
||||
.extclkena ({4{1'b1}}),
|
||||
.fbin (1'b1),
|
||||
.fbmimicbidir (),
|
||||
.fbout (),
|
||||
.fref (),
|
||||
.icdrclk (),
|
||||
.pfdena (1'b1),
|
||||
.phasecounterselect ({4{1'b1}}),
|
||||
.phasedone (),
|
||||
.phasestep (1'b1),
|
||||
.phaseupdown (1'b1),
|
||||
.pllena (1'b1),
|
||||
.scanaclr (1'b0),
|
||||
.scanclk (1'b0),
|
||||
.scanclkena (1'b1),
|
||||
.scandata (1'b0),
|
||||
.scandataout (),
|
||||
.scandone (),
|
||||
.scanread (1'b0),
|
||||
.scanwrite (1'b0),
|
||||
.sclkout0 (),
|
||||
.sclkout1 (),
|
||||
.vcooverrange (),
|
||||
.vcounderrange ());
|
||||
defparam
|
||||
altpll_component.bandwidth_type = "HIGH",
|
||||
altpll_component.clk0_divide_by = 1,
|
||||
altpll_component.clk0_duty_cycle = 50,
|
||||
altpll_component.clk0_multiply_by = 3,
|
||||
altpll_component.clk0_phase_shift = "0",
|
||||
altpll_component.clk1_divide_by = 1,
|
||||
altpll_component.clk1_duty_cycle = 50,
|
||||
altpll_component.clk1_multiply_by = 12,
|
||||
altpll_component.clk1_phase_shift = "0",
|
||||
altpll_component.clk2_divide_by = 1,
|
||||
altpll_component.clk2_duty_cycle = 50,
|
||||
altpll_component.clk2_multiply_by = 15,
|
||||
altpll_component.clk2_phase_shift = "0",
|
||||
altpll_component.compensate_clock = "CLK0",
|
||||
altpll_component.inclk0_input_frequency = 149253,
|
||||
altpll_component.intended_device_family = "Cyclone IV E",
|
||||
altpll_component.lpm_hint = "CBX_MODULE_PREFIX=pll_3x_lowfreq",
|
||||
altpll_component.lpm_type = "altpll",
|
||||
altpll_component.operation_mode = "SOURCE_SYNCHRONOUS",
|
||||
altpll_component.pll_type = "AUTO",
|
||||
altpll_component.port_activeclock = "PORT_UNUSED",
|
||||
altpll_component.port_areset = "PORT_USED",
|
||||
altpll_component.port_clkbad0 = "PORT_UNUSED",
|
||||
altpll_component.port_clkbad1 = "PORT_UNUSED",
|
||||
altpll_component.port_clkloss = "PORT_UNUSED",
|
||||
altpll_component.port_clkswitch = "PORT_UNUSED",
|
||||
altpll_component.port_configupdate = "PORT_UNUSED",
|
||||
altpll_component.port_fbin = "PORT_UNUSED",
|
||||
altpll_component.port_inclk0 = "PORT_USED",
|
||||
altpll_component.port_inclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_locked = "PORT_USED",
|
||||
altpll_component.port_pfdena = "PORT_UNUSED",
|
||||
altpll_component.port_phasecounterselect = "PORT_UNUSED",
|
||||
altpll_component.port_phasedone = "PORT_UNUSED",
|
||||
altpll_component.port_phasestep = "PORT_UNUSED",
|
||||
altpll_component.port_phaseupdown = "PORT_UNUSED",
|
||||
altpll_component.port_pllena = "PORT_UNUSED",
|
||||
altpll_component.port_scanaclr = "PORT_UNUSED",
|
||||
altpll_component.port_scanclk = "PORT_UNUSED",
|
||||
altpll_component.port_scanclkena = "PORT_UNUSED",
|
||||
altpll_component.port_scandata = "PORT_UNUSED",
|
||||
altpll_component.port_scandataout = "PORT_UNUSED",
|
||||
altpll_component.port_scandone = "PORT_UNUSED",
|
||||
altpll_component.port_scanread = "PORT_UNUSED",
|
||||
altpll_component.port_scanwrite = "PORT_UNUSED",
|
||||
altpll_component.port_clk0 = "PORT_USED",
|
||||
altpll_component.port_clk1 = "PORT_USED",
|
||||
altpll_component.port_clk2 = "PORT_USED",
|
||||
altpll_component.port_clk3 = "PORT_UNUSED",
|
||||
altpll_component.port_clk4 = "PORT_UNUSED",
|
||||
altpll_component.port_clk5 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena0 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena1 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena2 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena3 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena4 = "PORT_UNUSED",
|
||||
altpll_component.port_clkena5 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk0 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk1 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk2 = "PORT_UNUSED",
|
||||
altpll_component.port_extclk3 = "PORT_UNUSED",
|
||||
altpll_component.self_reset_on_loss_lock = "OFF",
|
||||
altpll_component.width_clock = 5;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: ACTIVECLK_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH STRING "1.000"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_FREQ_UNIT STRING "MHz"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_PRESET STRING "High"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_USE_AUTO STRING "0"
|
||||
// Retrieval info: PRIVATE: BANDWIDTH_USE_PRESET STRING "1"
|
||||
// Retrieval info: PRIVATE: CLKBAD_SWITCHOVER_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CLKLOSS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CLKSWITCH_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CNX_NO_COMPENSATE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_CLKBAD_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CREATE_INCLK1_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: CUR_DEDICATED_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "7"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR2 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE2 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "20.100000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "80.400002"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE2 STRING "100.500000"
|
||||
// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
|
||||
// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: GLOCKED_FEATURE_ENABLED STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_MODE_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCK_COUNTER_EDIT NUMERIC "1048575"
|
||||
// Retrieval info: PRIVATE: HAS_MANUAL_SWITCHOVER STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_EDIT STRING "6.700"
|
||||
// Retrieval info: PRIVATE: INCLK0_FREQ_UNIT_COMBO STRING "MHz"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT STRING "100.000"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_EDIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_CHANGED STRING "1"
|
||||
// Retrieval info: PRIVATE: INCLK1_FREQ_UNIT_COMBO STRING "MHz"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: INT_FEEDBACK__MODE_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: LOCKED_OUTPUT_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: LONG_SCAN_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "deg"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT2 STRING "ps"
|
||||
// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK2 STRING "0"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "3"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "12"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR2 NUMERIC "15"
|
||||
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ2 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE2 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT2 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT2 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT2 STRING "ps"
|
||||
// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: PLL_ENHPLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_FASTPLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_FBMIMIC_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_LVDS_PLL_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PLL_PFDENA_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_TARGET_HARCOPY_CHECK NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: PRIMARY_CLK_COMBO STRING "inclk0"
|
||||
// Retrieval info: PRIVATE: RECONFIG_FILE STRING "pll_2x.mif"
|
||||
// Retrieval info: PRIVATE: SACN_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: SCAN_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SELF_RESET_LOCK_LOSS STRING "0"
|
||||
// Retrieval info: PRIVATE: SHORT_SCAN_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: SPREAD_FEATURE_ENABLED STRING "0"
|
||||
// Retrieval info: PRIVATE: SPREAD_FREQ STRING "50.000"
|
||||
// Retrieval info: PRIVATE: SPREAD_FREQ_UNIT STRING "KHz"
|
||||
// Retrieval info: PRIVATE: SPREAD_PERCENT STRING "0.500"
|
||||
// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
|
||||
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK2 STRING "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLK2 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA2 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: BANDWIDTH_TYPE STRING "HIGH"
|
||||
// Retrieval info: CONSTANT: CLK0_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "3"
|
||||
// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "12"
|
||||
// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: CLK2_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK2_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK2_MULTIPLY_BY NUMERIC "15"
|
||||
// Retrieval info: CONSTANT: CLK2_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
|
||||
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "149253"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altpll"
|
||||
// Retrieval info: CONSTANT: OPERATION_MODE STRING "SOURCE_SYNCHRONOUS"
|
||||
// Retrieval info: CONSTANT: PLL_TYPE STRING "AUTO"
|
||||
// Retrieval info: CONSTANT: PORT_ACTIVECLOCK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_ARESET STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKBAD1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKLOSS STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CLKSWITCH STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_CONFIGUPDATE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_FBIN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_INCLK1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_LOCKED STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_PFDENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASECOUNTERSELECT STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASEDONE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASESTEP STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PHASEUPDOWN STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_PLLENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANACLR STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLK STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANCLKENA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATA STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDATAOUT STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANDONE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk5 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena4 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clkena5 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk0 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_extclk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: SELF_RESET_ON_LOSS_LOCK STRING "OFF"
|
||||
// Retrieval info: CONSTANT: WIDTH_CLOCK NUMERIC "5"
|
||||
// Retrieval info: USED_PORT: @clk 0 0 5 0 OUTPUT_CLK_EXT VCC "@clk[4..0]"
|
||||
// Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset"
|
||||
// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
|
||||
// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
|
||||
// Retrieval info: USED_PORT: c2 0 0 0 0 OUTPUT_CLK_EXT VCC "c2"
|
||||
// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
|
||||
// Retrieval info: USED_PORT: locked 0 0 0 0 OUTPUT GND "locked"
|
||||
// Retrieval info: CONNECT: @areset 0 0 0 0 areset 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 1 GND 0 0 0 0
|
||||
// Retrieval info: CONNECT: @inclk 0 0 1 0 inclk0 0 0 0 0
|
||||
// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
|
||||
// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
|
||||
// Retrieval info: CONNECT: c2 0 0 0 0 @clk 0 0 1 2
|
||||
// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq.ppf TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_3x_lowfreq_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
// Retrieval info: CBX_MODULE_PREFIX: ON
|
174
rtl/pll_config_2x_5x_data.mif
Normal file
174
rtl/pll_config_2x_5x_data.mif
Normal file
|
@ -0,0 +1,174 @@
|
|||
-- Copyright (C) 2017 Intel Corporation. All rights reserved.
|
||||
-- Your use of Intel Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Intel Program License
|
||||
-- Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
-- the Intel FPGA IP License Agreement, or other applicable license
|
||||
-- agreement, including, without limitation, that your use is for
|
||||
-- the sole purpose of programming logic devices manufactured by
|
||||
-- Intel and sold by Intel or its authorized distributors. Please
|
||||
-- refer to the applicable agreement for further details.
|
||||
|
||||
-- MIF file representing initial state of PLL Scan Chain
|
||||
-- Device Family: Cyclone IV E
|
||||
-- Device Part: -
|
||||
-- Device Speed Grade: 8
|
||||
-- PLL Scan Chain: Fast PLL (144 bits)
|
||||
-- File Name: /home/markus/Code/ossc/rtl/pll_config_2x_5x_data.mif
|
||||
-- Generated: Sat Oct 5 23:56:40 2019
|
||||
|
||||
WIDTH=1;
|
||||
DEPTH=144;
|
||||
|
||||
ADDRESS_RADIX=UNS;
|
||||
DATA_RADIX=UNS;
|
||||
|
||||
CONTENT BEGIN
|
||||
0 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
1 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
2 : 0; -- Loop Filter Capacitance = 0 (2 bit(s)) (Setting 0)
|
||||
3 : 0;
|
||||
4 : 1; -- Loop Filter Resistance = 27 (5 bit(s)) (Setting 27)
|
||||
5 : 1;
|
||||
6 : 0;
|
||||
7 : 1;
|
||||
8 : 1;
|
||||
9 : 1; -- VCO Post Scale = 1 (1 bit(s)) (VCO post-scale divider counter value = 1)
|
||||
10 : 0; -- Reserved Bits = 0 (5 bit(s))
|
||||
11 : 0;
|
||||
12 : 0;
|
||||
13 : 0;
|
||||
14 : 0;
|
||||
15 : 0; -- Charge Pump Current = 1 (3 bit(s)) (Setting 1)
|
||||
16 : 0;
|
||||
17 : 1;
|
||||
18 : 1; -- N counter: Bypass = 1 (1 bit(s))
|
||||
19 : 0; -- N counter: High Count = 0 (8 bit(s))
|
||||
20 : 0;
|
||||
21 : 0;
|
||||
22 : 0;
|
||||
23 : 0;
|
||||
24 : 0;
|
||||
25 : 0;
|
||||
26 : 0;
|
||||
27 : 0; -- N counter: Odd Division = 0 (1 bit(s))
|
||||
28 : 0; -- N counter: Low Count = 0 (8 bit(s))
|
||||
29 : 0;
|
||||
30 : 0;
|
||||
31 : 0;
|
||||
32 : 0;
|
||||
33 : 0;
|
||||
34 : 0;
|
||||
35 : 0;
|
||||
36 : 0; -- M counter: Bypass = 0 (1 bit(s))
|
||||
37 : 0; -- M counter: High Count = 15 (8 bit(s))
|
||||
38 : 0;
|
||||
39 : 0;
|
||||
40 : 0;
|
||||
41 : 1;
|
||||
42 : 1;
|
||||
43 : 1;
|
||||
44 : 1;
|
||||
45 : 0; -- M counter: Odd Division = 0 (1 bit(s))
|
||||
46 : 0; -- M counter: Low Count = 15 (8 bit(s))
|
||||
47 : 0;
|
||||
48 : 0;
|
||||
49 : 0;
|
||||
50 : 1;
|
||||
51 : 1;
|
||||
52 : 1;
|
||||
53 : 1;
|
||||
54 : 0; -- clk0 counter: Bypass = 0 (1 bit(s))
|
||||
55 : 0; -- clk0 counter: High Count = 8 (8 bit(s))
|
||||
56 : 0;
|
||||
57 : 0;
|
||||
58 : 0;
|
||||
59 : 1;
|
||||
60 : 0;
|
||||
61 : 0;
|
||||
62 : 0;
|
||||
63 : 1; -- clk0 counter: Odd Division = 1 (1 bit(s))
|
||||
64 : 0; -- clk0 counter: Low Count = 7 (8 bit(s))
|
||||
65 : 0;
|
||||
66 : 0;
|
||||
67 : 0;
|
||||
68 : 0;
|
||||
69 : 1;
|
||||
70 : 1;
|
||||
71 : 1;
|
||||
72 : 0; -- clk1 counter: Bypass = 0 (1 bit(s))
|
||||
73 : 0; -- clk1 counter: High Count = 3 (8 bit(s))
|
||||
74 : 0;
|
||||
75 : 0;
|
||||
76 : 0;
|
||||
77 : 0;
|
||||
78 : 0;
|
||||
79 : 1;
|
||||
80 : 1;
|
||||
81 : 0; -- clk1 counter: Odd Division = 0 (1 bit(s))
|
||||
82 : 0; -- clk1 counter: Low Count = 3 (8 bit(s))
|
||||
83 : 0;
|
||||
84 : 0;
|
||||
85 : 0;
|
||||
86 : 0;
|
||||
87 : 0;
|
||||
88 : 1;
|
||||
89 : 1;
|
||||
90 : 1; -- clk2 counter: Bypass = 1 (1 bit(s))
|
||||
91 : 0; -- clk2 counter: High Count = 0 (8 bit(s))
|
||||
92 : 0;
|
||||
93 : 0;
|
||||
94 : 0;
|
||||
95 : 0;
|
||||
96 : 0;
|
||||
97 : 0;
|
||||
98 : 0;
|
||||
99 : 0; -- clk2 counter: Odd Division = 0 (1 bit(s))
|
||||
100 : 0; -- clk2 counter: Low Count = 0 (8 bit(s))
|
||||
101 : 0;
|
||||
102 : 0;
|
||||
103 : 0;
|
||||
104 : 0;
|
||||
105 : 0;
|
||||
106 : 0;
|
||||
107 : 0;
|
||||
108 : 1; -- clk3 counter: Bypass = 1 (1 bit(s))
|
||||
109 : 0; -- clk3 counter: High Count = 0 (8 bit(s))
|
||||
110 : 0;
|
||||
111 : 0;
|
||||
112 : 0;
|
||||
113 : 0;
|
||||
114 : 0;
|
||||
115 : 0;
|
||||
116 : 0;
|
||||
117 : 0; -- clk3 counter: Odd Division = 0 (1 bit(s))
|
||||
118 : 0; -- clk3 counter: Low Count = 0 (8 bit(s))
|
||||
119 : 0;
|
||||
120 : 0;
|
||||
121 : 0;
|
||||
122 : 0;
|
||||
123 : 0;
|
||||
124 : 0;
|
||||
125 : 0;
|
||||
126 : 1; -- clk4 counter: Bypass = 1 (1 bit(s))
|
||||
127 : 0; -- clk4 counter: High Count = 0 (8 bit(s))
|
||||
128 : 0;
|
||||
129 : 0;
|
||||
130 : 0;
|
||||
131 : 0;
|
||||
132 : 0;
|
||||
133 : 0;
|
||||
134 : 0;
|
||||
135 : 0; -- clk4 counter: Odd Division = 0 (1 bit(s))
|
||||
136 : 0; -- clk4 counter: Low Count = 0 (8 bit(s))
|
||||
137 : 0;
|
||||
138 : 0;
|
||||
139 : 0;
|
||||
140 : 0;
|
||||
141 : 0;
|
||||
142 : 0;
|
||||
143 : 0;
|
||||
END;
|
174
rtl/pll_config_3x_4x_data.mif
Normal file
174
rtl/pll_config_3x_4x_data.mif
Normal file
|
@ -0,0 +1,174 @@
|
|||
-- Copyright (C) 2017 Intel Corporation. All rights reserved.
|
||||
-- Your use of Intel Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Intel Program License
|
||||
-- Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
-- the Intel FPGA IP License Agreement, or other applicable license
|
||||
-- agreement, including, without limitation, that your use is for
|
||||
-- the sole purpose of programming logic devices manufactured by
|
||||
-- Intel and sold by Intel or its authorized distributors. Please
|
||||
-- refer to the applicable agreement for further details.
|
||||
|
||||
-- MIF file representing initial state of PLL Scan Chain
|
||||
-- Device Family: Cyclone IV E
|
||||
-- Device Part: -
|
||||
-- Device Speed Grade: 8
|
||||
-- PLL Scan Chain: Fast PLL (144 bits)
|
||||
-- File Name: /home/markus/Code/ossc/rtl/pll_config_3x_4x_data.mif
|
||||
-- Generated: Sat Oct 5 23:58:13 2019
|
||||
|
||||
WIDTH=1;
|
||||
DEPTH=144;
|
||||
|
||||
ADDRESS_RADIX=UNS;
|
||||
DATA_RADIX=UNS;
|
||||
|
||||
CONTENT BEGIN
|
||||
0 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
1 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
2 : 0; -- Loop Filter Capacitance = 0 (2 bit(s)) (Setting 0)
|
||||
3 : 0;
|
||||
4 : 1; -- Loop Filter Resistance = 27 (5 bit(s)) (Setting 27)
|
||||
5 : 1;
|
||||
6 : 0;
|
||||
7 : 1;
|
||||
8 : 1;
|
||||
9 : 0; -- VCO Post Scale = 0 (1 bit(s)) (VCO post-scale divider counter value = 2)
|
||||
10 : 0; -- Reserved Bits = 0 (5 bit(s))
|
||||
11 : 0;
|
||||
12 : 0;
|
||||
13 : 0;
|
||||
14 : 0;
|
||||
15 : 0; -- Charge Pump Current = 1 (3 bit(s)) (Setting 1)
|
||||
16 : 0;
|
||||
17 : 1;
|
||||
18 : 1; -- N counter: Bypass = 1 (1 bit(s))
|
||||
19 : 0; -- N counter: High Count = 0 (8 bit(s))
|
||||
20 : 0;
|
||||
21 : 0;
|
||||
22 : 0;
|
||||
23 : 0;
|
||||
24 : 0;
|
||||
25 : 0;
|
||||
26 : 0;
|
||||
27 : 0; -- N counter: Odd Division = 0 (1 bit(s))
|
||||
28 : 0; -- N counter: Low Count = 0 (8 bit(s))
|
||||
29 : 0;
|
||||
30 : 0;
|
||||
31 : 0;
|
||||
32 : 0;
|
||||
33 : 0;
|
||||
34 : 0;
|
||||
35 : 0;
|
||||
36 : 0; -- M counter: Bypass = 0 (1 bit(s))
|
||||
37 : 0; -- M counter: High Count = 6 (8 bit(s))
|
||||
38 : 0;
|
||||
39 : 0;
|
||||
40 : 0;
|
||||
41 : 0;
|
||||
42 : 1;
|
||||
43 : 1;
|
||||
44 : 0;
|
||||
45 : 0; -- M counter: Odd Division = 0 (1 bit(s))
|
||||
46 : 0; -- M counter: Low Count = 6 (8 bit(s))
|
||||
47 : 0;
|
||||
48 : 0;
|
||||
49 : 0;
|
||||
50 : 0;
|
||||
51 : 1;
|
||||
52 : 1;
|
||||
53 : 0;
|
||||
54 : 0; -- clk0 counter: Bypass = 0 (1 bit(s))
|
||||
55 : 0; -- clk0 counter: High Count = 2 (8 bit(s))
|
||||
56 : 0;
|
||||
57 : 0;
|
||||
58 : 0;
|
||||
59 : 0;
|
||||
60 : 0;
|
||||
61 : 1;
|
||||
62 : 0;
|
||||
63 : 0; -- clk0 counter: Odd Division = 0 (1 bit(s))
|
||||
64 : 0; -- clk0 counter: Low Count = 2 (8 bit(s))
|
||||
65 : 0;
|
||||
66 : 0;
|
||||
67 : 0;
|
||||
68 : 0;
|
||||
69 : 0;
|
||||
70 : 1;
|
||||
71 : 0;
|
||||
72 : 0; -- clk1 counter: Bypass = 0 (1 bit(s))
|
||||
73 : 0; -- clk1 counter: High Count = 2 (8 bit(s))
|
||||
74 : 0;
|
||||
75 : 0;
|
||||
76 : 0;
|
||||
77 : 0;
|
||||
78 : 0;
|
||||
79 : 1;
|
||||
80 : 0;
|
||||
81 : 1; -- clk1 counter: Odd Division = 1 (1 bit(s))
|
||||
82 : 0; -- clk1 counter: Low Count = 1 (8 bit(s))
|
||||
83 : 0;
|
||||
84 : 0;
|
||||
85 : 0;
|
||||
86 : 0;
|
||||
87 : 0;
|
||||
88 : 0;
|
||||
89 : 1;
|
||||
90 : 1; -- clk2 counter: Bypass = 1 (1 bit(s))
|
||||
91 : 0; -- clk2 counter: High Count = 0 (8 bit(s))
|
||||
92 : 0;
|
||||
93 : 0;
|
||||
94 : 0;
|
||||
95 : 0;
|
||||
96 : 0;
|
||||
97 : 0;
|
||||
98 : 0;
|
||||
99 : 0; -- clk2 counter: Odd Division = 0 (1 bit(s))
|
||||
100 : 0; -- clk2 counter: Low Count = 0 (8 bit(s))
|
||||
101 : 0;
|
||||
102 : 0;
|
||||
103 : 0;
|
||||
104 : 0;
|
||||
105 : 0;
|
||||
106 : 0;
|
||||
107 : 0;
|
||||
108 : 1; -- clk3 counter: Bypass = 1 (1 bit(s))
|
||||
109 : 0; -- clk3 counter: High Count = 0 (8 bit(s))
|
||||
110 : 0;
|
||||
111 : 0;
|
||||
112 : 0;
|
||||
113 : 0;
|
||||
114 : 0;
|
||||
115 : 0;
|
||||
116 : 0;
|
||||
117 : 0; -- clk3 counter: Odd Division = 0 (1 bit(s))
|
||||
118 : 0; -- clk3 counter: Low Count = 0 (8 bit(s))
|
||||
119 : 0;
|
||||
120 : 0;
|
||||
121 : 0;
|
||||
122 : 0;
|
||||
123 : 0;
|
||||
124 : 0;
|
||||
125 : 0;
|
||||
126 : 1; -- clk4 counter: Bypass = 1 (1 bit(s))
|
||||
127 : 0; -- clk4 counter: High Count = 0 (8 bit(s))
|
||||
128 : 0;
|
||||
129 : 0;
|
||||
130 : 0;
|
||||
131 : 0;
|
||||
132 : 0;
|
||||
133 : 0;
|
||||
134 : 0;
|
||||
135 : 0; -- clk4 counter: Odd Division = 0 (1 bit(s))
|
||||
136 : 0; -- clk4 counter: Low Count = 0 (8 bit(s))
|
||||
137 : 0;
|
||||
138 : 0;
|
||||
139 : 0;
|
||||
140 : 0;
|
||||
141 : 0;
|
||||
142 : 0;
|
||||
143 : 0;
|
||||
END;
|
174
rtl/pll_config_default_data.mif
Normal file
174
rtl/pll_config_default_data.mif
Normal file
|
@ -0,0 +1,174 @@
|
|||
-- Copyright (C) 2017 Intel Corporation. All rights reserved.
|
||||
-- Your use of Intel Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Intel Program License
|
||||
-- Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
-- the Intel FPGA IP License Agreement, or other applicable license
|
||||
-- agreement, including, without limitation, that your use is for
|
||||
-- the sole purpose of programming logic devices manufactured by
|
||||
-- Intel and sold by Intel or its authorized distributors. Please
|
||||
-- refer to the applicable agreement for further details.
|
||||
|
||||
-- MIF file representing initial state of PLL Scan Chain
|
||||
-- Device Family: Cyclone IV E
|
||||
-- Device Part: -
|
||||
-- Device Speed Grade: 8
|
||||
-- PLL Scan Chain: Fast PLL (144 bits)
|
||||
-- File Name: /home/markus/Code/ossc/rtl/pll_config_default_data.mif
|
||||
-- Generated: Wed Oct 9 22:20:06 2019
|
||||
|
||||
WIDTH=1;
|
||||
DEPTH=144;
|
||||
|
||||
ADDRESS_RADIX=UNS;
|
||||
DATA_RADIX=UNS;
|
||||
|
||||
CONTENT BEGIN
|
||||
0 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
1 : 0; -- Reserved Bits = 0 (1 bit(s))
|
||||
2 : 0; -- Loop Filter Capacitance = 0 (2 bit(s)) (Setting 0)
|
||||
3 : 0;
|
||||
4 : 1; -- Loop Filter Resistance = 27 (5 bit(s)) (Setting 27)
|
||||
5 : 1;
|
||||
6 : 0;
|
||||
7 : 1;
|
||||
8 : 1;
|
||||
9 : 0; -- VCO Post Scale = 0 (1 bit(s)) (VCO post-scale divider counter value = 2)
|
||||
10 : 0; -- Reserved Bits = 0 (5 bit(s))
|
||||
11 : 0;
|
||||
12 : 0;
|
||||
13 : 0;
|
||||
14 : 0;
|
||||
15 : 0; -- Charge Pump Current = 1 (3 bit(s)) (Setting 1)
|
||||
16 : 0;
|
||||
17 : 1;
|
||||
18 : 1; -- N counter: Bypass = 1 (1 bit(s))
|
||||
19 : 0; -- N counter: High Count = 0 (8 bit(s))
|
||||
20 : 0;
|
||||
21 : 0;
|
||||
22 : 0;
|
||||
23 : 0;
|
||||
24 : 0;
|
||||
25 : 0;
|
||||
26 : 0;
|
||||
27 : 0; -- N counter: Odd Division = 0 (1 bit(s))
|
||||
28 : 0; -- N counter: Low Count = 0 (8 bit(s))
|
||||
29 : 0;
|
||||
30 : 0;
|
||||
31 : 0;
|
||||
32 : 0;
|
||||
33 : 0;
|
||||
34 : 0;
|
||||
35 : 0;
|
||||
36 : 0; -- M counter: Bypass = 0 (1 bit(s))
|
||||
37 : 0; -- M counter: High Count = 8 (8 bit(s))
|
||||
38 : 0;
|
||||
39 : 0;
|
||||
40 : 0;
|
||||
41 : 1;
|
||||
42 : 0;
|
||||
43 : 0;
|
||||
44 : 0;
|
||||
45 : 0; -- M counter: Odd Division = 0 (1 bit(s))
|
||||
46 : 0; -- M counter: Low Count = 8 (8 bit(s))
|
||||
47 : 0;
|
||||
48 : 0;
|
||||
49 : 0;
|
||||
50 : 1;
|
||||
51 : 0;
|
||||
52 : 0;
|
||||
53 : 0;
|
||||
54 : 0; -- clk0 counter: Bypass = 0 (1 bit(s))
|
||||
55 : 0; -- clk0 counter: High Count = 8 (8 bit(s))
|
||||
56 : 0;
|
||||
57 : 0;
|
||||
58 : 0;
|
||||
59 : 1;
|
||||
60 : 0;
|
||||
61 : 0;
|
||||
62 : 0;
|
||||
63 : 0; -- clk0 counter: Odd Division = 0 (1 bit(s))
|
||||
64 : 0; -- clk0 counter: Low Count = 8 (8 bit(s))
|
||||
65 : 0;
|
||||
66 : 0;
|
||||
67 : 0;
|
||||
68 : 1;
|
||||
69 : 0;
|
||||
70 : 0;
|
||||
71 : 0;
|
||||
72 : 0; -- clk1 counter: Bypass = 0 (1 bit(s))
|
||||
73 : 0; -- clk1 counter: High Count = 8 (8 bit(s))
|
||||
74 : 0;
|
||||
75 : 0;
|
||||
76 : 0;
|
||||
77 : 1;
|
||||
78 : 0;
|
||||
79 : 0;
|
||||
80 : 0;
|
||||
81 : 0; -- clk1 counter: Odd Division = 0 (1 bit(s))
|
||||
82 : 0; -- clk1 counter: Low Count = 8 (8 bit(s))
|
||||
83 : 0;
|
||||
84 : 0;
|
||||
85 : 0;
|
||||
86 : 1;
|
||||
87 : 0;
|
||||
88 : 0;
|
||||
89 : 0;
|
||||
90 : 1; -- clk2 counter: Bypass = 1 (1 bit(s))
|
||||
91 : 0; -- clk2 counter: High Count = 0 (8 bit(s))
|
||||
92 : 0;
|
||||
93 : 0;
|
||||
94 : 0;
|
||||
95 : 0;
|
||||
96 : 0;
|
||||
97 : 0;
|
||||
98 : 0;
|
||||
99 : 0; -- clk2 counter: Odd Division = 0 (1 bit(s))
|
||||
100 : 0; -- clk2 counter: Low Count = 0 (8 bit(s))
|
||||
101 : 0;
|
||||
102 : 0;
|
||||
103 : 0;
|
||||
104 : 0;
|
||||
105 : 0;
|
||||
106 : 0;
|
||||
107 : 0;
|
||||
108 : 1; -- clk3 counter: Bypass = 1 (1 bit(s))
|
||||
109 : 0; -- clk3 counter: High Count = 0 (8 bit(s))
|
||||
110 : 0;
|
||||
111 : 0;
|
||||
112 : 0;
|
||||
113 : 0;
|
||||
114 : 0;
|
||||
115 : 0;
|
||||
116 : 0;
|
||||
117 : 0; -- clk3 counter: Odd Division = 0 (1 bit(s))
|
||||
118 : 0; -- clk3 counter: Low Count = 0 (8 bit(s))
|
||||
119 : 0;
|
||||
120 : 0;
|
||||
121 : 0;
|
||||
122 : 0;
|
||||
123 : 0;
|
||||
124 : 0;
|
||||
125 : 0;
|
||||
126 : 1; -- clk4 counter: Bypass = 1 (1 bit(s))
|
||||
127 : 0; -- clk4 counter: High Count = 0 (8 bit(s))
|
||||
128 : 0;
|
||||
129 : 0;
|
||||
130 : 0;
|
||||
131 : 0;
|
||||
132 : 0;
|
||||
133 : 0;
|
||||
134 : 0;
|
||||
135 : 0; -- clk4 counter: Odd Division = 0 (1 bit(s))
|
||||
136 : 0; -- clk4 counter: Low Count = 0 (8 bit(s))
|
||||
137 : 0;
|
||||
138 : 0;
|
||||
139 : 0;
|
||||
140 : 0;
|
||||
141 : 0;
|
||||
142 : 0;
|
||||
143 : 0;
|
||||
END;
|
1657
rtl/scanconverter.v
1657
rtl/scanconverter.v
File diff suppressed because it is too large
Load Diff
196
rtl/videogen.v
196
rtl/videogen.v
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
|
@ -17,37 +17,45 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
`include "lat_tester_includes.v"
|
||||
|
||||
module videogen (
|
||||
input clk27,
|
||||
input reset_n,
|
||||
output [7:0] R_out,
|
||||
output [7:0] G_out,
|
||||
output [7:0] B_out,
|
||||
input lt_active,
|
||||
input [1:0] lt_mode,
|
||||
output reg [7:0] R_out,
|
||||
output reg [7:0] G_out,
|
||||
output reg [7:0] B_out,
|
||||
output reg HSYNC_out,
|
||||
output reg VSYNC_out,
|
||||
output PCLK_out,
|
||||
output reg ENABLE_out
|
||||
output reg DE_out,
|
||||
output reg [9:0] xpos,
|
||||
output reg [9:0] ypos
|
||||
);
|
||||
|
||||
//Parameters for 720x480@59.94Hz (858px x 525lines, pclk 27MHz -> 59.94Hz)
|
||||
parameter H_SYNCLEN = 62;
|
||||
parameter H_BACKPORCH = 60;
|
||||
parameter H_ACTIVE = 720;
|
||||
parameter H_FRONTPORCH = 16;
|
||||
parameter H_TOTAL = 858;
|
||||
parameter H_SYNCLEN = 10'd62;
|
||||
parameter H_BACKPORCH = 10'd60;
|
||||
parameter H_ACTIVE = 10'd720;
|
||||
parameter H_FRONTPORCH = 10'd16;
|
||||
parameter H_TOTAL = 10'd858;
|
||||
|
||||
parameter V_SYNCLEN = 6;
|
||||
parameter V_BACKPORCH = 30;
|
||||
parameter V_ACTIVE = 480;
|
||||
parameter V_FRONTPORCH = 9;
|
||||
parameter V_TOTAL = 525;
|
||||
parameter V_SYNCLEN = 10'd6;
|
||||
parameter V_BACKPORCH = 10'd30;
|
||||
parameter V_ACTIVE = 10'd480;
|
||||
parameter V_FRONTPORCH = 10'd9;
|
||||
parameter V_TOTAL = 10'd525;
|
||||
|
||||
parameter H_OVERSCAN = 40; //at both sides
|
||||
parameter V_OVERSCAN = 16; //top and bottom
|
||||
parameter H_AREA = 640;
|
||||
parameter V_AREA = 448;
|
||||
parameter H_BORDER = (H_AREA-512)/2;
|
||||
parameter V_BORDER = (V_AREA-256)/2;
|
||||
parameter H_OVERSCAN = 10'd40; //at both sides
|
||||
parameter V_OVERSCAN = 10'd16; //top and bottom
|
||||
parameter H_AREA = 10'd640;
|
||||
parameter V_AREA = 10'd448;
|
||||
parameter H_GRADIENT = 10'd512;
|
||||
parameter V_GRADIENT = 10'd256;
|
||||
parameter V_GRAYRAMP = 10'd84;
|
||||
parameter H_BORDER = ((H_AREA-H_GRADIENT)>>1);
|
||||
parameter V_BORDER = ((V_AREA-V_GRADIENT)>>1);
|
||||
|
||||
parameter X_START = H_SYNCLEN + H_BACKPORCH;
|
||||
parameter Y_START = V_SYNCLEN + V_BACKPORCH;
|
||||
|
@ -56,95 +64,91 @@ parameter Y_START = V_SYNCLEN + V_BACKPORCH;
|
|||
reg [9:0] h_cnt; //max. 1024
|
||||
reg [9:0] v_cnt; //max. 1024
|
||||
|
||||
reg [9:0] xpos;
|
||||
reg [9:0] ypos;
|
||||
|
||||
assign PCLK_out = clk27;
|
||||
|
||||
//R, G and B should be 0 outside of active area
|
||||
assign R_out = ENABLE_out ? V_gen : 8'h00;
|
||||
assign G_out = ENABLE_out ? V_gen : 8'h00;
|
||||
assign B_out = ENABLE_out ? V_gen : 8'h00;
|
||||
|
||||
reg [7:0] V_gen;
|
||||
|
||||
|
||||
//HSYNC gen (negative polarity)
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n)
|
||||
begin
|
||||
if (!reset_n) begin
|
||||
h_cnt <= 0;
|
||||
xpos <= 0;
|
||||
HSYNC_out <= 0;
|
||||
end else begin
|
||||
//Hsync counter
|
||||
if (h_cnt < H_TOTAL-1) begin
|
||||
h_cnt <= h_cnt + 1'b1;
|
||||
if (h_cnt >= X_START)
|
||||
xpos <= xpos + 1'b1;
|
||||
end else begin
|
||||
h_cnt <= 0;
|
||||
HSYNC_out <= 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
//Hsync counter
|
||||
if (h_cnt < H_TOTAL-1 )
|
||||
h_cnt <= h_cnt + 1;
|
||||
else
|
||||
h_cnt <= 0;
|
||||
|
||||
//Hsync signal
|
||||
HSYNC_out <= (h_cnt < H_SYNCLEN) ? 0 : 1;
|
||||
xpos <= 0;
|
||||
end
|
||||
|
||||
//Hsync signal
|
||||
HSYNC_out <= (h_cnt < H_SYNCLEN) ? 1'b0 : 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
//VSYNC gen (negative polarity)
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n)
|
||||
begin
|
||||
v_cnt <= 0;
|
||||
VSYNC_out <= 0;
|
||||
if (!reset_n) begin
|
||||
v_cnt <= 0;
|
||||
ypos <= 0;
|
||||
VSYNC_out <= 0;
|
||||
end else begin
|
||||
//Vsync counter
|
||||
if (h_cnt == H_TOTAL-1) begin
|
||||
if (v_cnt < V_TOTAL-1) begin
|
||||
v_cnt <= v_cnt + 1'b1;
|
||||
if (v_cnt >= Y_START)
|
||||
ypos <= ypos + 1'b1;
|
||||
end else begin
|
||||
v_cnt <= 0;
|
||||
ypos <= 0;
|
||||
end
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (h_cnt == 0)
|
||||
begin
|
||||
//Vsync counter
|
||||
if (v_cnt < V_TOTAL-1 )
|
||||
v_cnt <= v_cnt + 1;
|
||||
else
|
||||
v_cnt <= 0;
|
||||
|
||||
//Vsync signal
|
||||
VSYNC_out <= (v_cnt < V_SYNCLEN) ? 0 : 1;
|
||||
|
||||
//Vsync signal
|
||||
VSYNC_out <= (v_cnt < V_SYNCLEN) ? 1'b0 : 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
//Data and ENABLE gen
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n) begin
|
||||
R_out <= 8'h00;
|
||||
G_out <= 8'h00;
|
||||
B_out <= 8'h00;
|
||||
DE_out <= 1'b0;
|
||||
end else begin
|
||||
if (lt_active) begin
|
||||
case (lt_mode)
|
||||
default: begin
|
||||
{R_out, G_out, B_out} <= {3{8'h00}};
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
//Data gen
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n)
|
||||
begin
|
||||
V_gen <= 8'h00;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if ((h_cnt < X_START+H_OVERSCAN) || (h_cnt >= X_START+H_OVERSCAN+H_AREA) || (v_cnt < Y_START+V_OVERSCAN) || (v_cnt >= Y_START+V_OVERSCAN+V_AREA))
|
||||
V_gen <= (h_cnt[0] ^ v_cnt[0]) ? 8'hff : 8'h00;
|
||||
else if ((h_cnt < X_START+H_OVERSCAN+H_BORDER) || (h_cnt >= X_START+H_OVERSCAN+H_AREA-H_BORDER) || (v_cnt < Y_START+V_OVERSCAN+V_BORDER) || (v_cnt >= Y_START+V_OVERSCAN+V_AREA-V_BORDER))
|
||||
V_gen <= 8'h50;
|
||||
`LT_POS_TOPLEFT: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos < (H_ACTIVE/`LT_WIDTH_DIV)) && (ypos < (V_ACTIVE/`LT_HEIGHT_DIV))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
`LT_POS_CENTER: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos >= ((H_ACTIVE/2)-(H_ACTIVE/(`LT_WIDTH_DIV*2)))) && (xpos < ((H_ACTIVE/2)+(H_ACTIVE/(`LT_WIDTH_DIV*2)))) && (ypos >= ((V_ACTIVE/2)-(V_ACTIVE/(`LT_HEIGHT_DIV*2)))) && (ypos < ((V_ACTIVE/2)+(V_ACTIVE/(`LT_HEIGHT_DIV*2))))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
`LT_POS_BOTTOMRIGHT: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos >= (H_ACTIVE-(H_ACTIVE/`LT_WIDTH_DIV))) && (ypos >= (V_ACTIVE-(V_ACTIVE/`LT_HEIGHT_DIV)))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
endcase
|
||||
end else begin
|
||||
if ((xpos < H_OVERSCAN) || (xpos >= H_OVERSCAN+H_AREA) || (ypos < V_OVERSCAN) || (ypos >= V_OVERSCAN+V_AREA))
|
||||
{R_out, G_out, B_out} <= {3{(xpos[0] ^ ypos[0]) ? 8'hff : 8'h00}};
|
||||
else if ((xpos < H_OVERSCAN+H_BORDER) || (xpos >= H_OVERSCAN+H_AREA-H_BORDER) || (ypos < V_OVERSCAN+V_BORDER) || (ypos >= V_OVERSCAN+V_AREA-V_BORDER))
|
||||
{R_out, G_out, B_out} <= {3{8'h50}};
|
||||
else if (ypos >= V_OVERSCAN+V_BORDER+V_GRADIENT-V_GRAYRAMP)
|
||||
{R_out, G_out, B_out} <= {3{8'((((xpos - (H_OVERSCAN+H_BORDER)) >> 4) << 3) + (xpos - (H_OVERSCAN+H_BORDER) >> 6))}};
|
||||
else
|
||||
V_gen <= (h_cnt - (X_START+H_OVERSCAN+H_BORDER)) >> 1;
|
||||
/*else
|
||||
V_gen <= 8'h00;*/
|
||||
{R_out, G_out, B_out} <= {3{8'((xpos - (H_OVERSCAN+H_BORDER)) >> 1)}};
|
||||
end
|
||||
end
|
||||
|
||||
//Enable gen
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n)
|
||||
begin
|
||||
ENABLE_out <= 8'h00;
|
||||
end
|
||||
else
|
||||
begin
|
||||
ENABLE_out <= (h_cnt >= X_START && h_cnt < X_START + H_ACTIVE && v_cnt >= Y_START && v_cnt < Y_START + V_ACTIVE);
|
||||
end
|
||||
DE_out <= (h_cnt >= X_START && h_cnt < X_START + H_ACTIVE && v_cnt >= Y_START && v_cnt < Y_START + V_ACTIVE);
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
7
scripts/reprogram.sh
Executable file
7
scripts/reprogram.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
make rv-reprogram
|
||||
|
||||
if [ $# -eq 1 ] && [ $1 = "jtag_uart" ] && [ $(pgrep -c nios2-terminal) = 0 ]; then
|
||||
nios2-terminal
|
||||
fi
|
25
scripts/rv-reprogram.tcl
Normal file
25
scripts/rv-reprogram.tcl
Normal file
|
@ -0,0 +1,25 @@
|
|||
#Select the master service type and check for available service paths.
|
||||
set service_paths [get_service_paths master]
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
|
||||
#Open the master service.
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU"
|
||||
master_write_32 $claim_path 0x0 0x1
|
||||
|
||||
puts "Writing block RAM"
|
||||
master_write_from_file $claim_path mem_init/sys_onchip_memory2_0.bin 0x10000
|
||||
|
||||
close_service master $claim_path
|
||||
|
||||
|
||||
set jtag_debug_list [get_service_paths jtag_debug]
|
||||
set jd [ lindex $jtag_debug_list 0 ]
|
||||
open_service jtag_debug $jd
|
||||
puts "Resetting system"
|
||||
jtag_debug_reset_system $jd
|
||||
close_service jtag_debug $jd
|
||||
puts "Done"
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CodeLite_Project Name="ossc_sw" InternalType="">
|
||||
<CodeLite_Project Name="ossc_sw" InternalType="" Version="11000">
|
||||
<Plugins>
|
||||
<Plugin Name="qmake">
|
||||
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
|
||||
|
@ -26,6 +26,15 @@
|
|||
}]]]>
|
||||
</Plugin>
|
||||
</Plugins>
|
||||
<Reconciliation>
|
||||
<Regexes/>
|
||||
<Excludepaths/>
|
||||
<Ignorefiles/>
|
||||
<Extensions>
|
||||
<![CDATA[*.cpp;*.c;*.h;*.hpp;*.xrc;*.wxcp;*.fbp]]>
|
||||
</Extensions>
|
||||
<Topleveldir>/home/markus/Code/ossc/software</Topleveldir>
|
||||
</Reconciliation>
|
||||
<VirtualDirectory Name="sys_controller">
|
||||
<VirtualDirectory Name="ths7353">
|
||||
<File Name="sys_controller/ths7353/ths7353.h"/>
|
||||
|
@ -58,8 +67,41 @@
|
|||
<File Name="sys_controller/tvp7002/tvp7002.h"/>
|
||||
<File Name="sys_controller/tvp7002/tvp7002.c"/>
|
||||
</VirtualDirectory>
|
||||
<File Name="sys_controller/av_controller.c"/>
|
||||
<File Name="sys_controller/sysconfig.h"/>
|
||||
<VirtualDirectory Name="memory">
|
||||
<File Name="sys_controller/memory/flash.h"/>
|
||||
<File Name="sys_controller/memory/flash.c"/>
|
||||
<File Name="sys_controller/memory/sdcard.h"/>
|
||||
<File Name="sys_controller/memory/sdcard.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ossc">
|
||||
<File Name="sys_controller/ossc/utils.h"/>
|
||||
<File Name="sys_controller/ossc/utils.c"/>
|
||||
<File Name="sys_controller/ossc/menu.c"/>
|
||||
<File Name="sys_controller/ossc/menu.h"/>
|
||||
<File Name="sys_controller/ossc/sysconfig.h"/>
|
||||
<File Name="sys_controller/ossc/controls.h"/>
|
||||
<File Name="sys_controller/ossc/controls.c"/>
|
||||
<File Name="sys_controller/ossc/avconfig.h"/>
|
||||
<File Name="sys_controller/ossc/avconfig.c"/>
|
||||
<File Name="sys_controller/ossc/av_controller.c"/>
|
||||
<File Name="sys_controller/ossc/av_controller.h"/>
|
||||
<File Name="sys_controller/ossc/firmware.h"/>
|
||||
<File Name="sys_controller/ossc/firmware.c"/>
|
||||
<File Name="sys_controller/ossc/userdata.h"/>
|
||||
<File Name="sys_controller/ossc/userdata.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ulibSD">
|
||||
<File Name="sys_controller/ulibSD/integer.h"/>
|
||||
<File Name="sys_controller/ulibSD/sd_io.c"/>
|
||||
<File Name="sys_controller/ulibSD/sd_io.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="pcm1862">
|
||||
<File Name="sys_controller/pcm1862/pcm1862.c"/>
|
||||
<File Name="sys_controller/pcm1862/pcm1862.h"/>
|
||||
<File Name="sys_controller/pcm1862/pcm1862_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
|
@ -81,7 +123,8 @@
|
|||
</Compiler>
|
||||
<Linker Options="" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="nios2-download -g --accept-bad-sysid sys_controller.elf && nios2-terminal" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(ProjectPath)/sys_controller" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Debug" Command="../../scripts/reprogram.sh" CommandArguments="jtag_uart" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(ProjectPath)/sys_controller" PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -93,9 +136,12 @@
|
|||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="yes">
|
||||
<Target Name="compile_image_debug">make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</Target>
|
||||
<Target Name="compile_image_aud-debug">make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</Target>
|
||||
<Target Name="Ack BSP update">cd ../sys_controller_bsp && touch bsp_timestamp</Target>
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make APP_CFLAGS_DEFINED_SYMBOLS="-DDEBUG"</BuildCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
|
@ -119,7 +165,8 @@
|
|||
</Compiler>
|
||||
<Linker Options="-O2" Required="yes"/>
|
||||
<ResourceCompiler Options="" Required="no"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Release" Command="nios2-download -g --accept-bad-sysid sys_controller.elf" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(ProjectPath)/sys_controller" PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<General OutputFile="" IntermediateDirectory="./Release" Command="../../scripts/reprogram.sh" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(ProjectPath)/sys_controller" PauseExecWhenProcTerminates="no" IsGUIProgram="no" IsEnabled="yes"/>
|
||||
<BuildSystem Name="Default"/>
|
||||
<Environment EnvVarSetName="<Use Defaults>" DbgSetName="<Use Defaults>">
|
||||
<![CDATA[]]>
|
||||
</Environment>
|
||||
|
@ -131,10 +178,16 @@
|
|||
<PreBuild/>
|
||||
<PostBuild/>
|
||||
<CustomBuild Enabled="yes">
|
||||
<Target Name="compile_image">make mem_init_generate</Target>
|
||||
<Target Name="compile_image_jp">make OSDLANG=JP generate_hex</Target>
|
||||
<Target Name="compile_image_aud_jp">make ENABLE_AUDIO=y OSDLANG=JP generate_hex</Target>
|
||||
<Target Name="compile_image_aud">make ENABLE_AUDIO=y generate_hex</Target>
|
||||
<Target Name="compile_image">make generate_hex</Target>
|
||||
<Target Name="Build_jp">make OSDLANG=JP</Target>
|
||||
<Target Name="Build_audio">make ENABLE_AUDIO=y</Target>
|
||||
<Target Name="Ack BSP update">cd ../sys_controller_bsp && touch bsp_timestamp</Target>
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make</BuildCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y generate_hex</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user