⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbmmc_variable.v

📁 实现USB接口功能的VHDL和verilog完整源代码
💻 V
字号:
//`define SETGET
`define USB_48_CLOCK_PERIOD 	(22)  // unit : ns
`define USB_48_CLOCK_DURATION	(`USB_48_CLOCK_PERIOD/2)
`define USB_CLOCK_PERIOD 	(`USB_48_CLOCK_PERIOD*4)  // unit : ns
`define USB_CLOCK_DURATION 	(`USB_CLOCK_PERIOD/2)  // unit : ns
//`define DATA_DURATION		(22*5)
`define DIVIDE_RATE_INITIAL     (2'b00)
`define DUMMY_COUNT_INITIAL     (2'b00)
`define DATA_DURATION		(44)
`define BYTE 			(7)
`define HIGH    		(1'b1)    
`define LOW     		(1'b0)   
`define COUNT_INITIAL_VALUE     (3'b000)   
`define COUNT_ONE       	(4'b0001)   
`define COUNT_TWO       	(4'b0010)   
`define COUNT_THREE     	(4'b0011)   
`define COUNT_FOUR     		(4'b0100)   
`define COUNT_FIVE     		(4'b0101)   
`define COUNT_SIX     		(4'b0110)   
`define COUNT_SEVEN             (4'b0111)   
`define COUNT_EIGHT             (4'b1000)   
`define COUNT_NINE              (4'b1001)   
`define COUNT_TEN               (4'b1010)   
`define COUNT_ELEVEN            (4'b1011)   
`define TIMEOUT_VALUE_SPI       (168)
`define TIMEOUT_VALUE_MMC       (160)
`define TIMEOUT_READ_VALUE_MMC  (3'b111)

`define FINISH_TIME		(1000000)
//`define RESET_TIME		(800)
`define CRC_ERROR_COUNT_INITIAL (8'b0000_0000)
`define TIMEOUT_ERR_COUNT_INITIAL (8'b0000_0000)
`define BYTE_INITIAL_VALUE	(8'b0000_0000)
`define RESET_COUNT_INITIAL     (7'b000_0000)
`define	MSB			(7)
`define	LSB			(0)
`define	DEFAULT_DATA_OUT	(`HIGH)
`define BIT_COUNT_INITIAL	(4'b0000)
`define LEN_BIT_COUNT		4
`define	GEN_LOCK		(4'b1000)
`define	GEN_WR			(4'b0111)
`define	GEN_TRANSMIT		(4'b1001)
`define	GEN_RELEASE		(4'b1001)
`define BYTE_COUNT_INITIAL	(8'b1111_1111)
`define R_BYTE_COUNT_INITIAL	(8'b1111_1111)
`define DATA_INITIAL	        (8'b1111_1111)
`define CHECK_RESP              (4'b1110)
`define HOLD_RESP               (4'b1101)
`define LEN_R_BYTE_COUNT	8
`define LEN_LOCK_COUNT		2
`define LOCK_COUNT_INITIAL	(2'b00)
`define LOCK_COUNT_TWO		(2'b01)
`define R_BIT_COUNT_INITIAL	(4'b0000)
`define LEN_R_BIT_COUNT		4
`define WR_COUNT_INITIAL	(2'b00)
`define LEN_WR_COUNT		2
`define WR_COUNT_TWO		(2'b01)
`define	LONGEST_TIME		(90000)
`define CAPTURE_DATA		(4'b1110)
`define	THIRTY_ONE              (30)
`define	THIRTY_TWO              (31)
`define	EIGHTEEN                (17)
`define	SEVENTEEN               (16)
`define	SIXTEEN                 (15)
`define	FIFTEEN                 (14)
`define	NINE                    (8)
`define	SEVEN                   (6)
`define	SIX                     (5)
`define	FIVE			(4)
`define	FOUR			(3)
`define	THREE			(2)
`define	TWO			(1)
`define	ONE			(0)
`define GEN_START_RECEIVE       (4'b1000)
`define GEN_RECEIVE		4'b1110, 4'b1101, 4'b1100, 4'b1011, 4'b1010, 4'b1001, 4'b1000
`define LAST_RECEIVE		(4'b1000)
`define	END_RECEIVE		(4'b0111)
`define LEN_CMD                 (6)
`define CMD_MODE                `LOW
`define DATA_MODE               `HIGH

`define CRC_ERROR               (1)
`define CRC_NOERROR             (0)
`define BLOCK_COUNT_INITIAL     (5'b1_1111)
`define TIMEOUT_COUNT_INITIAL   (17'b0_0000_0000_0000_0000)
`define PRE_COUNT_INITIAL       (5'b0_0000)
`define START_DUMMY_CLOCK       (5'b0_0001)
`define END_DUMMY_CLOCK         (5'b1_0001)
`define	UD			#1 
`define CMD00			(6'b00_0000)
`define CMD01			(6'b00_0001)
`define CMD09			(6'b00_1001)
`define CMD10			(6'b00_1010)
`define CMD13			(6'b00_1101)
`define CMD16			(6'b01_0000)
`define CMD17			(6'b01_0001)
`define CMD24			(6'b01_1000)
`define CMD27			(6'b01_1011)
`define CMD28			(6'b01_1100)
`define CMD29			(6'b01_1101)
`define CMD30			(6'b01_1110)
`define CMD32			(6'b10_0000)
`define CMD33			(6'b10_0001)
`define CMD34			(6'b10_0010)
`define CMD35			(6'b10_0011)

`define R1			(`CMD00, `CMD01, `CMD09, `CMD10, `CMD16, `CMD17, `CMD30, `CMD32, `CMD33, `CMD34, `CMD35)
`define R2			(`CMD13) 
`define R1B			(`CMD24, `CMD27, `CMD28, `CMD29)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -