diff --git a/Makefile b/Makefile index 0991f47..cad1926 100644 --- a/Makefile +++ b/Makefile @@ -36,10 +36,12 @@ include Makefile.common libs/%.so: FAKE @make -C libs $(notdir $@) -test: test_logic_cfg test_routing_sw +test: test_logic_cfg test_iob_cfg test_routing_sw test_logic_cfg: autotest.out/autotest_logic_cfg.diff_to_gold +test_iob_cfg: autotest.out/autotest_iob_cfg.diff_to_gold + test_routing_sw: autotest.out/autotest_routing_sw.diff_to_gold autotest_%.diff_to_gold: autotest_%.log diff --git a/autotest.gold/autotest_iob_cfg.log b/autotest.gold/autotest_iob_cfg.log new file mode 100644 index 0000000..2e4c4d6 --- /dev/null +++ b/autotest.gold/autotest_iob_cfg.log @@ -0,0 +1,310 @@ + +O fpgatools automatic test suite. Be welcome and be our guest. namo namaha. + +O Test: iob_cfg +O Diff: ./autotest_diff.sh +O Skip: 0 +O Dry run: 0 + +O Time measured in seconds from 0. +O #NODIFF timestamp 0 +O Memory usage reported in megabytes. +O #NODIFF memusage 25 +O Building memory model... +O Done +O #NODIFF timestamp 4 +O #NODIFF memusage 85 + +O begin dump autotest.tmp/autotest_iob_cfg_000001.diff +fp: ++dev y72 x12 IOB 1 istd LVCMOS33 ++dev y72 x12 IOB 1 bypass_mux I ++dev y72 x12 IOB 1 imux I +bit: ++dev y72 x12 IOB 1 istd LVCMOS33 ++dev y72 x12 IOB 1 bypass_mux I ++dev y72 x12 IOB 1 imux I +O end dump autotest.tmp/autotest_iob_cfg_000001.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000002.diff +fp: ++dev y72 x12 IOB 1 istd LVCMOS33 ++dev y72 x12 IOB 1 bypass_mux I ++dev y72 x12 IOB 1 imux I_B +bit: ++dev y72 x12 IOB 1 istd LVCMOS33 ++dev y72 x12 IOB 1 bypass_mux I ++dev y72 x12 IOB 1 imux I_B +O end dump autotest.tmp/autotest_iob_cfg_000002.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000003.diff +fp: ++dev y72 x12 IOB 0 istd LVCMOS33 ++dev y72 x12 IOB 0 bypass_mux I ++dev y72 x12 IOB 0 imux I +bit: ++dev y72 x12 IOB 0 istd LVCMOS33 ++dev y72 x12 IOB 0 bypass_mux I ++dev y72 x12 IOB 0 imux I +O end dump autotest.tmp/autotest_iob_cfg_000003.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000004.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000004.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000005.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_OCT_ON +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_OCT_ON +O end dump autotest.tmp/autotest_iob_cfg_000005.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000006.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_KEEPER +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_KEEPER +O end dump autotest.tmp/autotest_iob_cfg_000006.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000007.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_PULLUP +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_PULLUP +O end dump autotest.tmp/autotest_iob_cfg_000007.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000008.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_PULLDOWN +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE_PULLDOWN +O end dump autotest.tmp/autotest_iob_cfg_000008.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000009.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend DRIVE_LAST_VALUE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend DRIVE_LAST_VALUE +O end dump autotest.tmp/autotest_iob_cfg_000009.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000010.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 2 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 2 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000010.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000011.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 4 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 4 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000011.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000012.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 6 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 6 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000012.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000013.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000013.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000014.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 12 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 12 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000014.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000015.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 16 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 16 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000015.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000016.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 24 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 24 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000016.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000017.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew SLOW ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000017.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000018.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew FAST ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew FAST ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000018.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000019.diff +fp: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew QUIETIO ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +bit: ++dev y72 x12 IOB 2 ostd LVCMOS33 ++dev y72 x12 IOB 2 strength 8 ++dev y72 x12 IOB 2 slew QUIETIO ++dev y72 x12 IOB 2 O_used ++dev y72 x12 IOB 2 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000019.diff + +O begin dump autotest.tmp/autotest_iob_cfg_000020.diff +fp: ++dev y72 x12 IOB 3 ostd LVCMOS33 ++dev y72 x12 IOB 3 strength 8 ++dev y72 x12 IOB 3 slew SLOW ++dev y72 x12 IOB 3 O_used ++dev y72 x12 IOB 3 suspend 3STATE ++net 1 in y72 x12 IOB 3 pin O +bit: ++dev y72 x12 IOB 3 ostd LVCMOS33 ++dev y72 x12 IOB 3 strength 8 ++dev y72 x12 IOB 3 slew SLOW ++dev y72 x12 IOB 3 O_used ++dev y72 x12 IOB 3 suspend 3STATE +O end dump autotest.tmp/autotest_iob_cfg_000020.diff + +O Test completed. +O #NODIFF timestamp 1055 +O #NODIFF memusage 85 + diff --git a/libs/bit_frames.c b/libs/bit_frames.c index 9952ebc..a18e455 100644 --- a/libs/bit_frames.c +++ b/libs/bit_frames.c @@ -161,8 +161,8 @@ static int write_iobs(struct fpga_bits* bits, struct fpga_model* model) } switch (dev->u.iob.slew) { case SLEW_SLOW: u64 |= XC6_IOB_SLEW_SLOW; break; - case SLEW_QUIETIO: u64 |= XC6_IOB_SLEW_QUIETIO; break; case SLEW_FAST: u64 |= XC6_IOB_SLEW_FAST; break; + case SLEW_QUIETIO: u64 |= XC6_IOB_SLEW_QUIETIO; break; default: HERE(); } switch (dev->u.iob.suspend) { @@ -250,11 +250,6 @@ static int extract_iobs(struct fpga_model* model, struct fpga_bits* bits) case XC6_IOB_OUTPUT_LVCMOS33_DRIVE_12: case XC6_IOB_OUTPUT_LVCMOS33_DRIVE_16: case XC6_IOB_OUTPUT_LVCMOS33_DRIVE_24: - u64 &= ~XC6_IOB_MASK_IO; - u64 &= ~XC6_IOB_MASK_O_PINW; - - strcpy(cfg.ostandard, IO_LVCMOS33); - cfg.O_used = 1; switch (u64 & XC6_IOB_MASK_IO) { case XC6_IOB_OUTPUT_LVCMOS33_DRIVE_2: cfg.drive_strength = 2; break; @@ -270,21 +265,25 @@ static int extract_iobs(struct fpga_model* model, struct fpga_bits* bits) cfg.drive_strength = 16; break; case XC6_IOB_OUTPUT_LVCMOS33_DRIVE_24: cfg.drive_strength = 24; break; - default: HERE(); + default: HERE(); break; } + u64 &= ~XC6_IOB_MASK_IO; + u64 &= ~XC6_IOB_MASK_O_PINW; + strcpy(cfg.ostandard, IO_LVCMOS33); + cfg.O_used = 1; switch (u64 & XC6_IOB_MASK_SLEW) { case XC6_IOB_SLEW_SLOW: u64 &= ~XC6_IOB_MASK_SLEW; cfg.slew = SLEW_SLOW; break; - case XC6_IOB_SLEW_QUIETIO: - u64 &= ~XC6_IOB_MASK_SLEW; - cfg.slew = SLEW_QUIETIO; - break; case XC6_IOB_SLEW_FAST: u64 &= ~XC6_IOB_MASK_SLEW; cfg.slew = SLEW_FAST; break; + case XC6_IOB_SLEW_QUIETIO: + u64 &= ~XC6_IOB_MASK_SLEW; + cfg.slew = SLEW_QUIETIO; + break; default: HERE(); } switch (u64 & XC6_IOB_MASK_SUSPEND) { @@ -318,6 +317,8 @@ static int extract_iobs(struct fpga_model* model, struct fpga_bits* bits) default: HERE(); break; } if (!u64) { + frame_set_u64(&bits->d[IOB_DATA_START + + i*IOB_ENTRY_LEN], 0); dev->instantiated = 1; dev->u.iob = cfg; } else HERE(); diff --git a/libs/bit_regs.c b/libs/bit_regs.c index ec99e1f..92b88c0 100644 --- a/libs/bit_regs.c +++ b/libs/bit_regs.c @@ -1005,7 +1005,8 @@ static int FAR_pos(int FAR_row, int FAR_major, int FAR_minor) return result + FAR_minor*130; } -static int read_bits(struct fpga_config* cfg, uint8_t* d, int len, int inpos, int* outdelta) +static int read_bits(struct fpga_config* cfg, uint8_t* d, int len, + int inpos, int* outdelta) { int src_off, packet_hdr_type, packet_hdr_opcode; int packet_hdr_register, packet_hdr_wordcount; diff --git a/libs/helper.c b/libs/helper.c index c47c08e..245bcc4 100644 --- a/libs/helper.c +++ b/libs/helper.c @@ -540,8 +540,12 @@ uint64_t frame_get_u64(uint8_t* frame_d) void frame_set_u8(uint8_t* frame_d, uint8_t v) { int i; - for (i = 0; i < 8; i++) - if (v & (1<<(7-i))) (*frame_d) |= 1<