From: Luke Kenneth Casson Leighton Date: Fri, 11 Feb 2022 12:28:28 +0000 (+0000) Subject: add first cut of ulx3s constraint file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81b96e024ea117ba5748b9f94088b452edec9356;p=microwatt.git add first cut of ulx3s constraint file --- diff --git a/constraints/ulx3s.lpf b/constraints/ulx3s.lpf new file mode 100644 index 0000000..abbc94c --- /dev/null +++ b/constraints/ulx3s.lpf @@ -0,0 +1,19 @@ +LOCATE COMP "ext_clk" SITE "G2"; +IOBUF PORT "ext_clk" IO_TYPE=LVCMOS33; + +LOCATE COMP "ext_rst" SITE "D6"; +IOBUF PORT "ext_rst" PULLMODE=UP IO_TYPE=LVCMOS33 DRIVE=4; + +LOCATE COMP "uart0_txd" SITE "L4"; +LOCATE COMP "uart0_rxd" SITE "M1"; + +IOBUF PORT "uart0_txd" IO_TYPE=LVCMOS33; +IOBUF PORT "uart0_rxd" IO_TYPE=LVCMOS33; + +LOCATE COMP "led_a" SITE "B2"; +LOCATE COMP "led_b" SITE "C2"; +LOCATE COMP "led_c" SITE "C1"; + +IOBUF PORT "led_a" IO_TYPE=LVCMOS25 DRIVE=4; +IOBUF PORT "led_b" IO_TYPE=LVCMOS25 DRIVE=4; +IOBUF PORT "led_c" IO_TYPE=LVCMOS25 DRIVE=4; diff --git a/soc.vhdl b/soc.vhdl index 042f224..c3f6a9c 100644 --- a/soc.vhdl +++ b/soc.vhdl @@ -796,7 +796,7 @@ begin end generate; wb_uart0_out.dat <= x"000000" & uart0_dat8; - wb_uart0_out.stall <= not wb_uart0_out.ack; + wb_uart0_out.stall <= wb_uart0_in.cyc and not wb_uart0_out.ack; -- -- UART1 @@ -835,7 +835,7 @@ begin end if; end process; wb_uart1_out.dat <= x"000000" & uart1_dat8; - wb_uart1_out.stall <= not wb_uart1_out.ack; + wb_uart1_out.stall <= wb_uart1_in.cyc and not wb_uart1_out.ack; end generate; no_uart1 : if not HAS_UART1 generate @@ -931,7 +931,7 @@ begin no_bram: if MEMORY_SIZE = 0 generate wb_bram_out.ack <= wb_bram_in.cyc and wb_bram_in.stb; wb_bram_out.dat <= x"FFFFFFFFFFFFFFFF"; - wb_bram_out.stall <= not wb_bram_out.ack; + wb_bram_out.stall <= wb_bram_in.cyc and not wb_bram_out.ack; end generate; -- DMI(debug bus) <-> JTAG bridge diff --git a/tests/mmu/mmu.c b/tests/mmu/mmu.c index ef00824..faa9835 100644 --- a/tests/mmu/mmu.c +++ b/tests/mmu/mmu.c @@ -143,18 +143,43 @@ static unsigned long *read_pgd(unsigned long i) void map(void *ea, void *pa, unsigned long perm_attr) { unsigned long epn = (unsigned long) ea >> 12; - unsigned long i, j; + unsigned long i, j, pte; unsigned long *ptep; i = (epn >> 9) & 0x3ff; j = epn & 0x1ff; + + /*print_string(" ea "); + print_hex((unsigned long)ea); + print_string(" epn "); + print_hex(epn); + print_string(" i "); + print_hex(i); + print_string(" j "); + print_hex(j); + */ + if (pgdir[i] == 0) { zero_memory((void *)free_ptr, 512 * sizeof(unsigned long)); - store_pte(&pgdir[i], 0x8000000000000000 | free_ptr | 9); + pte = 0x8000000000000000 | free_ptr | 9; + store_pte(&pgdir[i], pte); +/* + print_string("store PDE @ "); + print_hex((unsigned long)pgdir[i]); + print_string(" => "); + print_hex(pte); + print_string(" "); +*/ free_ptr += 512 * sizeof(unsigned long); } ptep = read_pgd(i); - store_pte(&ptep[j], 0xc000000000000000 | ((unsigned long)pa & 0x00fffffffffff000) | perm_attr); + pte = 0xc000000000000000 | ((unsigned long)pa & 0x00fffffffffff000) | perm_attr; + store_pte(&ptep[j], pte); + print_string("store PTE @ "); + print_hex((unsigned long)&ptep[j]); + print_string(" => "); + print_hex(pte); + print_string(" "); eas_mapped[neas_mapped++] = ea; } @@ -671,14 +696,17 @@ void do_test(int num, int (*test)(void)) int main(void) { console_init(); + print_string("starting\r\n"); init_mmu(); +/* */ do_test(1, mmu_test_1); do_test(2, mmu_test_2); do_test(3, mmu_test_3); do_test(4, mmu_test_4); do_test(5, mmu_test_5); do_test(6, mmu_test_6); +/* */ do_test(7, mmu_test_7); do_test(8, mmu_test_8); do_test(9, mmu_test_9); @@ -692,6 +720,6 @@ int main(void) do_test(17, mmu_test_17); do_test(18, mmu_test_18); do_test(19, mmu_test_19); - + /* */ return fail; } diff --git a/verilator/microwatt-verilator.cpp b/verilator/microwatt-verilator.cpp index 494b4c8..a226393 100644 --- a/verilator/microwatt-verilator.cpp +++ b/verilator/microwatt-verilator.cpp @@ -130,7 +130,7 @@ static void mem_write(unsigned char *mem, // sigh yes, all these should be runtime commandline options #define TRIGGER_ENABLE #define TRIGGER_OCCURENCES 1 -//#define TRIGGER_COUNTDOWN 10000 +#define TRIGGER_COUNTDOWN 20000 //#define TERMINATE_AT_COUNTDOWN //#define TRIGGER_NIA 0xa580 //#define TRIGGER_INSN 0xe8628008 @@ -138,8 +138,19 @@ static void mem_write(unsigned char *mem, //#define TRIGGER_INSN 0x7db243a6 //define TRIGGER_NIA 0x603348 //#define TRIGGER_INSN 0x7c842a14 -#define TRIGGER_NIA 0xc00000000042f788 -#define TRIGGER_INSN 0x7c0802a6 +//#define TRIGGER_NIA 0xc00000000042f788 +//#define TRIGGER_INSN 0x7c0802a6 +//#define TRIGGER_INSN 0x7c842a14 +//#define TRIGGER_NIA 0xc00000000042f788 +//#define TRIGGER_INSN 0x7c0802a6 +//#define TRIGGER_NIA 0xc000000000434fc0 +//#define TRIGGER_INSN 0x4bddc159 +//#define TRIGGER_NIA 0x300 +//#define TRIGGER_INSN 0x7db243a6 +//#define TRIGGER_NIA 0xc0000000000d0cbc +//#define TRIGGER_INSN 0xf93e0000 +#define TRIGGER_NIA 0xc00000000011e46c +#define TRIGGER_INSN 0x60000000 //#define TRIGGER_NIA 0xc000000000077b90 //#define TRIGGER_NIA 0xc0000000000cf600 //#define TRIGGER_INSN 0x38210040