verilator litex soc
parent
81f5d8dca2
commit
7dc2afc522
@ -0,0 +1,50 @@
|
||||
.section .text, "ax", @progbits
|
||||
# called by bios boot commands to do the jump to code (r1,r2,r3 can be specified in terminal 'boot' command)
|
||||
|
||||
.include "defines.s"
|
||||
|
||||
.global boot_helper
|
||||
# extern void boot_helper(unsigned long r1, unsigned long r2, unsigned long r3, unsigned long addr);
|
||||
|
||||
.align 4
|
||||
boot_helper:
|
||||
lis r3,_fstack@h
|
||||
ori r3,r3,_fstack@l # top o mem
|
||||
mtctr r6
|
||||
bctr # jump to callee
|
||||
|
||||
# play with stack. what could go wrong?
|
||||
# r1 = new top
|
||||
# orig lr 20(r1)
|
||||
# ancient r1 16(r1)
|
||||
# local1 12(r1)
|
||||
# local2 8(r1)
|
||||
# (next lr) 4(r1)
|
||||
# orig r1 0(r1)
|
||||
# doesnt help...getting a bad op, probably blr to wrong address off stack, within calls to do a putchar
|
||||
stwu r1,-32(r1)
|
||||
mflr r0
|
||||
stw r0,36(r1)
|
||||
stw r3,8(r1)
|
||||
stw r4,12(r1)
|
||||
stw r5,16(r1)
|
||||
stw r6,20(r1)
|
||||
li r3,'w'
|
||||
slwi r3,r3,8
|
||||
ori r3,r3,'t'
|
||||
slwi r3,r3,8
|
||||
ori r3,r3,'f'
|
||||
slwi r3,r3,8
|
||||
ori r3,r3,'!'
|
||||
stw r3,24(r1)
|
||||
stw r3,28(r1)
|
||||
lwz r0,36(r1)
|
||||
mtlr r6
|
||||
addi r1,r1,32
|
||||
blr
|
||||
|
||||
#addi r1,r1,32 # leave frame on stack
|
||||
#mtctr r6
|
||||
#bctrl # jump to callee
|
||||
|
||||
b .
|
@ -0,0 +1,973 @@
|
||||
# debug code for mem
|
||||
#.set TEST_MEM,1
|
||||
|
||||
# boot code for rom integration with litex terminal code
|
||||
# requires 64K ROM
|
||||
# got rid of int handlers for now to shrink this code
|
||||
|
||||
# cmod7 - skip ddr stuff
|
||||
|
||||
# set for sim bypass version
|
||||
#.set SIM,1 # this skips uart, ram check, etc.
|
||||
#.set DELAY,0x00000005
|
||||
|
||||
# general delay (leds)
|
||||
# should probs put this in a mem loc so it can be easily changed w/o compile
|
||||
.set DELAY,0x01000000 # hardware (~1 secs)
|
||||
#.set DELAY,0x00000100
|
||||
|
||||
# csr.csv
|
||||
# need to set up CONFIG:
|
||||
#csr_base,dna,0xfff00000,,
|
||||
#csr_base,xadc,0xfff00800,,
|
||||
#csr_base,leds,0xfff01000,,
|
||||
#csr_base,buttons,0xfff01800,,
|
||||
#csr_base,i2c,0xfff02000,,
|
||||
#csr_base,motor_0,0xfff02800,,
|
||||
#csr_base,ctrl,0xfff03000,,
|
||||
#csr_base,identifier_mem,0xfff03800,,
|
||||
#csr_base,timer0,0xfff04000,,
|
||||
#csr_base,uart,0xfff04800,,
|
||||
|
||||
#
|
||||
#memory_region,rom,0x00000000,65536,cached
|
||||
#memory_region,ram,0x00010000,4096,cached
|
||||
#memory_region,sram,0x80000000,4096,cached
|
||||
#memory_region,csr,0xfff00000,65536,io
|
||||
|
||||
.include "defines.s"
|
||||
|
||||
#.section .hwinit # @00000000
|
||||
# change to use litex linker.ld
|
||||
.section .text
|
||||
|
||||
.global _start
|
||||
|
||||
# reset
|
||||
_start:
|
||||
b boot_start
|
||||
|
||||
.set REGSAVE,0x04
|
||||
regsave:
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
|
||||
# ddr setup delay (intracommand)
|
||||
.ifdef SIM
|
||||
.set DDR_DELAY,0x00000010 # sim
|
||||
.else
|
||||
.set DDR_DELAY,0x00020000
|
||||
.endif
|
||||
|
||||
.align 6
|
||||
.set CONFIG,0x40
|
||||
|
||||
#.set SRAM_BASE, 0x00010000 # get from _fdata
|
||||
#.set STACK, 0x0001FFF8 # first save of r0 is 4 past this! #get from _fstack
|
||||
|
||||
.set MAGIC, 0x08675309
|
||||
|
||||
rom_lo: .long 0
|
||||
rom_hi: .long 0xFFFF
|
||||
sram_lo: .long 0 # get from link syms; does chk for -1 to skip test
|
||||
sram_hi: .long 0
|
||||
ddr_lo: .long 0xFFFFFFFF # -1: no gots
|
||||
ddr_hi: .long 0xF7FFFFFF
|
||||
|
||||
ctrl: .long 0xFFF03000
|
||||
cpu: .long 0xFFFFFFFF # -1: no gots
|
||||
uart: .long 0xFFF04800 # -1: no gots
|
||||
leds: .long 0xFFF01000 # -1: no gots
|
||||
switches: .long 0xFFFFFFFF # -1: no gots
|
||||
buttons: .long 0xFFF01800 # -1: no gots
|
||||
sdram: .long 0xFFFFFFFF
|
||||
eob_data: .long MAGIC
|
||||
|
||||
# offsets for uart functions
|
||||
.set UART_RXTX, 0x00
|
||||
.set UART_TXFULL, 0x04
|
||||
.set UART_RXEMPTY, 0x08
|
||||
.set UART_EV_STATUS, 0x0C
|
||||
.set UART_EV_PENDING, 0x10
|
||||
.set UART_EV_ENABLE, 0x14
|
||||
.set UART_TXEMPTY, 0x18
|
||||
.set UART_RXFULL, 0x1C
|
||||
.set UARTX_RXTX, 0x20
|
||||
.set UARTX_TXFULL, 0x24
|
||||
.set UARTX_RXEMPTY, 0x28
|
||||
.set UARTX_EV_STATUS, 0x2C
|
||||
.set UARTX_EV_PENDING, 0x30
|
||||
.set UARTX_EV_ENABLE, 0x34
|
||||
.set UARTX_TXEMPTY, 0x38
|
||||
.set UARTX_RXFULL, 0x3C
|
||||
|
||||
.align 7
|
||||
.set CONFIG_DDR,0x80
|
||||
|
||||
#wtf can litex be forced to put these at specific offsets from csr_base???
|
||||
sdram_dfii: .long 0xFFF06000 # csr_register,sdram_dfii_control,0xfff05000,1,rw
|
||||
ddr_cmd_delay: .long DDR_DELAY
|
||||
ddr_chk_loops: .long 1 # 0=infinite
|
||||
ddr_mrs0: .long 0 # wtf eventually set these up as config vals
|
||||
|
||||
# offsets from sdram_dfii base
|
||||
.set DFII_CONTROL, 0x00
|
||||
.set DFII_PI0_COMMAND, 0x04
|
||||
.set DFII_PI0_COMMAND_ISSUE, 0x08
|
||||
.set DFII_PI0_ADDRESS, 0x0C
|
||||
.set DFII_PI0_BADDRESS, 0x10
|
||||
.set DFII_PI0_WRDATA, 0x14
|
||||
.set DFII_PI0_RDDATA, 0x18
|
||||
.set DFII_PI1_COMMAND, 0x1C
|
||||
.set DFII_PI1_COMMAND_ISSUE, 0x20
|
||||
.set DFII_PI1_ADDRESS, 0x24
|
||||
.set DFII_PI1_BADDRESS, 0x28
|
||||
.set DFII_PI1_WRDATA, 0x2C
|
||||
.set DFII_PI1_RDDATA, 0x30
|
||||
|
||||
# bits
|
||||
.set CONTROL_SEL, 0x01
|
||||
.set CONTROL_CKE, 0x02
|
||||
.set CONTROL_ODT, 0x04 #wtf does this exist for ddr2??
|
||||
.set CONTROL_RESET_N, 0x08
|
||||
.set COMMAND_CS, 0x01
|
||||
.set COMMAND_WE, 0x02
|
||||
.set COMMAND_CAS, 0x04
|
||||
.set COMMAND_RAS, 0x08
|
||||
.set COMMAND_WRDATA, 0x10
|
||||
.set COMMAND_RDDATA, 0x20
|
||||
.set DDR_PARM_DELAY, 0x00020000
|
||||
|
||||
#
|
||||
.align 8
|
||||
int_100:
|
||||
b .
|
||||
|
||||
# mck
|
||||
.align 8
|
||||
int_200:
|
||||
b .
|
||||
|
||||
# dsi
|
||||
.align 8
|
||||
int_300:
|
||||
b .
|
||||
|
||||
# dseg
|
||||
.align 7
|
||||
int_380:
|
||||
b .
|
||||
|
||||
# isi
|
||||
.align 8
|
||||
int_400:
|
||||
b .
|
||||
|
||||
# iseg
|
||||
.align 7
|
||||
int_480:
|
||||
b .
|
||||
|
||||
# external
|
||||
.align 8
|
||||
int_500:
|
||||
b .
|
||||
|
||||
# alignment
|
||||
.align 8
|
||||
int_600:
|
||||
b .
|
||||
|
||||
# program
|
||||
.align 8
|
||||
int_700:
|
||||
b .
|
||||
|
||||
# fp unavailable
|
||||
.align 8
|
||||
int_800:
|
||||
b .
|
||||
|
||||
# dec
|
||||
.align 8
|
||||
int_900:
|
||||
b .
|
||||
|
||||
# dec hyp
|
||||
.align 7
|
||||
int_980:
|
||||
b .
|
||||
|
||||
# doorbell
|
||||
.align 8# offsets from sdram_dfii base
|
||||
.set DFII_CONTROL, 0x00
|
||||
.set DFII_PI0_COMMAND, 0x04
|
||||
.set DFII_PI0_COMMAND_ISSUE, 0x08
|
||||
.set DFII_PI0_ADDRESS, 0x0C
|
||||
.set DFII_PI0_BADDRESS, 0x10
|
||||
.set DFII_PI0_WRDATA, 0x14
|
||||
.set DFII_PI0_RDDATA, 0x18
|
||||
.set DFII_PI1_COMMAND, 0x1C
|
||||
.set DFII_PI1_COMMAND_ISSUE, 0x20
|
||||
.set DFII_PI1_ADDRESS, 0x24
|
||||
.set DFII_PI1_BADDRESS, 0x28
|
||||
.set DFII_PI1_WRDATA, 0x2C
|
||||
.set DFII_PI1_RDDATA, 0x30
|
||||
|
||||
# bits
|
||||
.set CONTROL_SEL, 0x01
|
||||
.set CONTROL_CKE, 0x02
|
||||
.set CONTROL_ODT, 0x04 #wtf does this exist for ddr2??
|
||||
.set CONTROL_RESET_N, 0x08
|
||||
.set COMMAND_CS, 0x01
|
||||
.set COMMAND_WE, 0x02
|
||||
.set COMMAND_CAS, 0x04
|
||||
.set COMMAND_RAS, 0x08
|
||||
.set COMMAND_WRDATA, 0x10
|
||||
.set COMMAND_RDDATA, 0x20
|
||||
.set DDR_PARM_DELAY, 0x00020000
|
||||
int_C00:
|
||||
b .
|
||||
|
||||
# trace
|
||||
.align 8
|
||||
int_D00:
|
||||
b .
|
||||
|
||||
# dsi hyp
|
||||
.align 8
|
||||
int_E00:
|
||||
b .
|
||||
|
||||
# isi hyp
|
||||
.align 5
|
||||
int_E20:
|
||||
b .
|
||||
|
||||
# emulation hyp
|
||||
.align 5
|
||||
int_E40:
|
||||
b .
|
||||
|
||||
# maintenance hyp
|
||||
.align 5
|
||||
int_E60:
|
||||
b .
|
||||
|
||||
# doorbell hyp
|
||||
.align 5
|
||||
int_E80:
|
||||
b .
|
||||
|
||||
# virtualization hyp
|
||||
.align 5
|
||||
int_EA0:
|
||||
b .
|
||||
|
||||
# reserved
|
||||
.align 5
|
||||
int_EC0:
|
||||
b .
|
||||
|
||||
# reserved
|
||||
.align 5
|
||||
int_EE0:
|
||||
b .
|
||||
|
||||
# perfmon
|
||||
.align 5
|
||||
int_F00:
|
||||
b .
|
||||
|
||||
# vector unavailable
|
||||
.align 5
|
||||
int_F20:
|
||||
b .
|
||||
|
||||
# vsx unavailable
|
||||
.align 5
|
||||
int_F40:
|
||||
b .
|
||||
|
||||
# facility unavailable
|
||||
.align 5
|
||||
int_F60:
|
||||
b .
|
||||
|
||||
# facility unavailable hyp
|
||||
.align 5
|
||||
int_F80:
|
||||
b .
|
||||
|
||||
# ------------------------------------------------------------------------------------------------------------------------------
|
||||
# init facilities and memories before blastoff
|
||||
#
|
||||
|
||||
.macro load32 rx,v
|
||||
li \rx,0
|
||||
oris \rx,\rx,\v>>16
|
||||
ori \rx,\rx,\v&0x0000FFFF
|
||||
.endm
|
||||
|
||||
.macro load16swiz rx,v
|
||||
li \rx,0
|
||||
ori \rx,\rx,(\v<<8)&0xFF00
|
||||
ori \rx,\rx,(\v>>8)&0x00FF
|
||||
.endm
|
||||
|
||||
.macro delayr rx
|
||||
mtctr \rx
|
||||
bdnz .
|
||||
.endm
|
||||
|
||||
.macro delay rx,v
|
||||
li \rx,0
|
||||
oris \rx,\rx,\v>>16
|
||||
ori \rx,\rx,\v&0x0000FFFF
|
||||
mtctr \rx
|
||||
bdnz .
|
||||
.endm
|
||||
|
||||
.org 0x1000
|
||||
boot_start:
|
||||
|
||||
########################################################################################################################################
|
||||
# sim only - go quickly to main() w/no console output
|
||||
|
||||
.ifdef SIM
|
||||
li r3,0x01
|
||||
bl set_leds_b0
|
||||
bl uart_init
|
||||
li r3,0x02
|
||||
bl set_leds_b0
|
||||
b jump2main
|
||||
.endif
|
||||
|
||||
########################################################################################################################################
|
||||
# clear and init core facilities
|
||||
|
||||
li r3,0x01
|
||||
bl core_init
|
||||
bl set_leds_b0 # 01; core init'd
|
||||
delay r10,DELAY
|
||||
|
||||
########################################################################################################################################
|
||||
# console
|
||||
|
||||
console:
|
||||
|
||||
li r3,0x02 # 02; console init
|
||||
bl set_leds_b0
|
||||
bl uart_init
|
||||
delay r10,DELAY
|
||||
|
||||
li r3,0x03 # 03; console init done
|
||||
bl set_leds_b0
|
||||
delay r10,DELAY
|
||||
|
||||
li r3,DATA+MSG_HELLO
|
||||
bl console_println
|
||||
|
||||
########################################################################################################################################
|
||||
# check on-board sram
|
||||
|
||||
.ifdef TEST_MEM
|
||||
b test_mem
|
||||
.endif
|
||||
|
||||
sram_chk:
|
||||
lwz r10,sram_lo(r0)
|
||||
cmpwi r10,-1
|
||||
beq ddr_chk
|
||||
# use syms
|
||||
lis r10,_fdata@h
|
||||
ori r10,r10,_fdata@l
|
||||
#lwz r11,sram_hi(r0)
|
||||
# use stack top; else have to add sym to linker.ld
|
||||
lis r11,_fstack@h
|
||||
ori r11,r11,_fstack@l
|
||||
addi r11,r11,3
|
||||
|
||||
subf r11,r10,r11
|
||||
addi r11,r11,1
|
||||
srwi r11,r11,4 # num word reads
|
||||
mtctr r11
|
||||
|
||||
li r12,0
|
||||
oris r12,r12,0x0867
|
||||
ori r12,r12,0x5309 # data
|
||||
|
||||
sram_writes:
|
||||
stw r12,0(r10)
|
||||
addi r10,r10,4
|
||||
bdnz sram_writes
|
||||
# use syms
|
||||
#lwz r10,sram_lo(r0)
|
||||
lis r10,_fdata@h
|
||||
ori r10,r10,_fdata@l
|
||||
mtctr r11
|
||||
|
||||
sram_reads:
|
||||
lwz r13,0(r10)
|
||||
cmpw r13,r12
|
||||
bne fail
|
||||
addi r10,r10,4
|
||||
bdnz sram_reads
|
||||
|
||||
li r3,0x07 # 07; sram checked
|
||||
bl set_leds_b0
|
||||
delay r10,DELAY
|
||||
|
||||
li r3,DATA+MSG_SRAM
|
||||
bl console_println
|
||||
|
||||
# sram test someday
|
||||
########################################################################################################################################
|
||||
# check ddr, n loops
|
||||
|
||||
#wtf is there a way to disable/enable l2????
|
||||
|
||||
ddr_chk:
|
||||
lwz r10,ddr_lo(r0)
|
||||
cmpwi r10,-1
|
||||
beq rominit
|
||||
|
||||
li r3,0x0F # 0F; dram checking
|
||||
bl set_leds_b0
|
||||
li r3,DATA+MSG_DDR_0
|
||||
bl console_println
|
||||
|
||||
li r8,0 # loop counter
|
||||
lwz r9,ddr_chk_loops(r0)
|
||||
|
||||
li r12,0 # data
|
||||
oris r12,r12,0x6708
|
||||
ori r12,r12,0x0953
|
||||
|
||||
ddr_start:
|
||||
addi r8,r8,1
|
||||
mr r3,r8
|
||||
bl set_leds_b1 # running pass
|
||||
|
||||
lwz r10,ddr_lo(r0)
|
||||
lwz r11,ddr_hi(r0)
|
||||
addi r11,r11,1
|
||||
subf r11,r10,r11
|
||||
srwi r11,r11,2 # word r/w
|
||||
mtctr r11
|
||||
|
||||
ddr_writes:
|
||||
stw r12,0(r10)
|
||||
addi r10,r10,4
|
||||
bdnz ddr_writes
|
||||
|
||||
lwz r10,ddr_lo(r0)
|
||||
mtctr r11
|
||||
|
||||
ddr_reads:
|
||||
lwz r13,0(r10)
|
||||
cmpw r13,r12
|
||||
bne ddr_fail_save
|
||||
addi r10,r10,4
|
||||
bdnz ddr_reads
|
||||
|
||||
# loop done
|
||||
|
||||
addi r12,r12,7 # change pattern
|
||||
cmpwi r9,0
|
||||
beq ddr_start
|
||||
cmpw r8,r9
|
||||
bne ddr_start
|
||||
|
||||
li r3,0x0E # 0E; dram OK
|
||||
bl set_leds_b0
|
||||
li r3,0x00
|
||||
bl set_leds_b1
|
||||
li r3,DATA+MSG_DDR_1
|
||||
bl console_println
|
||||
delay r10,DELAY
|
||||
|
||||
########################################################################################################################################
|
||||
|
||||
rominit:
|
||||
|
||||
li r3,DATA+MSG_ROM_INIT
|
||||
bl console_println
|
||||
|
||||
########################################################################################################################################
|
||||
# VMA/LMA: copy .data, clear .bss
|
||||
|
||||
# get the linker script symbols needed...
|
||||
#lis r1,(.TOC.-0)@h
|
||||
#lis r1,.toc.@h
|
||||
#lis r6,.got.@h
|
||||
#lwz r1,_fdata_rom@got(r6)
|
||||
|
||||
lis r1,_fdata_rom@h
|
||||
ori r1,r1,_fdata_rom@l
|
||||
lis r2,_fdata@h
|
||||
ori r2,r2,_fdata@l
|
||||
lis r3,_edata_rom@h
|
||||
ori r3,r3,_edata_rom@l
|
||||
lis r4,_fbss@h
|
||||
ori r4,r4,_fbss@l
|
||||
lis r5,_ebss@h
|
||||
ori r5,r5,_ebss@l
|
||||
|
||||
subf r9,r1,r3
|
||||
srwi. r9,r9,2
|
||||
beq romcopy_done
|
||||
mtctr r9
|
||||
addi r1,r1,-4
|
||||
addi r2,r2,-4
|
||||
|
||||
romcopy:
|
||||
lwzu r9,4(r1)
|
||||
stwu r9,4(r2)
|
||||
bdnz romcopy
|
||||
|
||||
romcopy_done:
|
||||
subf r9,r4,r5
|
||||
srwi. r9,r9,2
|
||||
beq romclear_done
|
||||
|
||||
mtctr r9
|
||||
addi r4,r4,-4
|
||||
li r9,0
|
||||
|
||||
romclear:
|
||||
stwu r9,4(r4)
|
||||
bdnz romclear
|
||||
|
||||
romclear_done:
|
||||
|
||||
########################################################################################################################################
|
||||
|
||||
########################################################################################################################################
|
||||
|
||||
process_start:
|
||||
|
||||
li r3,DATA+MSG_BANNER
|
||||
bl console_println
|
||||
|
||||
jump2main:
|
||||
lis r1,_fstack@h
|
||||
ori r1,r1,_fstack@l
|
||||
li r3, 0 # parm 1
|
||||
b main
|
||||
|
||||
########################################################################################################################################
|
||||
|
||||
.ifdef TEST_MEM
|
||||
|
||||
.macro asciib rt,rs
|
||||
andi. \rt,\rs,0x0F
|
||||
cmpwi \rt,10
|
||||
blt +8
|
||||
addi \rt,\rt,0x11-10
|
||||
addi \rt,\rt,0x30
|
||||
.endm
|
||||
|
||||
.macro println_reg rt
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
rotlwi \rt,\rt,4
|
||||
asciib r3,\rt
|
||||
bl uart_write
|
||||
li r3,0x0D
|
||||
bl uart_write
|
||||
li r3,0x0A
|
||||
bl uart_write
|
||||
.endm
|
||||
|
||||
# running out of space
|
||||
print_r6:
|
||||
mflr r0
|
||||
println_reg r6
|
||||
mtlr r0
|
||||
blr
|
||||
|
||||
test_mem:
|
||||
lis r5,1 # start@-
|
||||
ori r10,r5,0x40 # end@
|
||||
|
||||
load32 r6,0x0a0b0c0d
|
||||
li r3,'W'
|
||||
bl uart_write
|
||||
bl print_r6
|
||||
|
||||
#stw r6,0(r5)
|
||||
#load32 r6,0
|
||||
#stw r6,4(r5)
|
||||
#stw r6,8(r5)
|
||||
#stw r6,12(r5)
|
||||
stb r6,0(r5)
|
||||
srwi r6,r6,8
|
||||
stb r6,5(r5)
|
||||
srwi r6,r6,8
|
||||
stb r6,10(r5)
|
||||
srwi r6,r6,8
|
||||
stb r6,15(r5)
|
||||
lbz r6,0(r5)
|
||||
bl print_r6
|
||||
lbz r6,1(r5)
|
||||
bl print_r6
|
||||
lbz r6,2(r5)
|
||||
bl print_r6
|
||||
lbz r6,3(r5)
|
||||
bl print_r6
|
||||
lbz r6,4(r5)
|
||||
bl print_r6
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
test_mem_read:
|
||||
lwz r7,0(r5)
|
||||
li r3,'R'
|
||||
bl uart_write
|
||||
println_reg r7
|
||||
addi r5,r5,4
|
||||
cmpw r5,r10
|
||||
blt test_mem_read
|
||||
#b .
|
||||
b sram_chk
|
||||
|
||||
.endif
|
||||
|
||||
########################################################################################################################################
|
||||
# rom: just check high address - could be a crc check
|
||||
|
||||
test_rom:
|
||||
lwz r20,rom_hi(r0)
|
||||
li r21,-4
|
||||
and r21,r20,r21
|
||||
lwz r21,0(r21)
|
||||
lwz r22,eob_data(r0)
|
||||
cmpw r21,r22
|
||||
li r3,1
|
||||
bne fail
|
||||
bl set_leds
|
||||
|
||||
b pass
|
||||
|
||||
# put data in sram so it can be read from uart
|
||||
ddr_fail_save:
|
||||
|
||||
lis r1,_fdata@h
|
||||
ori r1,r1,_fdata@l
|
||||
|
||||
stw r0,0(1)
|
||||
#stw r1,4(1)
|
||||
stw r2,8(1)
|
||||
stw r3,12(1) # loops
|
||||
stw r4,16(1)
|
||||
stw r5,20(1)
|
||||
stw r6,24(1)
|
||||
stw r7,28(1)
|
||||
stw r8,32(1)
|
||||
stw r9,36(1)
|
||||
stw r10,40(1) # addr
|
||||
stw r11,44(1)
|
||||
stw r12,48(1) # exp
|
||||
stw r13,52(1) # act
|
||||
stw r14,56(1)
|
||||
stw r15,60(1)
|
||||
stw r16,64(1)
|
||||
stw r17,68(1)
|
||||
stw r18,72(1)
|
||||
stw r19,76(1)
|
||||
stw r20,80(1)
|
||||
stw r21,84(1)
|
||||
stw r22,88(1)
|
||||
stw r23,92(1)
|
||||
stw r24,96(1)
|
||||
stw r25,100(1)
|
||||
stw r26,104(1)
|
||||
stw r27,108(1)
|
||||
stw r28,112(1)
|
||||
stw r29,116(1)
|
||||
stw r30,120(1)
|
||||
stw r31,124(1)
|
||||
|
||||
mfcr r31
|
||||
stw r31,128(1) # cr
|
||||
mfctr r31
|
||||
stw r31,132(1) # ctr
|
||||
mflr r31
|
||||
stw r31,136(1) # lr
|
||||
mfspr r31,tar
|
||||
stw r31,140(1) # tar
|
||||
li r31,-1
|
||||
stw r31,144(1) # error code
|
||||
|
||||
b fail
|
||||
|
||||
console_echo:
|
||||
|
||||
mflr r0
|
||||
|
||||
lwz r5,sram_lo(r0) # buffer start
|
||||
mr r6,r5 # buffer ptr
|
||||
|
||||
console_echo_1:
|
||||
bl uart_read_nonblock # this could just be uart_read() unless want to do something else while waiting
|
||||
cmpwi r3, 0
|
||||
beq console_echo_1
|
||||
bl uart_read
|
||||
|
||||
cmpwi r3,0x0A # lf
|
||||
beq console_echo_2
|
||||
cmpwi r3,0x0D # cr
|
||||
beq console_echo_2
|
||||
stb r3,0(6)
|
||||
addi r6,r6,1
|
||||
bl uart_write
|
||||
b console_echo_1
|
||||
|
||||
console_echo_2:
|
||||
# print back the whole line surrounded by <>
|
||||
subf r3,r5,r6
|
||||
mtctr r3
|
||||
li r3,0x0D # cr
|
||||
bl uart_write
|
||||
li r3,0x0A # lf
|
||||
bl uart_write
|
||||
li r3,0x3C # <
|
||||
bl uart_write
|
||||
mr r6,r5 # start of buffer
|
||||
|
||||
console_echo_3:
|
||||
lbz r3,0(6)
|
||||
bl uart_write
|
||||
addi r6,r6,1
|
||||
bdnz console_echo_3
|
||||
|
||||
li r3,0x3E # >
|
||||
bl uart_write
|
||||
li r3,0x0D # cr
|
||||
bl uart_write
|
||||
li r3,0x0A # lf
|
||||
bl uart_write
|
||||
mr r6,r5 # start of buffer
|
||||
b console_echo_1
|
||||
|
||||
mtlr r0
|
||||
blr
|
||||
|
||||
console_print:
|
||||
|
||||
mflr r0
|
||||
mr r5,r3 # buffer ptr
|
||||
|
||||
console_print_1:
|
||||
lbz r3,0(5)
|
||||
cmpwi r3,0
|
||||
beq console_print_2
|
||||
bl uart_write
|
||||
addi r5,r5,1
|
||||
bdnz console_print_1
|
||||
|
||||
console_print_2:
|
||||
mtlr r0
|
||||
blr
|
||||
|
||||
console_println:
|
||||
mflr r0
|
||||
mr r5,r3 # buffer ptr
|
||||
|
||||
console_println_1:
|
||||
lbz r3,0(5)
|
||||
cmpwi r3,0
|
||||
beq console_println_2
|
||||
bl uart_write
|
||||
addi r5,r5,1
|
||||
bdnz console_println_1
|
||||
|
||||
console_println_2:
|
||||
li r3,0x0D # cr
|
||||
bl uart_write
|
||||
li r3,0x0A # lf
|
||||
bl uart_write
|
||||
|
||||
mtlr r0
|
||||
blr
|
||||
|
||||
.org 0x1800
|
||||
|
||||
pass:
|
||||
mflr r0
|
||||
li r3,0x01C0
|
||||
bl set_leds
|
||||
b .
|
||||
|
||||
.align 6
|
||||
# fail w/generic code, or specify
|
||||
fail:
|
||||
li r3,0x6666
|
||||
fail_rc:
|
||||
mflr r0
|
||||
bl set_leds
|
||||
fail_no_rc:
|
||||
b .
|
||||
|
||||
.align 6
|
||||
# set up everything that isn't reset; not really needed for fpga
|
||||
core_init:
|
||||
blr
|
||||
|
||||
# leds 15:0
|
||||
get_leds:
|
||||
lwz r1,leds(r0)
|
||||
lhz r3,0(1)
|
||||
blr
|
||||
|
||||
set_leds:
|
||||
lwz r1,leds(r0)
|
||||
sth r3,0(1)
|
||||
blr
|
||||
|
||||
# litex csr don't obey sel!?!?!
|
||||
set_leds_b0:
|
||||
lwz r1,leds(r0)
|
||||
#stb r3,0(1)
|
||||
lhz r2,0(1) # 0011
|
||||
andi. r2,r2,0x00FF
|
||||
slwi r3,r3,8
|
||||
or r2,r2,r3
|
||||
sth r2,0(1) # 0011
|
||||
blr
|
||||
|
||||
set_leds_b1:
|
||||
lwz r1,leds(r0)
|
||||
lhz r2,0(1) # 0011
|
||||
andi. r2,r2,0xFF00
|
||||
andi. r3,r3,0x00FF
|
||||
or r2,r2,r3
|
||||
sth r2,0(1) # 0011
|
||||
blr
|
||||
|
||||
.align 6
|
||||
|
||||
.set UART_EV_TX, 0x1
|
||||
.set UART_EV_RX, 0x2
|
||||
|
||||
uart_init:
|
||||
lwz r2, uart(r0)
|
||||
lbz r1, UART_EV_PENDING(r2)
|
||||
stb r1, UART_EV_PENDING(r2)
|
||||
li r1, UART_EV_TX | UART_EV_RX
|
||||
stb r1, UART_EV_ENABLE(r2)
|
||||
blr
|
||||
|
||||
|
||||
uart_read:
|
||||
lwz r2, uart(r0)
|
||||
lbz r1, UART_RXEMPTY(r2)
|
||||
cmpwi r1,0
|
||||
bne uart_read
|
||||
lbz r3, UART_RXTX(r2)
|
||||
li r1, UART_EV_RX
|
||||
stb r1, UART_EV_PENDING(r2)
|
||||
blr
|
||||
|
||||
uart_read_nonblock:
|
||||
lwz r2, uart(r0)
|
||||
li r3,0
|
||||
lbz r1, UART_RXEMPTY(r2)
|
||||
cmpw r1,r3
|
||||
bne uart_read_nonblock_1
|
||||
li r3,1
|
||||
uart_read_nonblock_1:
|
||||
blr
|
||||
|
||||
uart_write:
|
||||
lwz r2, uart(r0)
|
||||
lbz r1, UART_TXFULL(r2)
|
||||
cmpwi r1,0
|
||||
bne uart_write
|
||||
stb r3, UART_RXTX(r2)
|
||||
li r1, UART_EV_TX
|
||||
stb r1, UART_EV_PENDING(r2)
|
||||
blr
|
||||
|
||||
uart_sync:
|
||||
lwz r2, uart(r0)
|
||||
lbz r1, UART_TXFULL(r2)
|
||||
cmpwi r1,0
|
||||
bne uart_sync
|
||||
blr
|
||||
|
||||
.org 0x1C00
|
||||
.set DATA, 0x1C00
|
||||
|
||||
msg_hello:
|
||||
.byte 0x0D
|
||||
.byte 0x0A
|
||||
.ascii "A2P POWAflight"
|
||||
.byte 0x0D
|
||||
.byte 0x0A
|
||||
.asciz ""
|
||||
|
||||
.align 5
|
||||
msg_sram:
|
||||
.ascii "SRAM OK."
|
||||
.asciz ""
|
||||
|
||||
|
||||
.align 5
|
||||
msg_ddr_0:
|
||||
.ascii "SDRAM TEST..."
|
||||
.asciz ""
|
||||
|
||||
.align 5
|
||||
.msg_ddr_1:
|
||||
.ascii "SDRAM OK "
|
||||
.ascii "@10000000:"
|
||||
.asciz "17FFFFFF"
|
||||
|
||||
.align 5
|
||||
.msg_rom:
|
||||
.ascii "Copying"
|
||||
.ascii " ROM to"
|
||||
.asciz " RAM..."
|
||||
|
||||
.align 5
|
||||
.msg_banner:
|
||||
#.include "banner.s"
|
||||
.ascii "Jumping to"
|
||||
.asciz " main()..."
|
||||
|
||||
.set MSG_HELLO, 0
|
||||
.set MSG_SRAM, MSG_HELLO+32
|
||||
.set MSG_DDR_0, MSG_SRAM+32
|
||||
.set MSG_DDR_1, MSG_DDR_0+32
|
||||
.set MSG_ROM_INIT, MSG_DDR_1+32
|
||||
.set MSG_BANNER, MSG_ROM_INIT+32
|
||||
|
@ -0,0 +1,146 @@
|
||||
# © IBM Corp. 2020
|
||||
# Licensed under and subject to the terms of the CC-BY 4.0
|
||||
# license (https://creativecommons.org/licenses/by/4.0/legalcode).
|
||||
# Additional rights, including the right to physically implement a softcore
|
||||
# that is compliant with the required sections of the Power ISA
|
||||
# Specification, will be available at no cost via the OpenPOWER Foundation.
|
||||
# This README will be updated with additional information when OpenPOWER's
|
||||
# license is available.
|
||||
|
||||
#-----------------------------------------
|
||||
# Defines
|
||||
#-----------------------------------------
|
||||
|
||||
# Regs
|
||||
|
||||
.set r0, 0
|
||||
.set r1, 1
|
||||
.set r2, 2
|
||||
.set r3, 3
|
||||
.set r4, 4
|
||||
.set r5, 5
|
||||
.set r6, 6
|
||||
.set r7, 7
|
||||
.set r8, 8
|
||||
.set r9, 9
|
||||
.set r10,10
|
||||
.set r11,11
|
||||
.set r12,12
|
||||
.set r13,13
|
||||
.set r14,14
|
||||
.set r15,15
|
||||
.set r16,16
|
||||
.set r17,17
|
||||
.set r18,18
|
||||
.set r19,19
|
||||
.set r20,20
|
||||
.set r21,21
|
||||
.set r22,22
|
||||
.set r23,23
|
||||
.set r24,24
|
||||
.set r25,25
|
||||
.set r26,26
|
||||
.set r27,27
|
||||
.set r28,28
|
||||
.set r29,29
|
||||
.set r30,30
|
||||
.set r31,31
|
||||
|
||||
.set f0, 0
|
||||
.set f1, 1
|
||||
.set f2, 2
|
||||
.set f3, 3
|
||||
.set f4, 4
|
||||
.set f5, 5
|
||||
.set f6, 6
|
||||
.set f7, 7
|
||||
.set f8, 8
|
||||
.set f9, 9
|
||||
.set f10,10
|
||||
.set f11,11
|
||||
.set f12,12
|
||||
.set f13,13
|
||||
.set f14,14
|
||||
.set f15,15
|
||||
.set f16,16
|
||||
.set f17,17
|
||||
.set f18,18
|
||||
.set f19,19
|
||||
.set f20,20
|
||||
.set f21,21
|
||||
.set f22,22
|
||||
.set f23,23
|
||||
.set f24,24
|
||||
.set f25,25
|
||||
.set f26,26
|
||||
.set f27,27
|
||||
.set f28,28
|
||||
.set f29,29
|
||||
.set f30,30
|
||||
.set f31,31
|
||||
|
||||
.set cr0, 0
|
||||
.set cr1, 1
|
||||
.set cr2, 2
|
||||
.set cr3, 3
|
||||
.set cr4, 4
|
||||
.set cr5, 5
|
||||
.set cr6, 6
|
||||
.set cr7, 7
|
||||
|
||||
# SPR numbers
|
||||
|
||||
.set srr0, 26
|
||||
.set srr1, 27
|
||||
.set epcr, 307
|
||||
.set tar, 815
|
||||
.set dsisr, 18
|
||||
.set dar, 19
|
||||
|
||||
.set dbsr, 304
|
||||
.set dbcr0, 308
|
||||
.set dbcr1, 309
|
||||
.set dbcr2, 310
|
||||
.set dbcr3, 848
|
||||
|
||||
.set ivpr, 63
|
||||
|
||||
.set iucr0, 1011
|
||||
.set iucr1, 883
|
||||
.set iucr2, 884
|
||||
|
||||
.set iudbg0, 888
|
||||
.set iudbg1, 889
|
||||
.set iudbg2, 890
|
||||
.set iulfsr, 891
|
||||
.set iullcr, 892
|
||||
|
||||
.set mmucr0, 1020
|
||||
.set mmucr1, 1021
|
||||
.set mmucr2, 1022
|
||||
.set mmucr3, 1023
|
||||
|
||||
.set tb, 268
|
||||
.set tbl, 284
|
||||
.set tbh, 285
|
||||
|
||||
.set dec, 22
|
||||
.set udec, 550
|
||||
.set tsr, 336
|
||||
.set tcr, 340
|
||||
|
||||
.set xucr0, 1014
|
||||
.set xucr1, 851
|
||||
.set xucr2, 1016
|
||||
.set xucr3, 852
|
||||
.set xucr4, 853
|
||||
|
||||
.set tens, 438
|
||||
.set tenc, 439
|
||||
.set tensr, 437
|
||||
|
||||
.set pid, 48
|
||||
.set pir, 286
|
||||
.set pvr, 287
|
||||
.set tir, 446
|
||||
|
@ -0,0 +1,18 @@
|
||||
#ifndef __IRQ_H
|
||||
#define __IRQ_H
|
||||
|
||||
static inline void irq_setmask(unsigned int mask) {
|
||||
}
|
||||
|
||||
static inline unsigned int irq_getmask(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned int irq_pending(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void irq_setie(unsigned int mask) {
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,61 @@
|
||||
// a2p
|
||||
|
||||
#ifndef __SYSTEM_H
|
||||
#define __SYSTEM_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
void flush_l2_cache(void) {
|
||||
}
|
||||
*/
|
||||
static void flush_cpu_icache(void);
|
||||
static void flush_cpu_dcache(void);
|
||||
|
||||
static void flush_cpu_icache(void) {
|
||||
}
|
||||
static void flush_cpu_dcache(void) {
|
||||
}
|
||||
|
||||
#define CSR_ACCESSORS_DEFINED
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
#define MMPTR(x) x
|
||||
#else /* ! __ASSEMBLER__ */
|
||||
|
||||
/* CSRs are stored in subregister slices of CONFIG_CSR_DATA_WIDTH (native
|
||||
* endianness), with the least significant slice at the lowest aligned
|
||||
* (base) address. */
|
||||
|
||||
#include <generated/soc.h>
|
||||
#if !defined(CONFIG_CSR_DATA_WIDTH)
|
||||
#error CSR_DATA_WIDTH MUST be set before including this file!
|
||||
#endif
|
||||
|
||||
/* CSR subregisters (a.k.a. "simple CSRs") are embedded inside uint32_t
|
||||
* aligned locations: */
|
||||
#define MMPTR(a) (*((volatile uint32_t *)(a)))
|
||||
|
||||
static inline unsigned long swizzle(unsigned long v);
|
||||
|
||||
static inline unsigned long swizzle(unsigned long v) {
|
||||
return ((v & 0x000000FF) << 24) | ((v & 0x0000FF00) << 8) | ((v & 0x00FF0000) >> 8) | ((v & 0xFF000000) >> 24);
|
||||
//return v;
|
||||
}
|
||||
|
||||
static inline void csr_write_simple(unsigned long v, unsigned long a)
|
||||
{
|
||||
//MMPTR(a) = v;
|
||||
MMPTR(a) = swizzle(v);
|
||||
}
|
||||
|
||||
static inline unsigned long csr_read_simple(unsigned long a)
|
||||
{
|
||||
//return MMPTR(a);
|
||||
return swizzle(MMPTR(a));
|
||||
}
|
||||
|
||||
#endif /* ! __ASSEMBLER__ */
|
||||
|
||||
#endif /* __SYSTEM_H */
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Autogenerated by LiteX / git: 6932fc51
|
||||
# Autogenerated by LiteX / git: 33ae301d
|
||||
set -e
|
||||
vivado -mode batch -source cmod7_kintex.tcl
|
||||
|
@ -1,8 +1,8 @@
|
||||
//--------------------------------------------------------------------------------
|
||||
// Auto-generated by LiteX (6932fc51) on 2022-08-04 09:13:14
|
||||
// Auto-generated by LiteX (33ae301d) on 2022-08-15 13:16:22
|
||||
//--------------------------------------------------------------------------------
|
||||
#ifndef __GENERATED_GIT_H
|
||||
#define __GENERATED_GIT_H
|
||||
|
||||
#define LITEX_GIT_SHA1 "6932fc51"
|
||||
#define LITEX_GIT_SHA1 "33ae301d"
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
MEMORY {
|
||||
rom : ORIGIN = 0x00000000, LENGTH = 0x00010000
|
||||
sram : ORIGIN = 0x00010000, LENGTH = 0x00010000
|
||||
main_ram : ORIGIN = 0x00100000, LENGTH = 0x00000100
|
||||
main_ram : ORIGIN = 0x01000000, LENGTH = 0x01000000
|
||||
csr : ORIGIN = 0xfff00000, LENGTH = 0x00010000
|
||||
}
|
||||
|
@ -0,0 +1,128 @@
|
||||
#!/usr/bin/python3
|
||||
# parse list of netnames, combine bits
|
||||
|
||||
import re
|
||||
|
||||
inFiles = ['cells_ff.txt', 'cells_lut.txt']
|
||||
|
||||
#parent = 'A2P_WB'
|
||||
parent = 'a2p_i/A2P_WB/inst'
|
||||
|
||||
areas = {
|
||||
'IC': {'re': r'' + parent + '/IBusCachedPlugin_*'},
|
||||
'decode': {'re': r'' + parent + '/decode_*'},
|
||||
'execute': {'re': r'' + parent + '/execute_*'},
|
||||
'regfile': {'re': r'' + parent + '/RegFilePlugin_*'},
|
||||
'hazards': {'re': r'' + parent + '/Hazards_*'},
|
||||
'ALU2': {'re': r'' + parent + '/ALU2_*'},
|
||||
'MULDIV': {'re': r'' + parent + '/MULDIV*'}, # 1,2
|
||||
'memory': {'re': r'' + parent + '/memory_*'},
|
||||
'DC': {'re': r'' + parent + '/dataCache*'},
|
||||
'SPR' :{'re': r'' + parent + '/SPRPlugin_*'},
|
||||
'MSR' :{'re': r'' + parent + '/MSR_*'},
|
||||
'writeBack': {'re': r'' + parent + '/writeBack_*'},
|
||||
'ibus': {'re': r'' + parent + '/iBusWB_*'},
|
||||
'dbus': {'re': r'' + parent + '/dBusWB_*'},
|
||||
'SPINAL _zz_': {'re': r'' + parent + '/_zz_*'}
|
||||
}
|
||||
|
||||
def analyze(inFile, areas, printSigs=False, printZZ=False):
|
||||
sigs = {}
|
||||
|
||||
with open(inFile) as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
next
|
||||
if line[0] == '*':
|
||||
next
|
||||
if '[' in line:
|
||||
sig = line[0:line.find('[')]
|
||||
strand = int(line[line.find('[')+1:line.find(']')])
|
||||
else:
|
||||
sig = line
|
||||
strand = None
|
||||
|
||||
if strand is None:
|
||||
sigs[sig] = {'len': 1}
|
||||
else:
|
||||
if sig in sigs:
|
||||
sigs[sig]['bits'].append(strand)
|
||||
sigs[sig]['len'] += 1
|
||||
else:
|
||||
sigs[sig] = {'len': 1, 'bits': [strand]}
|
||||
|
||||
total = 0
|
||||
for name in sigs:
|
||||
sig = sigs[name]
|
||||
if 'bits' in sig:
|
||||
sig['bits'] = sorted(sig['bits'], key=int)
|
||||
total += sig['len']
|
||||
if printSigs:
|
||||
print(name, sig)
|
||||
for areaName in areas:
|
||||
area = areas[areaName]
|
||||
match = re.match(area['re'], name)
|
||||
if match is not None:
|
||||
area['total'] += sigs[name]['len']
|
||||
area['sigs'].append(name)
|
||||
if 'matchedAreas' in sig:
|
||||
print(f'*** Signal in multiple areas: {name}')
|
||||
sig['matchedAreas'].append(areaName)
|
||||
else:
|
||||
sig['matchedAreas'] = [areaName]
|
||||
print()
|
||||
|
||||
print(f'Total: {total}')
|
||||
print()
|
||||
|
||||
totalAreas = 0
|
||||
for name in areas:
|
||||
area = areas[name]
|
||||
print(f'{name:30s} {area["total"]:4d}')
|
||||
totalAreas += area["total"]
|
||||
print(f'{"Total in matched areas":30s}{totalAreas:5d}')
|
||||
print()
|
||||
|
||||
if total != totalAreas:
|
||||
print('Not accounted for in areas:')
|
||||
for name in sigs:
|
||||
sig = sigs[name]
|
||||
if 'matchedAreas' not in sig:
|
||||
print(f' {name}')
|
||||
print()
|
||||
|
||||
totals = [0] * 5000
|
||||
|
||||
for name in sigs:
|
||||
sig = sigs[name]
|
||||
totals[sig['len']] += 1
|
||||
if sig['len'] > 32:
|
||||
print(f'*** >32 bits ({sig["len"]}): {name} ***')
|
||||
|
||||
running = 0
|
||||
print('Totals by cells:')
|
||||
for i in range(1, len(totals)):
|
||||
running += i * totals[i]
|
||||
if totals[i] != 0:
|
||||
print(f' {i:4d}:{totals[i]:4d} {running:5d}')
|
||||
|
||||
if printZZ:
|
||||
print('SPINAL _zz_')
|
||||
a = areas['SPINAL _zz_']
|
||||
for s in a['sigs']:
|
||||
print(f' {s}')
|
||||
|
||||
return sigs, areas
|
||||
|
||||
for f in inFiles:
|
||||
|
||||
for a in areas:
|
||||
area = areas[a]
|
||||
area['total'] = 0
|
||||
area['sigs'] = []
|
||||
|
||||
print()
|
||||
print(f'--- {f} ---')
|
||||
analyze(f, areas, printSigs=False)
|
|
@ -0,0 +1,18 @@
|
||||
proc startsim {} {
|
||||
launch_simulation -mode behavioral
|
||||
open_wave_config {wtf.wcfg}
|
||||
restart
|
||||
source {sim.tcl}
|
||||
}
|
||||
|
||||
proc rerun {} {
|
||||
restart
|
||||
source {sim.tcl}
|
||||
}
|
||||
|
||||
proc jumpctr {{runCycs 100} {value 4} {stickCycs 5}} {
|
||||
set f [add_force A2P_WB/execute_BranchPlugin_CTR -radix dec $value]
|
||||
runCyc $stickCycs
|
||||
remove_forces $f
|
||||
runCyc $runCycs
|
||||
}
|
@ -0,0 +1,272 @@
|
||||
# general text parser
|
||||
|
||||
import os
|
||||
import sys
|
||||
from time import sleep
|
||||
import glob
|
||||
import json
|
||||
import re
|
||||
#import jsonpickle
|
||||
|
||||
# config
|
||||
# file (inc. glob)
|
||||
# list of searches: type (re, etc), singe/multiline, text, template
|
||||
|
||||
class Spec:
|
||||
def __init__(self):
|
||||
self.val = None
|
||||
self.multiline = False
|
||||
self.re = False
|
||||
self.post = None # postprocessor function
|
||||
self.ci = False # case-insensitive
|
||||
self.flags = 0 # re flags
|
||||
self.matchOnly = False # return re match, or whole result (if not multiline)
|
||||
self.before = 0
|
||||
self.after = 0
|
||||
# start from prev?
|
||||
# callback for every match?
|
||||
self.search = False # use re.search instead of re.match
|
||||
|
||||
class Config:
|
||||
def __init__(self):
|
||||
self.specs = None
|
||||
self.title = None
|
||||
|
||||
def toJson(self):
|
||||
return json.dumps(self, default=lambda o: o.__dict__)
|
||||
|
||||
class Log:
|
||||
|
||||
def __init__(self, config=None):
|
||||
self.config = config
|
||||
|
||||
# process all matching files, or newest only
|
||||
def processGlob(self, g, spec, newest=False):
|
||||
files = glob.glob(g)
|
||||
if newest:
|
||||
files = [max(files, key=os.path.getctime)]
|
||||
for f in files:
|
||||
processFile(f, spec)
|
||||
|
||||
# read file
|
||||
def processFile(self, fn, spec):
|
||||
contents = None
|
||||
lines = None
|
||||
|
||||
# process spec list in order
|
||||
results = []
|
||||
for s in spec:
|
||||
|
||||
if s.multiline and contents is None:
|
||||
with open(fn, 'rt') as f:
|
||||
contents = f.read()
|
||||
elif lines is None:
|
||||
lines = []
|
||||
with open(fn, 'rt') as f:
|
||||
for l in f:
|
||||
lines.append(l.rstrip('\n'))
|
||||
|
||||
v = []
|
||||
if s.re:
|
||||
if s.multiline:
|
||||
r = re.findall(s.val, contents, s.flags)
|
||||
for i in range(len(r)):
|
||||
v.append(r[i])
|
||||
else:
|
||||
for i in range(len(lines)):
|
||||
l = lines[i]
|
||||
fn = re.match if not s.search else re.search
|
||||
res = fn(s.val, l, s.flags)
|
||||
if res is not None:
|
||||
if s.matchOnly:
|
||||
v.append(res.groups())
|
||||
else:
|
||||
if s.before == -1:
|
||||
for j in range(0, i):
|
||||
v.append(lines[j])
|
||||
elif s.before > 0:
|
||||
for j in range(max(0, i-s.before), i):
|
||||
v.append(lines[j])
|
||||
v.append(l)
|
||||
if s.after == -1:
|
||||
for j in range(i+1, len(lines)):
|
||||
v.append(lines[j])
|
||||
elif s.after > 0:
|
||||
for j in range(i+1, i+1+s.after):
|
||||
v.append(lines[j])
|
||||
|
||||
else:
|
||||
if s.multiline:
|
||||
p = 0
|
||||
while p < len(contents):
|
||||
p1 = contents.find(s.val, p)
|
||||
if p1 == -1:
|
||||
break
|
||||
v.append(p1)
|
||||
p += len(p1)
|
||||
else:
|
||||
for i in range(len(lines)):
|
||||
l = lines[i]
|
||||
if l.find(s.val) != -1:
|
||||
if s.before == -1:
|
||||
for j in range(0, i):
|
||||
v.append(lines[j])
|
||||
elif s.before > 0:
|
||||
for j in range(max(0, i-s.before), i):
|
||||
v.append(lines[j])
|
||||
v.append(l)
|
||||
if s.after == -1:
|
||||
for j in range(i+1, len(lines)):
|
||||
v.append(lines[j])
|
||||
elif s.after > 0:
|
||||
for j in range(i+1, i+1+s.after):
|
||||
v.append(lines[j])
|
||||
|
||||
results.append(v)
|
||||
|
||||
return results
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
import os.path, time
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('logFile')
|
||||
parser.add_argument('-l', '--loops', type=int, dest='loops', default=200, help='loops to run; default=200')
|
||||
parser.add_argument('-m', '--move', type=int, dest='move', default=10, help='rate of movement (1/n iterations); default=10')
|
||||
parser.add_argument('--test', dest='testVal', default=None, help='test value')
|
||||
args = parser.parse_args()
|
||||
|
||||
logFile = args.logFile
|
||||
|
||||
s0 = Spec()
|
||||
s0.val = r'.*Command.*-hierarchical (.*)\*.*'
|
||||
s0.re = True
|
||||
s0.matchOnly = True
|
||||
|
||||
specs = [s0]
|
||||
log = Log()
|
||||
res = log.processFile(logFile, specs)
|
||||
|
||||
comps = []
|
||||
for r in res:
|
||||
for i in r:
|
||||
comps.append({
|
||||
'name': i[0],
|
||||
'luts': -1
|
||||
})
|
||||
|
||||
s0.val = r'.*Slice LUTs.*?\|(.*?)\|'
|
||||
|
||||
res = log.processFile(logFile, specs)
|
||||
|
||||
for r in res:
|
||||
for i in range(len(r)):
|
||||
comps[i]['luts'] = r[i][0]
|
||||
|
||||
|
||||
mod = time.ctime(os.path.getmtime(logFile))
|
||||
print(f"report: {logFile} [{mod}]")
|
||||
for i in range(len(comps)):
|
||||
print(f"{comps[i]['name']:16}: {comps[i]['luts']:>7}")
|
||||
|
||||
|
||||
quit()
|
||||
# openroad testing
|
||||
|
||||
s0 = Spec()
|
||||
s0.val = r'^Yosys .* \(git sha1'
|
||||
s0.re = True
|
||||
|
||||
specs = [s0]
|
||||
|
||||
log = Log()
|
||||
|
||||
res = log.processFile(logFile, specs)
|
||||
#print('Line:')
|
||||
#print(res[0][0])
|
||||
|
||||
s0.val = r'(Yosys .* \(git sha1.*)\n'
|
||||
s0.multiline = True
|
||||
res = log.processFile(logFile, specs)
|
||||
#print('Multiline:')
|
||||
#print(res[0][0])
|
||||
|
||||
s1 = Spec()
|
||||
s1.val = r'(306\.25\.1\.2\..*?)\nRemoving temp directory.'
|
||||
s1.re = True
|
||||
s1.multiline = True
|
||||
s1.flags = re.DOTALL # want to match \n's
|
||||
|
||||
specs = [s1]
|
||||
res = log.processFile(logFile, specs)
|
||||
#print(res[0][0])
|
||||
|
||||
s1.val = r'(306\.28\. Printing statistics\..*?\n.*?\n\n.*?)\n\n'
|
||||
res = log.processFile(logFile, specs)
|
||||
#print(res[0][0])
|
||||
|
||||
print('Report: ' + logFile)
|
||||
print('')
|
||||
|
||||
s0 = Spec()
|
||||
s0.val = r'^Yosys .* \(git sha1'
|
||||
s0.re = True
|
||||
|
||||
s1 = Spec()
|
||||
s1.val = r'\n(318\. Printing statistics\..*Number of cells:.*?\n)'
|
||||
s1.re = True
|
||||
s1.multiline = True
|
||||
s1.flags = re.DOTALL
|
||||
|
||||
s2 = Spec()
|
||||
s2.val = r'^319\.'
|
||||
s2.re = True
|
||||
s2.multiline = False
|
||||
s2.after = -1
|
||||
|
||||
specs = [s0, s1, s2]
|
||||
config = Config()
|
||||
config.specs = specs
|
||||
|
||||
res = log.processFile(logFile, config.specs)
|
||||
for i in range(len(res)):
|
||||
for l in res[i]:
|
||||
print(l)
|
||||
print('')
|
||||
|
||||
quit()
|
||||
|
||||
# python makes this hard for even trivial objects
|
||||
print('Writing config.json...')
|
||||
|
||||
configJson = json.dumps(config, default=lambda x: x.__dict__)
|
||||
#configJson = jsonpickle.encode(config)
|
||||
print(configJson)
|
||||
#quit()
|
||||
#
|
||||
#configJson = json.dumps(config.toJson(), indent=2)
|
||||
with open('config.json', 'w') as configFile:
|
||||
configFile.write(configJson)
|
||||
configFile.close()
|
||||
|
||||
print('Reading config.json...')
|
||||
print('')
|
||||
|
||||
print('string')
|
||||
with open('config.json', 'r') as configFile:
|
||||
print(configFile.read())
|
||||
configFile.close()
|
||||
|
||||
print('loads')
|
||||
with open('config.json', 'r') as configFile:
|
||||
config = json.loads(configFile.read())
|
||||
print(config)
|
||||
configFile.close()
|
||||
|
||||
res = log.processFile(logFile, config.specs)
|
||||
for i in range(len(res)):
|
||||
for l in res[i]:
|
||||
print(l)
|
||||
print('')
|
||||
|
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
code=../../src/test3/rom.init
|
||||
vivado=vivado
|
||||
dir=`pwd`
|
||||
|
||||
soc=a2o.py
|
||||
gateware=build/cmod7/gateware
|
||||
top=$gateware/cmod7
|
||||
proj=proj.tcl
|
||||
|
||||
if [ "$1" == "-c" ]; then
|
||||
cp $code .
|
||||
echo "Updated code."
|
||||
elif [ "$1" == "-p" ]; then
|
||||
$vivado -mode tcl -source pgmfpga.tcl
|
||||
echo "Done."
|
||||
exit
|
||||
elif [ "$1" == "-v" ]; then
|
||||
cd $gateware
|
||||
$vivado -mode tcl -source $proj
|
||||
echo "Done."
|
||||
cd $dir
|
||||
exit
|
||||
elif [ "$1" != "" ]; then
|
||||
echo "make [-c|-p] (-c=also copy code, -p=just program, -v=run vivado project"
|
||||
exit
|
||||
fi
|
||||
|
||||
# build and program
|
||||
python3 $soc --csr-csv csr.csv --no-compile-software --build
|
||||
if [ $? -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Copying .v and .bit, and programming..."
|
||||
cp ${top}.v .
|
||||
cp ${top}.bit .
|
||||
$vivado -mode tcl -source pgmfpga.tcl
|
||||
|
||||
echo "Done."
|
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# don't run vivado
|
||||
# uart=576000
|
||||
|
||||
if [ "$1" == "-c" ]; then
|
||||
# code
|
||||
cp ~/projects/a2p/src/powaflight-full/rom.init .
|
||||
fi
|
||||
|
||||
# build and program
|
||||
python3 a2p_full_litex.py --csr-csv csr.csv --no-compile-software --uart-baudrate 576000
|
||||
if [ $? -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
cp build/cmod7/gateware/cmod7.v cmod7-sim.v
|
||||
|
||||
echo "Done."
|
@ -0,0 +1,44 @@
|
||||
# vivado -mode tcl -source pgmflash.tcl
|
||||
# can also use this to load ~2 MB of bootable code/data
|
||||
# can also load multiple bitstreams by changing address
|
||||
#
|
||||
# does this 'erase' the memory or make it unusable or ???
|
||||
# delete_hw_cfgmem [current_hw_cfgmem]
|
||||
|
||||
open_hw_manager
|
||||
|
||||
connect_hw_server
|
||||
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/*]
|
||||
open_hw_target
|
||||
|
||||
set dev [lindex [get_hw_devices] 0]
|
||||
current_hw_device $dev
|
||||
refresh_hw_device -update_hw_probes false $dev
|
||||
|
||||
# select n25q32-3.3v-spi-x1-x2-x4 flash (32Mb)
|
||||
# should check get_hw_cfgmems to see if exists, and use lindex 0 if there?
|
||||
# get_hw_cfgmems
|
||||
# cfgmem_0
|
||||
create_hw_cfgmem -hw_device $dev [lindex [get_cfgmem_parts {n25q32-3.3v-spi-x1_x2_x4}] 0]
|
||||
set_property PROGRAM.BLANK_CHECK 0 [ get_property PROGRAM.HW_CFGMEM $dev
|
||||
set_property PROGRAM.ERASE 1 [ get_property PROGRAM.HW_CFGMEM $dev
|
||||
set_property PROGRAM.CFG_PROGRAM 1 [ get_property PROGRAM.HW_CFGMEM $dev
|
||||
set_property PROGRAM.VERIFY 1 [ get_property PROGRAM.HW_CFGMEM $dev
|
||||
set_property PROGRAM.CHECKSUM 0 [ get_property PROGRAM.HW_CFGMEM $dev
|
||||
refresh_hw_device $dev
|
||||
|
||||
# when not a compressed bitstream and -size 2:
|
||||
# ERROR: [Writecfgmem 68-4] Bitstream at address 0x00000000 has size 2192012 bytes which cannot fit in memory of size 2097152 bytes.
|
||||
# -rw-rw-r-- 1 wtf wtf 2192113 Nov 9 07:43 cmod7.bit
|
||||
# need to get this to be set in soc:
|
||||
# set_property BITSTREAM.GENERAL.COMPRESS TRUE [current_design]
|
||||
write_cfgmem -format mcs -size 4 -interface SMAPx8 -loadbit {up 0x00000000 ./cmod7.bit} ./cmod7.mcs
|
||||
program_hw_cfgmem [current_hw_cfgmem]
|
||||
|
||||
refresh_hw_device $dev
|
||||
|
||||
puts "Device programmed."
|
||||
|
||||
quit
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
# vivado -mode tcl -source pgmfpga.tcl
|
||||
|
||||
open_hw_manager
|
||||
|
||||
connect_hw_server
|
||||
current_hw_target [get_hw_targets */xilinx_tcf/Digilent/*]
|
||||
open_hw_target
|
||||
|
||||
set dev [lindex [get_hw_devices] 0]
|
||||
current_hw_device $dev
|
||||
refresh_hw_device -update_hw_probes false $dev
|
||||
set_property PROGRAM.FILE {./cmod7.bit} $dev
|
||||
#set_property PROBES.FILE {./cmod7.ltx} $dev
|
||||
|
||||
program_hw_devices $dev
|
||||
refresh_hw_device $dev
|
||||
|
||||
puts "Device programmed."
|
||||
|
||||
quit
|
@ -0,0 +1,2 @@
|
||||
#
|
||||
source init.tcl
|
@ -0,0 +1,111 @@
|
||||
open_run impl_1
|
||||
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical A2P_WB*] -file cells_utilization.txt
|
||||
}
|
||||
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical *_zz*] -append -file cells_utilization.txt
|
||||
}
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical dBusWB*] -append -file cells_utilization.txt
|
||||
}
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical iBusWB*] -append -file cells_utilization.txt
|
||||
}
|
||||
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical execute_MemoryTranslatorPlugin*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical MemoryTranslatorPlugin*] -append -file cells_utilization.txt
|
||||
}
|
||||
|
||||
report_utilization -cells [get_cells -hierarchical RegFilePlugin*] -append -file cells_utilization.txt
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical SPRPlugin*] -append -file cells_utilization.txt
|
||||
}
|
||||
|
||||
# egrep "Command|Slice LUT|Muxes" cells_utilization.txt
|
||||
|
||||
# stages
|
||||
report_utilization -cells [get_cells -hierarchical IBusCachedPlugin*] -append -file cells_utilization.txt
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical IBusCachedPlugin_fetchPc_*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical IBusCachedPlugin_predictor_*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical IBusCachedPlugin_injector_*] -append -file cells_utilization.txt
|
||||
}
|
||||
report_utilization -cells [get_cells -hierarchical decode_*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical execute_*] -append -file cells_utilization.txt
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical execute_BranchPlugin*] -append -file cells_utilization.txt
|
||||
}
|
||||
#went away when i added areas below!
|
||||
#report_utilization -cells [get_cells -hierarchical execute_IntAluPlugin*] -append -file cells_utilization.txt
|
||||
#why are these gone with donttouch?
|
||||
#report_utilization -cells [get_cells -hierarchical execute_DBusCachedPlugin*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical memory_*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical writeBack_*] -append -file cells_utilization.txt
|
||||
|
||||
|
||||
# new stuff! got areas named
|
||||
catch {
|
||||
report_utilization -cells [get_cells -hierarchical Hazards*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical *DECODER*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical *SRC1*] -append -file cells_utilization.txt
|
||||
#?report_utilization -cells [get_cells -hierarchical *SRC2*] -append -file cells_utilization.txt
|
||||
#report_utilization -cells [get_cells -hierarchical *ALU1*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical *ALU2*] -append -file cells_utilization.txt
|
||||
#?report_utilization -cells [get_cells -hierarchical *MUL1*] -append -file cells_utilization.txt
|
||||
#?report_utilization -cells [get_cells -hierarchical *MUL2*] -append -file cells_utilization.txt
|
||||
#?report_utilization -cells [get_cells -hierarchical *MUL3*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical *MULDIV*] -append -file cells_utilization.txt
|
||||
report_utilization -cells [get_cells -hierarchical *MULDIV1*] -append -file cells_utilization.txt
|
||||
#?report_utilization -cells [get_cells -hierarchical *MULDIV2*] -append -file cells_utilization.txt
|
||||
}
|
||||
|
||||
### cells
|
||||
|
||||
# LUT
|
||||
set outFile [open {cells_lut.txt} w]
|
||||
|
||||
#set cells [get_cells -hier -filter {PARENT == A2P_WB}]
|
||||
set cells [get_cells -hier -filter {PARENT == a2p_i/A2P_WB/inst}]vrv_i/VexRiscv_0/inst
|
||||
set cells [get_cells -hier -filter {PARENT == vrv_i/VexRiscv_0/inst}]
|
||||
|
||||
set names {}
|
||||
|
||||
puts ""
|
||||
puts "Cells (non-flop)"
|
||||
foreach cell $cells {
|
||||
set name [get_property NAME $cell]
|
||||
if {[get_property PRIMITIVE_GROUP $cell] != "LUT"} {
|
||||
if {[get_property PRIMITIVE_GROUP $cell] != "FLOP_LATCH"} {
|
||||
# OTHERS CARRY MUXFX BMEM MULT [EMPTY=MACRO TOP]
|
||||
puts "Not a LUT or FLOP_LATCH: [get_property PRIMITIVE_GROUP $cell] $name"
|
||||
}
|
||||
} else {
|
||||
#puts $name
|
||||
puts $outFile $name
|
||||
lappend names $name
|
||||
}
|
||||
}
|
||||
puts "Cells (nonflop): [llength $names]"
|
||||
close $outFile
|
||||
|
||||
# flops
|
||||
set outFile [open {cells_ff.txt} w]
|
||||
|
||||
#set cells [get_cells -hier -filter {(PRIMITIVE_TYPE =~ FLOP*) && (PARENT == A2P_WB)}]
|
||||
set cells [get_cells -hier -filter {(PRIMITIVE_TYPE =~ FLOP*) && (PARENT == a2p_i/A2P_WB/inst)}]
|
||||
set cells [get_cells -hier -filter {(PRIMITIVE_TYPE =~ FLOP*) && (PARENT == vrv_i/VexRiscv_0/inst)}]
|
||||
set names {}
|
||||
|
||||
puts ""
|
||||
puts "Flops"
|
||||
foreach cell $cells {
|
||||
set name [get_property NAME $cell]
|
||||
#puts $name
|
||||
puts $outFile $name
|
||||
lappend names $name
|
||||
}
|
||||
puts "Flops: [llength $names]"
|
||||
close $outFile
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,4 @@
|
||||
module BUFG (output O, input I);
|
||||
assign O = I;
|
||||
endmodule
|
||||
|
@ -0,0 +1,10 @@
|
||||
module DNA_PORT (DOUT, CLK, DIN, READ, SHIFT);
|
||||
|
||||
parameter [56:0] SIM_DNA_VALUE = 57'h0;
|
||||
|
||||
output DOUT;
|
||||
input CLK, DIN, READ, SHIFT;
|
||||
|
||||
assign DOUT = 1'b0;
|
||||
|
||||
endmodule
|
@ -0,0 +1,21 @@
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module FD (Q, C, D);
|
||||
|
||||
parameter INIT = 1'b0;
|
||||
|
||||
output Q;
|
||||
input C, D;
|
||||
|
||||
wire Q;
|
||||
reg q_out;
|
||||
|
||||
initial q_out = INIT;
|
||||
|
||||
always @(posedge C)
|
||||
q_out <= D;
|
||||
|
||||
assign Q = q_out;
|
||||
|
||||
endmodule
|
@ -0,0 +1,24 @@
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module FDCE (C, CE, CLR, D, Q);
|
||||
|
||||
parameter INIT = 1'b1;
|
||||
|
||||
output Q;
|
||||
|
||||
input C, CE, D, CLR;
|
||||
|
||||
wire Q;
|
||||
reg q_out;
|
||||
|
||||
initial q_out = INIT;
|
||||
|
||||
assign Q = q_out;
|
||||
|
||||
always @(posedge C or posedge CLR)
|
||||
if (CLR)
|
||||
q_out <= 0;
|
||||
else if (CE)
|
||||
q_out <= D;
|
||||
|
||||
endmodule
|
@ -0,0 +1,24 @@
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module FDPE (Q, C, CE, D, PRE);
|
||||
|
||||
parameter INIT = 1'b1;
|
||||
|
||||
output Q;
|
||||
|
||||
input C, CE, D, PRE;
|
||||
|
||||
wire Q;
|
||||
reg q_out;
|
||||
|
||||
initial q_out = INIT;
|
||||
|
||||
assign Q = q_out;
|
||||
|
||||
always @(posedge C or posedge PRE)
|
||||
if (PRE)
|
||||
q_out <= 1;
|
||||
else if (CE)
|
||||
q_out <= D;
|
||||
|
||||
endmodule
|
@ -0,0 +1,10 @@
|
||||
module IDELAYCTRL #(
|
||||
)(
|
||||
output RDY,
|
||||
input REFCLK,
|
||||
input RST
|
||||
);
|
||||
|
||||
assign RDY = !RST;
|
||||
endmodule
|
||||
|
@ -0,0 +1,24 @@
|
||||
// wtf didn't check what it actually does!
|
||||
|
||||
module IDELAYE2 #(
|
||||
parameter CINVCTRL_SEL,
|
||||
parameter DELAY_SRC,
|
||||
parameter HIGH_PERFORMANCE_MODE,
|
||||
parameter IDELAY_TYPE,
|
||||
parameter IDELAY_VALUE,
|
||||
parameter PIPE_SEL,
|
||||
parameter REFCLK_FREQUENCY,
|
||||
parameter SIGNAL_PATTERN
|
||||
)(
|
||||
input C,
|
||||
input CE,
|
||||
input IDATAIN,
|
||||
input INC,
|
||||
input LD,
|
||||
input LDPIPEEN,
|
||||
output DATAOUT
|
||||
);
|
||||
|
||||
assign DATAOUT = IDATAIN;
|
||||
endmodule
|
||||
|
@ -0,0 +1,13 @@
|
||||
//wtf nop
|
||||
|
||||
module IOBUF #(
|
||||
)
|
||||
(
|
||||
input I,
|
||||
input T,
|
||||
inout IO,
|
||||
inout O
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
@ -0,0 +1,13 @@
|
||||
//wtf nop
|
||||
|
||||
module IOBUFDS #(
|
||||
)
|
||||
(
|
||||
input I,
|
||||
input T,
|
||||
inout IO,
|
||||
inout IOB
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
@ -0,0 +1,31 @@
|
||||
//wtf doesnt do nothin!
|
||||
|
||||
module ISERDESE2 #(
|
||||
parameter DATA_RATE,
|
||||
parameter DATA_WIDTH,
|
||||
parameter INTERFACE_TYPE,
|
||||
parameter IOBDELAY,
|
||||
parameter NUM_CE,
|
||||
parameter SERDES_MODE
|
||||
)
|
||||
(
|
||||
input BITSLIP,
|
||||
input CE1,
|
||||
input CLK,
|
||||
input CLKB,
|
||||
input CLKDIV,
|
||||
input DDLY,
|
||||
input RST,
|
||||
output Q1,
|
||||
output Q2,
|
||||
output Q3,
|
||||
output Q4,
|
||||
output Q5,
|
||||
output Q6,
|
||||
output Q7,
|
||||
output Q8
|
||||
);
|
||||
|
||||
|
||||
endmodule
|
||||
|
@ -0,0 +1,95 @@
|
||||
`timescale 1 ps / 1 ps
|
||||
|
||||
module MMCME2_ADV #(
|
||||
parameter BANDWIDTH = "OPTIMIZED",
|
||||
parameter real CLKFBOUT_MULT_F = 5.000,
|
||||
parameter real CLKFBOUT_PHASE = 0.000,
|
||||
parameter CLKFBOUT_USE_FINE_PS = "FALSE",
|
||||
parameter real CLKIN1_PERIOD = 0.000,
|
||||
parameter real CLKIN2_PERIOD = 0.000,
|
||||
parameter real CLKOUT0_DIVIDE_F = 1.000,
|
||||
parameter real CLKOUT0_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT0_PHASE = 0.000,
|
||||
parameter CLKOUT0_USE_FINE_PS = "FALSE",
|
||||
parameter integer CLKOUT1_DIVIDE = 1,
|
||||
parameter real CLKOUT1_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT1_PHASE = 0.000,
|
||||
parameter CLKOUT1_USE_FINE_PS = "FALSE",
|
||||
parameter integer CLKOUT2_DIVIDE = 1,
|
||||
parameter real CLKOUT2_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT2_PHASE = 0.000,
|
||||
parameter CLKOUT2_USE_FINE_PS = "FALSE",
|
||||
parameter integer CLKOUT3_DIVIDE = 1,
|
||||
parameter real CLKOUT3_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT3_PHASE = 0.000,
|
||||
parameter CLKOUT3_USE_FINE_PS = "FALSE",
|
||||
parameter CLKOUT4_CASCADE = "FALSE",
|
||||
parameter integer CLKOUT4_DIVIDE = 1,
|
||||
parameter real CLKOUT4_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT4_PHASE = 0.000,
|
||||
parameter CLKOUT4_USE_FINE_PS = "FALSE",
|
||||
parameter integer CLKOUT5_DIVIDE = 1,
|
||||
parameter real CLKOUT5_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT5_PHASE = 0.000,
|
||||
parameter CLKOUT5_USE_FINE_PS = "FALSE",
|
||||
parameter integer CLKOUT6_DIVIDE = 1,
|
||||
parameter real CLKOUT6_DUTY_CYCLE = 0.500,
|
||||
parameter real CLKOUT6_PHASE = 0.000,
|
||||
parameter CLKOUT6_USE_FINE_PS = "FALSE",
|
||||
parameter COMPENSATION = "ZHOLD",
|
||||
parameter integer DIVCLK_DIVIDE = 1,
|
||||
parameter [0:0] IS_CLKINSEL_INVERTED = 1'b0,
|
||||
parameter [0:0] IS_PSEN_INVERTED = 1'b0,
|
||||
parameter [0:0] IS_PSINCDEC_INVERTED = 1'b0,
|
||||
parameter [0:0] IS_PWRDWN_INVERTED = 1'b0,
|
||||
parameter [0:0] IS_RST_INVERTED = 1'b0,
|
||||
parameter real REF_JITTER1 = 0.010,
|
||||
parameter real REF_JITTER2 = 0.010,
|
||||
parameter SS_EN = "FALSE",
|
||||
parameter SS_MODE = "CENTER_HIGH",
|
||||
parameter integer SS_MOD_PERIOD = 10000,
|
||||
parameter STARTUP_WAIT = "FALSE"
|
||||
)(
|
||||
output CLKFBOUT,
|
||||
output CLKFBOUTB,
|
||||
output CLKFBSTOPPED,
|
||||
output CLKINSTOPPED,
|
||||
output CLKOUT0,
|
||||
output CLKOUT0B,
|
||||
output CLKOUT1,
|
||||
output CLKOUT1B,
|
||||
output CLKOUT2,
|
||||
output CLKOUT2B,
|
||||
output CLKOUT3,
|
||||
output CLKOUT3B,
|
||||
output CLKOUT4,
|
||||
output CLKOUT5,
|
||||
output CLKOUT6,
|
||||
output [15:0] DO,
|
||||
output DRDY,
|
||||
output LOCKED,
|
||||
output PSDONE,
|
||||
|
||||
input CLKFBIN,
|
||||
input CLKIN1,
|
||||
input CLKIN2,
|
||||
input CLKINSEL,
|
||||
input [6:0] DADDR,
|
||||
input DCLK,
|
||||
input DEN,
|
||||
input [15:0] DI,
|
||||
input DWE,
|
||||
input PSCLK,
|
||||
input PSEN,
|
||||
input PSINCDEC,
|
||||
input PWRDWN,
|
||||
input RST
|
||||
);
|
||||
|
||||
assign CLKFBOUT = 1'b0; //feedback
|
||||
assign CLKOUT0 = CLKIN1;
|
||||
assign CLKOUT1 = CLKIN1;
|
||||
assign CLKOUT2 = CLKIN1;
|
||||
assign LOCKED = 1'b1;
|
||||
|
||||
endmodule
|
@ -0,0 +1,12 @@
|
||||
//wtf nop
|
||||
|
||||
module OBUFDS #(
|
||||
)
|
||||
(
|
||||
input I,
|
||||
inout O,
|
||||
inout OB
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
@ -0,0 +1,33 @@
|
||||
//wtf doesnt do nothin!
|
||||
|
||||
module OSERDESE2 #(
|
||||
parameter DATA_RATE_OQ,
|
||||
parameter DATA_RATE_TQ,
|
||||
parameter DATA_WIDTH,
|
||||
parameter SERDES_MODE,
|
||||
parameter TRISTATE_WIDTH
|
||||
)
|
||||
(
|
||||
input CLK,
|
||||
input CLKDIV,
|
||||
input DDLY,
|
||||
input RST,
|
||||
input D1,
|
||||
input D2,
|
||||
input D3,
|
||||
input D4,
|
||||
input D5,
|
||||
input D6,
|
||||
input D7,
|
||||
input D8,
|
||||
input OCE,
|
||||
input OFB,
|
||||
input T1,
|
||||
input TCE,
|
||||
output OQ,
|
||||
output TQ
|
||||
);
|
||||
|
||||
|
||||
endmodule
|
||||
|
@ -0,0 +1,93 @@
|
||||
`timescale 1ps / 1ps
|
||||
|
||||
module XADC (
|
||||
ALM,
|
||||
BUSY,
|
||||
CHANNEL,
|
||||
DO,
|
||||
DRDY,
|
||||
EOC,
|
||||
EOS,
|
||||
JTAGBUSY,
|
||||
JTAGLOCKED,
|
||||
JTAGMODIFIED,
|
||||
MUXADDR,
|
||||
OT,
|
||||
CONVST,
|
||||
CONVSTCLK,
|
||||
DADDR,
|
||||
DCLK,
|
||||
DEN,
|
||||
DI,
|
||||
DWE,
|
||||
RESET,
|
||||
VAUXN,
|
||||
VAUXP,
|
||||
VN,
|
||||
VP
|
||||
|
||||
);
|
||||
|
||||
output BUSY;
|
||||
output DRDY;
|
||||
output EOC;
|
||||
output EOS;
|
||||
output JTAGBUSY;
|
||||
output JTAGLOCKED;
|
||||
output JTAGMODIFIED;
|
||||
output OT;
|
||||
output [15:0] DO;
|
||||
output [7:0] ALM;
|
||||
output [4:0] CHANNEL;
|
||||
output [4:0] MUXADDR;
|
||||
|
||||
input CONVST;
|
||||
input CONVSTCLK;
|
||||
input DCLK;
|
||||
input DEN;
|
||||
input DWE;
|
||||
input RESET;
|
||||
input VN;
|
||||
input VP;
|
||||
input [15:0] DI;
|
||||
input [15:0] VAUXN;
|
||||
input [15:0] VAUXP;
|
||||
input [6:0] DADDR;
|
||||
|
||||
parameter [15:0] INIT_40 = 16'h0;
|
||||
parameter [15:0] INIT_41 = 16'h0;
|
||||
parameter [15:0] INIT_42 = 16'h0800;
|
||||
parameter [15:0] INIT_43 = 16'h0;
|
||||
parameter [15:0] INIT_44 = 16'h0;
|
||||
parameter [15:0] INIT_45 = 16'h0;
|
||||
parameter [15:0] INIT_46 = 16'h0;
|
||||
parameter [15:0] INIT_47 = 16'h0;
|
||||
parameter [15:0] INIT_48 = 16'h0;
|
||||
parameter [15:0] INIT_49 = 16'h0;
|
||||
parameter [15:0] INIT_4A = 16'h0;
|
||||
parameter [15:0] INIT_4B = 16'h0;
|
||||
parameter [15:0] INIT_4C = 16'h0;
|
||||
parameter [15:0] INIT_4D = 16'h0;
|
||||
parameter [15:0] INIT_4E = 16'h0;
|
||||
parameter [15:0] INIT_4F = 16'h0;
|
||||
parameter [15:0] INIT_50 = 16'h0;
|
||||
parameter [15:0] INIT_51 = 16'h0;
|
||||
parameter [15:0] INIT_52 = 16'h0;
|
||||
parameter [15:0] INIT_53 = 16'h0;
|
||||
parameter [15:0] INIT_54 = 16'h0;
|
||||
parameter [15:0] INIT_55 = 16'h0;
|
||||
parameter [15:0] INIT_56 = 16'h0;
|
||||
parameter [15:0] INIT_57 = 16'h0;
|
||||
parameter [15:0] INIT_58 = 16'h0;
|
||||
parameter [15:0] INIT_59 = 16'h0;
|
||||
parameter [15:0] INIT_5A = 16'h0;
|
||||
parameter [15:0] INIT_5B = 16'h0;
|
||||
parameter [15:0] INIT_5C = 16'h0;
|
||||
parameter [15:0] INIT_5D = 16'h0;
|
||||
parameter [15:0] INIT_5E = 16'h0;
|
||||
parameter [15:0] INIT_5F = 16'h0;
|
||||
|
||||
assign BUSY = 1'b0;
|
||||
assign DRDY = 1'b1;
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue