diff --git a/ActionTypes.md b/ActionTypes.md index d2c88dac..ebcdbaa6 100644 --- a/ActionTypes.md +++ b/ActionTypes.md @@ -18,7 +18,8 @@ IBM | 10.14.10.07 | 10.14.10.07 | HLS NVMe memcopy IBM | 10.14.10.08 | 10.14.10.08 | HLS Hello World IBM | 10.14.10.09 | 10.14.10.09 | HLS Latency Evaluation IBM | 10.14.10.0A | 10.14.10.0A | HLS WED/STATUS Sharing and MatrixMultiply -IBM | 10.14.10.0B | 10.14.FF.FF | Reserved for IBM Actions +IBM | 10.14.10.0B | 10.14.10.0B | HLS Decimal multiplication +IBM | 10.14.10.0C | 10.14.FF.FF | Reserved for IBM Actions MLE | 22.DB.00.01 | 22.DB.00.01 | HDL 10G Ethernet TCP/UDP/IP Accelerator Demo MLE | 22.DB.00.02 | 22.DB.00.02 | HDL 25G Ethernet TCP/UDP/IP Accelerator Demo Reserved | FF.FF.00.00 | FF.FF.FF.FF | Reserved diff --git a/actions/README.md b/actions/README.md index 744bd7cc..5d15dd7d 100644 --- a/actions/README.md +++ b/actions/README.md @@ -35,12 +35,13 @@ To configure the include path for the common header files with the Xilinx Vivado |:------------------------|:--:|:-:|:--:|:-:|:-------------------------------------------------------------------------------- | **hdl**\_example | X | X | X | | Shows how to use MMIO registers: Software application uses one of them to collect a hardware counter value. Also shows how to copy data between Host, FPGA, card DDR and card NVMe(Flash) in **VHDL** (**Bandwidth measurement**). | **hdl**\_nvme_example | X | X | X | | Example to read and write 4k NVMe blocks. It provides a block layer library which is compatible to the IBM CapiFLASH block API and contains experiments for caching and prefetching. -| hls_bfs | X | | | | Breadth first search (graph data): shows how to access a complex data structure. -| hls_hashjoin | X | | | | Hashjoin function: shows how to implement a database operation. | hls_helloworld | X | | | | **Discovery example** changing all characters of a string into lower or upper cases. -| hls_latencyeval | X | | | | Shows how to code the application and the action to get the lowest latency (**Latency measurement**) | hls_memcopy | X | X | | | Shows how to copy data between Host, FPGA and card DDR (**Bandwidth measurement**). | hls_nvme_memcopy | X | X | X | | Shows how to copy data between Host, FPGA, card DDR and card NVMe(Flash) (**Bandwidth measurement**). +| hls_bfs | X | | | | Breadth first search (graph data): shows how to access a complex data structure. +| hls_hashjoin | X | | | | Hashjoin function: shows how to implement a database operation. +| hls_latencyeval | X | | | | Shows how to code the application and the action to get the lowest latency (**Latency measurement**) | hls_search | X | X | | | Shows how to code an action providing multiple operations: memcopy + different searches such as Naive, KMP and streaming mode (_code not optimized_) | hls_sponge | X | | | | Shows how an FPGA can compete against a multi-threaded CPU on a compute intensive code (SHA3) (**Compute-only benchmark**) +| hls_decimal_mult | X | | | | Shows how to manage decimal values exchanged between the application on the server and the action in the FPGA diff --git a/actions/hls_decimal_mult/Makefile b/actions/hls_decimal_mult/Makefile new file mode 100644 index 00000000..377adb89 --- /dev/null +++ b/actions/hls_decimal_mult/Makefile @@ -0,0 +1,39 @@ +# +# Copyright 2017 International Business Machines +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +subdirs += sw hw + +all: $(subdirs) + +# Only build if the subdirectory is existent and if Makefile is there +.PHONY: $(subdirs) +$(subdirs): + @if [ -d $@ -a -f $@/Makefile ]; then \ + $(MAKE) -C $@ || exit 1; \ + else \ + echo "INFO: No Makefile available in $@ ..."; \ + fi + +# Cleanup for all subdirectories. +# Only dive into subdirectory if existent and if Makefile is there. +clean: + @for dir in $(subdirs); do \ + if [ -d $$dir -a -f $$dir/Makefile ]; then \ + $(MAKE) -C $$dir $@ || exit 1; \ + fi \ + done + @find . -depth -name '*~' -exec rm -rf '{}' \; -print + @find . -depth -name '.#*' -exec rm -rf '{}' \; -print diff --git a/actions/hls_decimal_mult/README.md b/actions/hls_decimal_mult/README.md new file mode 100644 index 00000000..b01d61a6 --- /dev/null +++ b/actions/hls_decimal_mult/README.md @@ -0,0 +1,55 @@ +# HLS_DECIMAL_MULT EXAMPLE + +* Provides a simple base allowing to discover how to exchange ***single precision floating points (float) or double precision floating points (double)*** between the application on server and the action in the FPGA. +* C code is multiplying 3 decimal numbers read from host memory and writing result in host memory + * code can be executed on the CPU (application + software action) + * code can be simulated (application + software and hardware action) + * code can then run in hardware when the FPGA is programmed (application + software and hardware action) +* The example code shows the following: + * **application** writes floats or doubles to system host memory and read results to display and compare results processed and expected + * **software or hardware action** reads floats or doubles from system memory, multiply decimals 3 by 3 and write the results back in memory + The key point here is for the FPGA to ***understand*** the data read from the host memory and formatted by the server Operating System. The code shows the conversion to be done so that the number read can be used as a float or double in HLS code. +As an example it is important to understand that 4.5 is represented in host memory differently depending on the type used: + * as a double as 0x4012_0000_0000_0000 + * as a float as 0x4090_0000. + + __Usage:__ + * `./snap_decimal_mult -n12 -v` Application calls the hardware action and multiply 12 values 3 by 3. Dumps of data displayed + * `SNAP_CONFIG=CPU ./snap_decimal_mult` Application calls the software action + * `SNAP_TRACE=0xF ./snap_decimal_mult` to display all MMIO exchanged between application and action + * `./../tests/test_0x1014100B.sh` to execute automatic testing + + __Parameters:__ +* arguments in command line: + * `-n [value]` defines the number of decimals to process (lower or equal than MAX_NB_OF_DECIMAL_READ) + * `-w` writes to files the result processed by the action (dec_mult_action.bin) and the expected results (dec_mult_ref.bin). Used for automatic testing. + * `-v` verbose mode which will display a dump of the inputs and results from host memory +* parameters in include/common_decimal.h: + * `#define MAX_NB_OF_DECIMAL_READ 16` defines the maximum number of decimals to read + * `typedef float mat_elmt_t;` definse the type used: float or double + +__Files used__: +``` +| +| Makefile General Makefile used to automatically prepare the final files +| README.md Documentation file for this example +| +├───sw Software directory containing application called from POWER host and software action +| snap_decimal_mult.c APPLICATION which calls the software or the hardware action depending on the flag used +| (use SNAP_CONFIG=CPU to call software action and SNAP_CONFIG=FPGA or nothing to call hardware action) +| action_decimal_mult.c SOFTWARE ACTION which will be executed on the CPU only +| Makefile Makefile to compile the software files +| +├───include Common directory to sw and hw +| common_decimal.h COMMON HEADER file used by the application and the software/hardware action. +| (It contains the main structure and the defines parameters) +| +├───hw Hardware directory containing the hardware action +| action_decimal_mult.cpp HARDWARE ACTION which will be executed on FPGA and is called by the application +| action_decimal_mult.H header file containing hardware action parameters +| Makefile Makefile to compile the hardware action using Vivado HLS synthesizer +| +└───tests Test directory containing all automated tests + test_0x1014100B.sh Basic test shell running snap_decimal_mult application + ``` + diff --git a/actions/hls_decimal_mult/hw/Makefile b/actions/hls_decimal_mult/hw/Makefile new file mode 100644 index 00000000..2b1bf4b8 --- /dev/null +++ b/actions/hls_decimal_mult/hw/Makefile @@ -0,0 +1,46 @@ +# +# Copyright 2017 International Business Machines +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Generate HDL version of the HLS sources +# +# The generated HDL depends on the chip which is used and +# therefore must match what is being used to build the +# toplevel SNAP bitstream. +# +# FIXME Pass part_number and other parameters from toplevel +# build-system as required. +# + +# Finding $SNAP_ROOT +ifndef SNAP_ROOT +# check if we are in hw folder of an action (three directories below snap root) +ifneq ("$(wildcard ../../../ActionTypes.md)","") +SNAP_ROOT=$(abspath ../../../) +else +$(info You are not building your software from the default directory (/path/to/snap/actions//sw) or specified a wrong $$SNAP_ROOT.) +$(error Please make sure that $$SNAP_ROOT is set up correctly.) +endif +endif + +# This is solution specific. Check if we can replace this by generics too. +SOLUTION_NAME ?= decimal_mult +SOLUTION_DIR ?= hlsDecimalMult +srcs += action_decimal_mult.cpp + +# If you have the action code outside of the default snap directory structure, +# change to /path/to/snap/actions/hls.mk +include $(SNAP_ROOT)/actions/hls.mk diff --git a/actions/hls_decimal_mult/hw/action_decimal_mult.H b/actions/hls_decimal_mult/hw/action_decimal_mult.H new file mode 100644 index 00000000..ee356c67 --- /dev/null +++ b/actions/hls_decimal_mult/hw/action_decimal_mult.H @@ -0,0 +1,40 @@ +#ifndef __ACTION_DECIMAL_MULT_H__ +#define __ACTION_DECIMAL_MULT_H__ + +/* + * Copyright 2017 International Business Machines + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "hls_snap.H" +#include /* DecimalMult Job definition */ + +#define RELEASE_LEVEL 0x00000010 + +#define MAX_NB_OF_WORDS_READ (MAX_NB_OF_DECIMAL_READ*sizeof(mat_elmt_t)/BPERDW) // =2 if double =1 if float +#define MAX_NB_OF_DECIMAL_PERDW (BPERDW/sizeof(mat_elmt_t)) // =8 if double =16 if float + +typedef char word_t[BPERDW]; +//--------------------------------------------------------------------- +typedef struct { + CONTROL Control; /* 16 bytes */ + decimal_mult_job_t Data; /* up to 108 bytes */ + uint8_t padding[SNAP_HLS_JOBSIZE - sizeof(decimal_mult_job_t)]; +} action_reg; + +#endif /* __ACTION_DECIMAL_MULT_H__*/ diff --git a/actions/hls_decimal_mult/hw/action_decimal_mult.cpp b/actions/hls_decimal_mult/hw/action_decimal_mult.cpp new file mode 100644 index 00000000..cb1bf80b --- /dev/null +++ b/actions/hls_decimal_mult/hw/action_decimal_mult.cpp @@ -0,0 +1,243 @@ +/* + * Copyright 2017 International Business Machines + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * SNAP HLS_DECIMAL_MULT EXAMPLE + * + */ + +#include +#include +#include "ap_int.h" +#include "action_decimal_mult.H" + + +// Cast data read from AXI input port to decimal values +static void mbus_to_decimal(snap_membus_t *data_read, mat_elmt_t *table_decimal_in) +{ + union { + uint64_t value_u; + mat_elmt_t value_d; + }; + + loop_m2d1: for(int i = 0; i < MAX_NB_OF_WORDS_READ; i++) +#pragma HLS PIPELINE + loop_m2d2: for(int j = 0; j < MAX_NB_OF_DECIMAL_PERDW; j++) + { + value_u = (uint64_t)data_read[i]((8*sizeof(mat_elmt_t)*(j+1))-1, (8*sizeof(mat_elmt_t)*j)); + table_decimal_in[i*MAX_NB_OF_DECIMAL_PERDW + j] = value_d; + } + +} + +// Cast decimal values to AXI output port format (64 Bytes) +static void decimal_to_mbus(mat_elmt_t *table_decimal_out, snap_membus_t *data_to_be_written) +{ + union { + mat_elmt_t value_d; + uint64_t value_u; + }; + loop_d2m1: for(int i = 0; i < MAX_NB_OF_WORDS_READ; i++) +#pragma HLS PIPELINE + loop_d2m2: for(int j = 0; j < MAX_NB_OF_DECIMAL_PERDW; j++) + { + value_d = table_decimal_out[i*MAX_NB_OF_DECIMAL_PERDW + j]; + data_to_be_written[i]((8*sizeof(mat_elmt_t)*(j+1))-1, (8*sizeof(mat_elmt_t)*j)) = (uint64_t)value_u; + } +} + + +//---------------------------------------------------------------------- +//--- MAIN PROGRAM ----------------------------------------------------- +//---------------------------------------------------------------------- +static int process_action(snap_membus_t *din_gmem, + snap_membus_t *dout_gmem, + action_reg *act_reg) +{ + uint32_t size; + int nb_of_words_to_process; + uint64_t i_idx, o_idx; + + // snap_membus_t=64Bytes => a word read contains 8 double of 8 bytes or 16 float of 4 bytes + // Parameters are defined in header file + // For this example, we defined 16 doubles/floats to read and process + snap_membus_t buffer_in[MAX_NB_OF_WORDS_READ], buffer_out[MAX_NB_OF_WORDS_READ]; + // mat_elmt_t is defined on header file as float or double type + mat_elmt_t data_in[MAX_NB_OF_DECIMAL_READ], data_out[MAX_NB_OF_DECIMAL_READ]; + + + /* COLLECT PARAMS from the structure filled and sent by the application */ + /* byte address received need to be aligned with port width (mandatory)*/ + i_idx = act_reg->Data.in.addr >> ADDR_RIGHT_SHIFT; + o_idx = act_reg->Data.out.addr >> ADDR_RIGHT_SHIFT; + + // nb_of_words_to_process of double/float words we should process + // (This is to add a variable managed by the application) + nb_of_words_to_process = (int)(act_reg->Data.in.size); + + // READ MAX_NB_OF_DECIMAL_READ of 8 or 4 bytes on port din_gmem at address i_idx and put result in buffer_in + memcpy(buffer_in, (snap_membus_t*)(din_gmem + i_idx), MAX_NB_OF_DECIMAL_READ*sizeof(mat_elmt_t)); + + // CONVERT MAX_NB_OF_DECIMAL_READ*8 Bytes of data read into a table of 16 doubles OR + // CONVERT MAX_NB_OF_DECIMAL_READ*4 Bytes of data read into a table of 32 floats + mbus_to_decimal(buffer_in, data_in); + + // PROCESSING THE DATA (one third number of results) + loop_proc: for (int i = 0; i < nb_of_words_to_process/3; i++) + { +#pragma HLS PIPELINE + data_out[i] = data_in[3*i] * data_in[(3*i)+1] * data_in[(3*i)+2]; + } + + + // CONVERT the doubles to a format that can be sent to host memory + decimal_to_mbus(data_out, buffer_out); + + // WRITE all results (= one third of the inputs number) + // HLS bug: memcpy can be used only when writing more than 64B. + // Circumvention in Issue #652 of snap githib + //memcpy(dout_gmem + o_idx, &buffer_out, MAX_NB_OF_DECIMAL_READ*sizeof(mat_elmt_t)); + if ((nb_of_words_to_process/3)*sizeof(mat_elmt_t) < 64) + (dout_gmem + o_idx)[0] = buffer_out[0]; + else + memcpy(dout_gmem + o_idx, &buffer_out, (nb_of_words_to_process/3)*sizeof(mat_elmt_t)); + + act_reg->Control.Retc = SNAP_RETC_SUCCESS; + + return 0; +} + +//--- TOP LEVEL MODULE ------------------------------------------------- +void hls_action(snap_membus_t *din_gmem, + snap_membus_t *dout_gmem, + /* snap_membus_t *d_ddrmem, */ /* if unused => uncheck "Enable SDRAM" in menu */ + action_reg *act_reg, + action_RO_config_reg *Action_Config) +{ + // Host Memory AXI Interface +#pragma HLS INTERFACE m_axi port=din_gmem bundle=host_mem offset=slave depth=512 \ + max_read_burst_length=64 max_write_burst_length=64 +#pragma HLS INTERFACE s_axilite port=din_gmem bundle=ctrl_reg offset=0x030 + +#pragma HLS INTERFACE m_axi port=dout_gmem bundle=host_mem offset=slave depth=512 \ + max_read_burst_length=64 max_write_burst_length=64 +#pragma HLS INTERFACE s_axilite port=dout_gmem bundle=ctrl_reg offset=0x040 + +/* // DDR memory Interface + * #pragma HLS INTERFACE m_axi port=d_ddrmem bundle=card_mem0 offset=slave depth=512 \ + * max_read_burst_length=64 max_write_burst_length=64 + * #pragma HLS INTERFACE s_axilite port=d_ddrmem bundle=ctrl_reg offset=0x050 + */ + // Host Memory AXI Lite Master Interface +#pragma HLS DATA_PACK variable=Action_Config +#pragma HLS INTERFACE s_axilite port=Action_Config bundle=ctrl_reg offset=0x010 +#pragma HLS DATA_PACK variable=act_reg +#pragma HLS INTERFACE s_axilite port=act_reg bundle=ctrl_reg offset=0x100 +#pragma HLS INTERFACE s_axilite port=return bundle=ctrl_reg + + /* Required Action Type Detection */ + // Test used to exit the action if no parameter has been set. + // Used for the discovery phase of the cards */ + switch (act_reg->Control.flags) { + case 0: + Action_Config->action_type = DECIMALMULT_ACTION_TYPE; + Action_Config->release_level = RELEASE_LEVEL; + act_reg->Control.Retc = 0xe00f; + return; + break; + default: + /* process_action(din_gmem, dout_gmem, d_ddrmem, act_reg); */ + process_action(din_gmem, dout_gmem, act_reg); + break; + } +} + +//----------------------------------------------------------------------------- +//--- TESTBENCH --------------------------------------------------------------- +//----------------------------------------------------------------------------- + +#ifdef NO_SYNTH + + +int main(void) +{ +#define MEMORY_LINES 2 + int rc = 0; + unsigned int i; + static snap_membus_t din_gmem[MEMORY_LINES]; + static snap_membus_t dout_gmem[MEMORY_LINES]; + + //snap_membus_t dout_gmem[2048]; + action_reg act_reg; + action_RO_config_reg Action_Config; + + /* Query ACTION_TYPE ... */ + act_reg.Control.flags = 0x0; + printf("Discovery : calling action to get config data\n"); + hls_action(din_gmem, dout_gmem, &act_reg, &Action_Config); + fprintf(stderr, + "ACTION_TYPE: %08x\n" + "RELEASE_LEVEL: %08x\n" + "RETC: %04x\n", + (unsigned int)Action_Config.action_type, + (unsigned int)Action_Config.release_level, + (unsigned int)act_reg.Control.Retc); + + memset(din_gmem, 0, 128); + union { + mat_elmt_t value_d; + uint64_t value_u; + }; + + + //Fill a table with 16 values: 1.0, 1.5, 2.0, 2.5,... 8.5 + //Not fullly debugged yet + for(i = 0; i < 16 ; i++){ + value_d = 1 + i*0.5; + if (i < 8) + din_gmem[0] = value_u << 64*(i%8); + else + din_gmem[1] = value_u << 64*(i%8); + } + printf("Input is : %s\n", (char *)((unsigned long)din_gmem + 0)); + + act_reg.Control.flags = 0x1; /* just not 0x0 */ + + act_reg.Data.in.addr = 0; + act_reg.Data.in.size = 16; + act_reg.Data.in.type = SNAP_ADDRTYPE_HOST_DRAM; + + act_reg.Data.out.addr = 0; + act_reg.Data.out.size = 16; + act_reg.Data.out.type = SNAP_ADDRTYPE_HOST_DRAM; + + printf("Action call \n"); + hls_action(din_gmem, dout_gmem, &act_reg, &Action_Config); + if (act_reg.Control.Retc == SNAP_RETC_FAILURE) { + fprintf(stderr, " ==> RETURN CODE FAILURE <==\n"); + return 1; + } + + printf("Output is : %s\n", (char *)((unsigned long)dout_gmem + 0)); + + + printf(">> ACTION TYPE = %08lx - RELEASE_LEVEL = %08lx <<\n", + (unsigned int)Action_Config.action_type, + (unsigned int)Action_Config.release_level); + return 0; +} + +#endif diff --git a/actions/hls_decimal_mult/include/common_decimal.h b/actions/hls_decimal_mult/include/common_decimal.h new file mode 100644 index 00000000..7f83bf3b --- /dev/null +++ b/actions/hls_decimal_mult/include/common_decimal.h @@ -0,0 +1,40 @@ +#ifndef __COMMON_DECIMAL_H__ +#define __COMMON_DECIMAL_H__ + +/* + * Copyright 2017 International Business Machines + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define DECIMALMULT_ACTION_TYPE 0x1014100B + +typedef struct decimal_mult_job { + struct snap_addr in; /* input data */ + struct snap_addr out; /* offset table */ +} decimal_mult_job_t; + +#define MAX_NB_OF_DECIMAL_READ 16 +typedef float mat_elmt_t; // change to float or double depending on your needs + +#ifdef __cplusplus +} +#endif + +#endif /* __COMMON_DECIMAL_H__*/ diff --git a/actions/hls_decimal_mult/sw/Makefile b/actions/hls_decimal_mult/sw/Makefile new file mode 100644 index 00000000..2238c468 --- /dev/null +++ b/actions/hls_decimal_mult/sw/Makefile @@ -0,0 +1,48 @@ +# +# Copyright 2017 International Business Machines +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Generate HDL version of the HLS sources +# +# The generated HDL depends on the chip which is used and +# therefore must match what is being used to build the +# toplevel SNAP bitstream. +# +# FIXME Pass part_number and other parameters from toplevel +# build-system as required. +# + +# Finding $SNAP_ROOT +ifndef SNAP_ROOT +# check if we are in sw folder of an action (three directories below snap root) +ifneq ("$(wildcard ../../../ActionTypes.md)","") +SNAP_ROOT=$(abspath ../../../) +else +$(info You are not building your software from the default directory (/path/to/snap/actions//sw) or specified a wrong $$SNAP_ROOT.) +$(error Please make sure that $$SNAP_ROOT is set up correctly.) +endif +endif + +# This is solution specific. Check if we can replace this by generics too. + +snap_decimal_mult: action_decimal_mult.o +snap_decimal_mult_objs = action_decimal_mult.o + +projs += snap_decimal_mult + +# If you have the host code outside of the default snap directory structure, +# change to /path/to/snap/actions/software.mk +include $(SNAP_ROOT)/actions/software.mk diff --git a/actions/hls_decimal_mult/sw/action_decimal_mult.c b/actions/hls_decimal_mult/sw/action_decimal_mult.c new file mode 100644 index 00000000..b9f7bdf6 --- /dev/null +++ b/actions/hls_decimal_mult/sw/action_decimal_mult.c @@ -0,0 +1,109 @@ +/* + * Copyright 2017 International Business Machines + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Example to use the FPGA to multiply two single or double precision floatingpoint numbers + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* __be64 */ +#include + +#include +#include +#include + +static int mmio_write32(struct snap_card *card, + uint64_t offs, uint32_t data) +{ + act_trace(" %s(%p, %llx, %x)\n", __func__, card, + (long long)offs, data); + return 0; +} + +static int mmio_read32(struct snap_card *card, + uint64_t offs, uint32_t *data) +{ + act_trace(" %s(%p, %llx, %x)\n", __func__, card, + (long long)offs, *data); + return 0; +} + +static int action_main(struct snap_sim_action *action, + void *job, unsigned int job_len) +{ + struct decimal_mult_job *js = (struct decimal_mult_job *)job; + mat_elmt_t *src, *dst; + size_t size; + size_t i; + + /* No error checking ... */ + act_trace("%s(%p, %p, %d) type_in=%d type_out=%d jobsize %ld bytes\n", + __func__, action, job, job_len, js->in.type, js->out.type, + sizeof(*js)); + + //__hexdump(stderr, js, sizeof(*js)); + + size = js->in.size; + dst = (mat_elmt_t *)(unsigned long)js->out.addr; + src = (mat_elmt_t *)(unsigned long)js->in.addr; + + act_trace(" copy %p to %p %ld decimal (of %d bytes)\n", src, dst, size, + (int)sizeof(mat_elmt_t)); + + printf("Processing done by the software action (sw directory)\n"); + // Process data multiplying double/float 3 by 3 + for ( i = 0; i < size/3; i++ ) { + dst[i] = src[3*i] * src[(3*i)+1] * src[(3*i)+2]; + printf("\t i=%ld - dst[i]= %f\n", i, dst[i]); + } + + + action->job.retc = SNAP_RETC_SUCCESS; + return 0; + +} + +static struct snap_sim_action action = { + .vendor_id = SNAP_VENDOR_ID_ANY, + .device_id = SNAP_DEVICE_ID_ANY, + .action_type = DECIMALMULT_ACTION_TYPE, + + .job = { .retc = SNAP_RETC_FAILURE, }, + .state = ACTION_IDLE, + .main = action_main, + .priv_data = NULL, /* this is passed back as void *card */ + .mmio_write32 = mmio_write32, + .mmio_read32 = mmio_read32, + + .next = NULL, +}; + +static void _init(void) __attribute__((constructor)); + +static void _init(void) +{ + snap_action_register(&action); +} diff --git a/actions/hls_decimal_mult/sw/snap_decimal_mult.c b/actions/hls_decimal_mult/sw/snap_decimal_mult.c new file mode 100644 index 00000000..d1c39a3b --- /dev/null +++ b/actions/hls_decimal_mult/sw/snap_decimal_mult.c @@ -0,0 +1,324 @@ +/* + * Copyright 2017 International Business Machines + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * SNAP Decimal_Mult Example + * + * Demonstration how to get data into the FPGA, process it using a SNAP + * action and move the data out of the FPGA back to host-DRAM. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +int verbose_flag = 0; + +static const char *version = GIT_VERSION; + +static const char *mem_tab[] = { "HOST_DRAM", "CARD_DRAM", "TYPE_NVME" }; + +/** + * @brief prints valid command line options + * + * @param prog current program's name + */ +static void usage(const char *prog) +{ + printf("Usage: %s [-h] [-v, --verbose] [-V, --version]\n" + " -C, --card can be (0...3)\n" + " -n, --number number of inputs to process < %d (configurable).\n" + " -t, --timeout timeout in sec to wait for done.\n" + " -N, --no-irq disable Interrupts\n" + "\n" + "Example:\n" + " snap_decimal_mult. ...\n" + "\n", + prog, MAX_NB_OF_DECIMAL_READ); +} + +static void snap_prepare_decimal_mult(struct snap_job *cjob, + struct decimal_mult_job *mjob, + void *addr_in, + uint32_t size_in, + uint8_t type_in, + void *addr_out, + uint32_t size_out, + uint8_t type_out) +{ + fprintf(stderr, " prepare decimal_mult job of %ld bytes size\n", sizeof(*mjob)); + + assert(sizeof(*mjob) <= SNAP_JOBSIZE); + memset(mjob, 0, sizeof(*mjob)); + + snap_addr_set(&mjob->in, addr_in, size_in, type_in, + SNAP_ADDRFLAG_ADDR | SNAP_ADDRFLAG_SRC); + snap_addr_set(&mjob->out, addr_out, size_out, type_out, + SNAP_ADDRFLAG_ADDR | SNAP_ADDRFLAG_DST | + SNAP_ADDRFLAG_END); + + snap_job_set(cjob, mjob, sizeof(*mjob), NULL, 0); +} + +int main(int argc, char *argv[]) +{ + int ch, rc = 0; + int card_no = 0; + struct snap_card *card = NULL; + struct snap_action *action = NULL; + char device[128]; + struct snap_job cjob; + struct decimal_mult_job mjob; + unsigned long timeout = 600; + int write_results = 0; + struct timeval etime, stime; + ssize_t max_number_of_inputs = MAX_NB_OF_DECIMAL_READ; // Value defined in sync with the hardware + ssize_t inputs_to_process = 12; // Allow user to process only part of the inputs + uint8_t type_in = SNAP_ADDRTYPE_HOST_DRAM; + uint64_t addr_in = 0x0ull; + uint8_t type_out = SNAP_ADDRTYPE_HOST_DRAM; + uint64_t addr_out = 0x0ull; + int exit_code = EXIT_SUCCESS; + FILE *fp_ref, *fp_action; + + // default is completion of the action by IRQ + snap_action_flag_t action_irq = (SNAP_ACTION_DONE_IRQ | SNAP_ATTACH_IRQ); + + //mat_elmt_t is declared in common header file in include directory + // and can be a float or a double as user needs + mat_elmt_t ref_result[max_number_of_inputs/3]; + mat_elmt_t *data_in = NULL, *data_out = NULL; + + while (1) { + int option_index = 0; + static struct option long_options[] = { + { "card", required_argument, NULL, 'C' }, + { "number", required_argument, NULL, 'n' }, + { "timeout", required_argument, NULL, 't' }, + { "no-irq", no_argument, NULL, 'N' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + { "write-results", no_argument, NULL, 'w' }, + { "help", no_argument, NULL, 'h' }, + { 0, no_argument, NULL, 0 }, + }; + + ch = getopt_long(argc, argv, + "C:n:t:VNvwh", + long_options, &option_index); + if (ch == -1) + break; + + switch (ch) { + case 'C': + card_no = strtol(optarg, (char **)NULL, 0); + break; + case 'n': + inputs_to_process = strtol(optarg, (char **)NULL, 0); + // check max: bounded to MAX_NB_OF_DECIMAL_READ in this example + if (inputs_to_process > max_number_of_inputs) + inputs_to_process = max_number_of_inputs; + // check min: less than 3 entries cannot give a result + if (inputs_to_process < 3) + inputs_to_process = 3; + break; + case 't': + timeout = strtol(optarg, (char **)NULL, 0); + break; + case 'V': + printf("%s\n", version); + exit(EXIT_SUCCESS); + case 'v': + verbose_flag = 1; + break; + case 'h': + usage(argv[0]); + exit(EXIT_SUCCESS); + break; + case 'N': + action_irq = 0; + break; + case 'w': + write_results = 1; + break; + default: + usage(argv[0]); + exit(EXIT_FAILURE); + } + } + + if (optind != argc) { + usage(argv[0]); + exit(EXIT_FAILURE); + } + + //Prepare memory area which will contain the date to be processed by the action + // reserve a memory area for max_number_of_inputs doubles of 8 bytes OR floats of 4 bytes + data_in = snap_malloc(max_number_of_inputs * sizeof(mat_elmt_t)); + if (data_in == NULL) + goto out_error; + // write 0 into this buffer + memset(data_in, 0, max_number_of_inputs * sizeof(mat_elmt_t)); + + //Fill a table with only inputs_to_process values: 1.0, 1.5, 2.0, 2.5,... 8.5 + for(int i = 0; i < inputs_to_process ; i++){ + *(data_in+i) = 1 + 0.5*i; + } + + //specify where data are located => in Host DRAM at address addr_in + type_in = SNAP_ADDRTYPE_HOST_DRAM; + addr_in = (unsigned long)data_in; + + //Prepare memory area which will contain the results of the operation done by the action + // reserve a data_out with one third of the inputs of doubles of 8 bytes OR floats of 4 bytes + data_out = snap_malloc((inputs_to_process/3) * sizeof(mat_elmt_t)); + if (data_out == NULL) + goto out_error; + // write 0 into this buffer + memset(data_out, 0, (inputs_to_process/3) * sizeof(mat_elmt_t)); + + //specify where result will be located => in Host DRAM at address addr_out + type_out = SNAP_ADDRTYPE_HOST_DRAM; + addr_out = (unsigned long)data_out; + + + // Display the parameters that will be filled in the sructure exchanged with the action + printf("PARAMETERS:\n" + " input: %s\n" + " output: %s\n" + " type_in: %x %s\n" + " addr_in: %016llx\n" + " type_out: %x %s\n" + " addr_out: %016llx\n" + " size_in/out: %08lx\n", + "none", "none", + type_in, mem_tab[type_in], (long long)addr_in, + type_out, mem_tab[type_out], (long long)addr_out, + inputs_to_process); + + // Allocate the FPGA card that will be used for the processing + snprintf(device, sizeof(device)-1, "/dev/cxl/afu%d.0s", card_no); + card = snap_card_alloc_dev(device, SNAP_VENDOR_ID_IBM, + SNAP_DEVICE_ID_SNAP); + if (card == NULL) { + fprintf(stderr, "err: failed to open card %u: %s\n", + card_no, strerror(errno)); + fprintf(stderr, "Default mode is FPGA mode.\n"); + fprintf(stderr, "Did you want to run CPU mode ? => add SNAP_CONFIG=CPU before your command.\n"); + fprintf(stderr, "Otherwise make sure you ran snap_find_card and snap_maint for your selected card.\n"); + + goto out_error; + } + + // Allocate the action that will be used for the processing + action = snap_attach_action(card, DECIMALMULT_ACTION_TYPE, action_irq, 60); + if (action == NULL) { + fprintf(stderr, "err: failed to attach action %u: %s\n", + card_no, strerror(errno)); + goto out_error1; + } + + // Fil thes structure that will be exchnaged between this application and the action + snap_prepare_decimal_mult(&cjob, &mjob, + (void *)addr_in, inputs_to_process, type_in, + (void *)addr_out, inputs_to_process/3, type_out); + + //__hexdump(stderr, &mjob, sizeof(mjob)); + + gettimeofday(&stime, NULL); + // Send the structure to the action, start the action, wait for the completion + rc = snap_action_sync_execute_job(action, &cjob, timeout); + gettimeofday(&etime, NULL); + + fprintf(stdout, "Action processing decimal_mult took %lld usec\n", + (long long)timediff_usec(&etime, &stime)); + + // Test the return code of the action + if (rc != 0) { + fprintf(stderr, "err: job execution %d: %s!\n", rc, + strerror(errno)); + goto out_error2; + } + + (cjob.retc == SNAP_RETC_SUCCESS) ? fprintf(stdout, "SUCCESS\n") : fprintf(stdout, "FAILED\n"); + if (cjob.retc != SNAP_RETC_SUCCESS) { + fprintf(stderr, "err: Unexpected RETC=%x!\n", cjob.retc); + goto out_error2; + } + + // Process data multiplying doubles/floats 3 by 3 + for ( int i = 0; i < inputs_to_process/3; i++ ) { + ref_result[i] = data_in[3*i] * data_in[(3*i)+1] * data_in[(3*i)+2]; + } + + fprintf(stdout, "In this example %d decimal numbers (%d bytes large) are used as inputs " \ + "(float=4B - double=8B)\n", (int)inputs_to_process, (int)sizeof(mat_elmt_t)); + fprintf(stdout, "Max value of inputs is set as %d (set in header file of include directory)\n", + MAX_NB_OF_DECIMAL_READ); + fprintf(stdout, "Operation is the multiplication of 3 decimals \n"); + fprintf(stdout, "\n All products results processed by (software or hardware) action are below \n"); + for ( int i = 0; i < inputs_to_process/3; i++ ) + fprintf(stdout, "inputs: %lf * %lf * %lf =>\t expected: %lf \t action processed: %lf \n", + data_in[3*i], data_in[(3*i)+1], data_in[(3*i)+2], *(data_out + i), *(ref_result + i)); + + // This can help understanding how data are stored in host server + if (verbose_flag) { + fprintf(stdout, "DUMP of input data:\n"); + __hexdump(stderr, data_in, (max_number_of_inputs * sizeof(mat_elmt_t))); + fprintf(stdout, "DUMP of output data:\n"); + __hexdump(stderr, data_out, (max_number_of_inputs/3 * sizeof(mat_elmt_t))); + } + // if option has been selected write results to files for log and comparisons + if (write_results) { + fp_ref = fopen("dec_mult_ref.bin", "w"); + fp_action = fopen("dec_mult_action.bin", "w"); + for ( int i = 0; i < inputs_to_process/3; i++ ) { + fprintf(fp_ref, "%lf \n", *(ref_result + i)); + fprintf(fp_action, "%lf \n", *(data_out + i)); + } + fclose(fp_ref); + fclose(fp_action); + } + + snap_detach_action(action); + snap_card_free(card); + + __free(data_out); + __free(data_in); + exit(exit_code); + + out_error2: + snap_detach_action(action); + out_error1: + snap_card_free(card); + out_error: + __free(data_out); + __free(data_in); + exit(EXIT_FAILURE); +} diff --git a/actions/hls_decimal_mult/tests/test_0x1014100B.sh b/actions/hls_decimal_mult/tests/test_0x1014100B.sh new file mode 100755 index 00000000..db4c54c6 --- /dev/null +++ b/actions/hls_decimal_mult/tests/test_0x1014100B.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# +# Copyright 2017 International Business Machines +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +verbose=0 +snap_card=0 +duration="NORMAL" + +# Get path of this script +THIS_DIR=$(dirname $(readlink -f "$BASH_SOURCE")) +ACTION_ROOT=$(dirname ${THIS_DIR}) +SNAP_ROOT=$(dirname $(dirname ${ACTION_ROOT})) + +echo "Starting : $0" +echo "SNAP_ROOT : ${SNAP_ROOT}" +echo "ACTION_ROOT : ${ACTION_ROOT}" + +function usage() { + echo "Usage:" + echo " test_.sh" + echo " [-C ] card to be used for the test" + echo " [-t ]" + echo " [-duration SHORT/NORMAL/LONG] run tests" + echo +} + +while getopts ":C:t:d:h" opt; do + case $opt in + C) + snap_card=$OPTARG; + ;; + t) + export SNAP_TRACE=$OPTARG; + ;; + d) + duration=$OPTARG; + ;; + h) + usage; + exit 0; + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac +done + +export PATH=$PATH:${SNAP_ROOT}/software/tools:${ACTION_ROOT}/sw + +#### VERSION ########################################################## + +# [ -z "$STATE" ] && echo "Need to set STATE" && exit 1; + +if [ -z "$SNAP_CONFIG" ]; then + echo "Get CARD VERSION" + snap_maint -C ${snap_card} -v || exit 1; + snap_peek -C ${snap_card} 0x0 || exit 1; + snap_peek -C ${snap_card} 0x8 || exit 1; + echo +fi + +#### DECIMAL_MULT ######################################################## + +function test_decimal_mult { + local size=$1 + + echo -n "Doing snap_decimal_mult " + cmd="snap_decimal_mult -C${snap_card} -n 16 -w >> snap_decimal_mult.log 2>&1" + eval ${cmd} + if [ $? -ne 0 ]; then + cat snap_decimal_mult.log + echo "cmd: ${cmd}" + echo "failed" + exit 1 + fi + echo "ok" + + echo -n "Check results ... " + diff dec_mult_ref.bin dec_mult_action.bin 2>&1 > /dev/null + if [ $? -ne 0 ]; then + echo "failed" + echo " Out and expected files are different!" + exit 1 + fi + echo "ok" + +} + +rm -f snap_decimal_mult.log +touch snap_decimal_mult.log + +if [ "$duration" = "NORMAL" ]; then + test_decimal_mult + fi + +rm -f *.bin *.bin *.out +echo "Test OK" +exit 0 diff --git a/actions/scripts/snap_jenkins.sh b/actions/scripts/snap_jenkins.sh index 80828806..bc05758d 100755 --- a/actions/scripts/snap_jenkins.sh +++ b/actions/scripts/snap_jenkins.sh @@ -69,6 +69,9 @@ function test_all_actions() # $1 = card, $2 = accel *"10140001") # HDL NVMe example cmd="./actions/hdl_nvme_example/tests/test_0x10140001.sh" ;; + *"10140002") # HDL HelloWorld example + cmd="./actions/hdl_helloworld/tests/test_0x10140002.sh" + ;; *"10141000") # HLS Memcopy cmd="./actions/hls_memcopy/tests/test_0x10141000.sh" ;; @@ -96,6 +99,9 @@ function test_all_actions() # $1 = card, $2 = accel *"10141008") # HLS Hello World cmd="./actions/hls_helloworld/tests/test_0x10141008.sh" ;; + *"1014100B") # HLS Decimal multiplication + cmd="./actions/hls_decimal_mult/tests/test_0x1014100B.sh" + ;; *) echo "Error: Action: $action is not valid !" run_test=0 diff --git a/defconfig/AD8K5.hls_decimal_mult.defconfig b/defconfig/AD8K5.hls_decimal_mult.defconfig new file mode 100644 index 00000000..368f7983 --- /dev/null +++ b/defconfig/AD8K5.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +AD8K5=y +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="AD8K5" +FLASH_INTERFACE="BPIx16" +FLASH_SIZE="128" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x02000000" +# S121B is not set +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku115-flva1517-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/ADKU3.hls_decimal_mult.defconfig b/defconfig/ADKU3.hls_decimal_mult.defconfig new file mode 100644 index 00000000..c6a27920 --- /dev/null +++ b/defconfig/ADKU3.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +ADKU3=y +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="ADKU3" +FLASH_INTERFACE="BPIx16" +FLASH_SIZE="128" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x01000000" +# S121B is not set +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku060-ffva1156-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/FX609.hls_decimal_mult.defconfig b/defconfig/FX609.hls_decimal_mult.defconfig new file mode 100644 index 00000000..07c90cb1 --- /dev/null +++ b/defconfig/FX609.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +# S241 is not set +FX609=y +FPGACARD="FX609" +FLASH_INTERFACE="SPIx4" +FLASH_SIZE="128" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x04000000" +# S121B is not set +# CAPI10 is not set +CAPI20=y +FPGACHIP="xcvu9p-fsgd2104-2l-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/N250S.hls_decimal_mult.defconfig b/defconfig/N250S.hls_decimal_mult.defconfig new file mode 100644 index 00000000..eb80ba36 --- /dev/null +++ b/defconfig/N250S.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +N250S=y +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="N250S" +FLASH_INTERFACE="BPIx16" +FLASH_SIZE="64" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x01000000" +# S121B is not set +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku060-ffva1156-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/N250SP.hls_decimal_mult.defconfig b/defconfig/N250SP.hls_decimal_mult.defconfig new file mode 100644 index 00000000..dd93a19b --- /dev/null +++ b/defconfig/N250SP.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +N250SP=y +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="N250SP" +FLASH_INTERFACE="BPIx16" +FLASH_SIZE="128" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x02000000" +# S121B is not set +# CAPI10 is not set +CAPI20=y +FPGACHIP="xcku15p-ffva1156-2-i" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/RCXVUP.hls_decimal_mult.defconfig b/defconfig/RCXVUP.hls_decimal_mult.defconfig new file mode 100644 index 00000000..d8c35a26 --- /dev/null +++ b/defconfig/RCXVUP.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +RCXVUP=y +# S241 is not set +# FX609 is not set +FPGACARD="RCXVUP" +FLASH_INTERFACE="SPIx8" +FLASH_SIZE="256" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x08000000" +# S121B is not set +# CAPI10 is not set +CAPI20=y +FPGACHIP="xcvu9p-flgb2104-2l-e-es1" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/S121B.hls_decimal_mult.defconfig b/defconfig/S121B.hls_decimal_mult.defconfig new file mode 100644 index 00000000..c774257a --- /dev/null +++ b/defconfig/S121B.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +S121B_SPIx4=y +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="S121B" +FLASH_INTERFACE="SPIx4" +FLASH_SIZE="256" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x08000000" +S121B=y +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku115-flva1517-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/S121B_BPIx16.hls_decimal_mult.defconfig b/defconfig/S121B_BPIx16.hls_decimal_mult.defconfig new file mode 100644 index 00000000..c756df58 --- /dev/null +++ b/defconfig/S121B_BPIx16.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +S121B_BPIx16=y +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="S121B" +FLASH_INTERFACE="BPIx16" +FLASH_SIZE="128" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x02000000" +S121B=y +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku115-flva1517-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/S121B_SPIx4.hls_decimal_mult.defconfig b/defconfig/S121B_SPIx4.hls_decimal_mult.defconfig new file mode 100644 index 00000000..c774257a --- /dev/null +++ b/defconfig/S121B_SPIx4.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +S121B_SPIx4=y +# N250SP is not set +# RCXVUP is not set +# S241 is not set +# FX609 is not set +FPGACARD="S121B" +FLASH_INTERFACE="SPIx4" +FLASH_SIZE="256" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x08000000" +S121B=y +CAPI10=y +# CAPI20 is not set +FPGACHIP="xcku115-flva1517-2-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/defconfig/S241.hls_decimal_mult.defconfig b/defconfig/S241.hls_decimal_mult.defconfig new file mode 100644 index 00000000..ed0190a9 --- /dev/null +++ b/defconfig/S241.hls_decimal_mult.defconfig @@ -0,0 +1,70 @@ +# +# Automatically generated file; DO NOT EDIT. +# Kernel Configuration +# +# N250S is not set +# ADKU3 is not set +# AD8K5 is not set +# S121B_BPIx16 is not set +# S121B_SPIx4 is not set +# N250SP is not set +# RCXVUP is not set +S241=y +# FX609 is not set +FPGACARD="S241" +FLASH_INTERFACE="SPIx4" +FLASH_SIZE="256" +FLASH_FACTORYADDR="0x00000000" +FLASH_USERADDR="0x08000000" +# S121B is not set +# CAPI10 is not set +CAPI20=y +FPGACHIP="xcvu9p-flgb2104-2l-e" +NUM_OF_ACTIONS=1 +# HLS_ACTION is not set +# HDL_ACTION is not set +# HDL_EXAMPLE is not set +# HDL_NVME_EXAMPLE is not set +# HLS_MEMCOPY is not set +# HLS_SPONGE is not set +# HLS_HASHJOIN is not set +# HLS_SEARCH is not set +# HLS_BFS is not set +# HLS_INTERSECT is not set +# HLS_NVME_MEMCOPY is not set +# HLS_LATENCY_EVAL is not set +# HLS_MM_TEST is not set +# HLS_HELLOWORLD is not set +HLS_DECIMAL_MULT=y +ENABLE_HLS_SUPPORT=y +HLS_SUPPORT="TRUE" +DISABLE_SDRAM_AND_BRAM=y +# FORCE_SDRAM_OR_BRAM is not set +SDRAM_USED="FALSE" +BRAM_USED="FALSE" +DDR3_USED="FALSE" +DDR4_USED="FALSE" +DDRI_USED="FALSE" +DISABLE_NVME=y +# FORCE_NVME is not set +NVME_USED="FALSE" +SIM_XSIM=y +# SIM_IRUN is not set +# SIM_XCELIUM is not set +# SIM_MODELSIM is not set +# SIM_QUESTA is not set +# NO_SIM is not set +SIMULATOR="xsim" +DENALI_USED="FALSE" + +# +# ================= Advanced Options: ================= +# +# ENABLE_PRFLOW is not set +USE_PRFLOW="FALSE" +# ENABLE_ILA is not set +ILA_DEBUG="FALSE" +# ENABLE_FACTORY is not set +FACTORY_IMAGE="FALSE" +CLOUD_USER_FLOW="FALSE" +CLOUD_BUILD_BITFILE="FALSE" diff --git a/hardware/sim/testlist.sh b/hardware/sim/testlist.sh index e1371651..219b759a 100755 --- a/hardware/sim/testlist.sh +++ b/hardware/sim/testlist.sh @@ -108,6 +108,7 @@ step "snap_example_set -F -b0x0 -s0x100 -p0x5 -t150" fi;; "10140001") a0="hdl_nvme_example";; + "10140002") a0="hdl_helloworld";; "10141000") a0="hls_memcopy";; "10141001") a0="hls_sponge";; "10141002") a0="hls_hashjoin";; @@ -120,6 +121,7 @@ "10141008") a0="hls_helloworld";; "10141009") a0="hls_latency_eval";; "1014100a") a0="hls_mm_test";; + "1014100b") a0="hls_decimal_mult";; *) echo "unknown action0 type=$t0l, exiting";exit 1;; esac; echo "action0 type0s=$t0s type0l=$t0l $a0" t="snap_peek 0x180 "; r=$($t|grep ']'|awk '{print $2}');echo -e "$t result=$r # action0 counter reg" @@ -133,6 +135,7 @@ t1s=${r:7:1};t1l=${r:8:8}; case $t1l in "10140000") a1="hdl_example";; + "10140002") a1="hdl_helloworld";; "10141000") a1="hls_memcopy";; "10141001") a1="hls_sponge";; "10141002") a1="hls_hashjoin";; @@ -145,6 +148,7 @@ "10141008") a1="hls_helloworld";; "10141009") a1="hls_latency_eval";; "1014100a") a1="hls_mm_test";; + "1014100b") a1="hls_decimal_mult";; *) echo "unknown action1 type=$t1l, exiting";exit 1;; esac; echo "action0 type1s=$t1s type1l=$t1l $a1" t="snap_peek 0x188 "; r=$($t|grep ']'|awk '{print $2}');echo -e "$t result=$r # action1 counter reg" @@ -336,6 +340,11 @@ done fi # hdl_nvme_example # + if [[ "$t0l" == "10141001" || "${env_action}" == "hdl_helloworld"* ]];then echo -e "$del\ntesting snap_helloworld" + step "hdl_helloworld -h" + step "hdl_helloworld" + fi # hdl_helloworld +# if [[ "$t0l" == "10141000" || "${env_action}" == "hls_memcopy"* ]];then echo -e "$del\ntesting snap_memcopy" step "snap_memcopy -h" # for size in 1 64 80 85 128 240 $rnd1k $rnd1k4k;do to=$((size*50+10)) # 64B aligned 01/20/2017: error 128B issues 120, CR968181, wait for Vivado 2017.1 @@ -395,6 +404,7 @@ step "snap_hashjoin -Q$varq -t$to -vvv" done fi # hls_hashjoin + # if [[ "$t0l" == "10141003" || "${env_action}" == "hls_search"* ]];then echo -e "$del\ntesting snap_search" step "snap_search -h" @@ -514,6 +524,15 @@ step "snap_mm_test -J1 -L50" step "snap_mm_test -J1 -L100" fi # mm_test + # + if [[ "$t0l" == "1014100b" || "${env_action}" == "hls_decimal_mult" ]];then echo -e "$del\ntesting decimal_mult" + step "snap_decimal_mult -n 16 -w" + step "cat dec_mult_ref.bin" + step "cat dec_mult_action.bin" + if diff dec_mult_ref.bin dec_mult_action.bin>/dev/null;then echo -e "RC=$rc file_diff ok$del";else echo -e "$t RC=$rc file_diff is wrong$del";exit 1;fi + fi # decimal_mult_test + # ts2=$(date +%s); looptime=`expr $ts2 - $ts1`; echo "looptime=$looptime" # end of loop done; l=""; ts3=$(date +%s); totaltime=`expr $ts3 - $ts0`; echo "loops=$loops tests=$n total_time=$totaltime" # end of test + diff --git a/scripts/Kconfig b/scripts/Kconfig index 78c39092..3c9aad14 100644 --- a/scripts/Kconfig +++ b/scripts/Kconfig @@ -161,14 +161,6 @@ choice default HDL_EXAMPLE - config HLS_ACTION - bool "HLS Action - manually set ACTION_ROOT in snap_env.sh!" - select ENABLE_HLS_SUPPORT - help - This option is a placeholder for an action written by the user in HLS. - Please remember to set the environment variable "ACTION_ROOT" - in snap_env.sh to the directory of the action source code. - config HDL_ACTION bool "HDL Action - manually set ACTION_ROOT in snap_env.sh!" help @@ -189,6 +181,26 @@ choice select FORCE_SDRAM_OR_BRAM select FORCE_NVME + config HLS_ACTION + bool "HLS Action - manually set ACTION_ROOT in snap_env.sh!" + select ENABLE_HLS_SUPPORT + help + This option is a placeholder for an action written by the user in HLS. + Please remember to set the environment variable "ACTION_ROOT" + in snap_env.sh to the directory of the action source code. + + config HLS_HELLOWORLD + bool "HLS HelloWorld" + help + This is the simplest example to start with: + - Reading text from the server memory + - Processing changing case of the text + - Writing back the text to the server memory + This example is written in C and compiled with HLS + select ENABLE_HLS_SUPPORT + select DISABLE_SDRAM_AND_BRAM + select DISABLE_NVME + config HLS_MEMCOPY bool "HLS Memcopy" help @@ -202,6 +214,13 @@ choice select FORCE_SDRAM_OR_BRAM select DISABLE_NVME + config HLS_NVME_MEMCOPY + bool "HLS NVMe Memcopy" + depends on N250S + select ENABLE_HLS_SUPPORT + select FORCE_SDRAM_OR_BRAM + select FORCE_NVME + config HLS_SPONGE bool "HLS Sponge" help @@ -252,13 +271,6 @@ choice select FORCE_SDRAM_OR_BRAM select DISABLE_NVME - config HLS_NVME_MEMCOPY - bool "HLS NVMe Memcopy" - depends on N250S - select ENABLE_HLS_SUPPORT - select FORCE_SDRAM_OR_BRAM - select FORCE_NVME - config HLS_LATENCY_EVAL bool "HLS Latency Evaluation" help @@ -285,13 +297,15 @@ choice select DISABLE_SDRAM_AND_BRAM select DISABLE_NVME - config HLS_HELLOWORLD - bool "HLS HelloWorld" + config HLS_DECIMAL_MULT + bool "HLS Decimal Multiplication" help - This is the simplest example to start with: - - Reading text from the server memory - - Processing changing case of the text - - Writing back the text to the server memory + This example will help user understanding how to handle decimal numbers:: + - Read a value from the server memory + - Convert this value to a double or a float type + - Process an operation with decimal numbers such as a multiplication + - Convert the result back to the format expected by the server + - Write back the result to the server memory This example is written in C and compiled with HLS select ENABLE_HLS_SUPPORT select DISABLE_SDRAM_AND_BRAM diff --git a/snap_env b/snap_env index 0529d491..954f326f 100755 --- a/snap_env +++ b/snap_env @@ -190,6 +190,8 @@ while [ -z "$SETUP_DONE" ]; do AR='${SNAP_ROOT}/actions/hls_mm_test' elif [ -n "$HLS_HELLOWORLD" ]; then AR='${SNAP_ROOT}/actions/hls_helloworld' + elif [ -n "$HLS_DECIMAL_MULT" ]; then + AR='${SNAP_ROOT}/actions/hls_decimal_mult' fi if [ -z "$AR" ] && [ -n "$ACTION_ROOT" ]; then AR=$ACTION_ROOT