From 6eb098c0a511a408b50300748e348a6c1d479e02 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 14 Jun 2017 14:26:57 -0400 Subject: [PATCH] gostcoin algo added --- Makefile.am | 1 + algorithm.c | 25 ++++++++++++++++++++++++- algorithm.h | 3 ++- algorithm/gostcoin.c | 16 ++++++++++++++++ algorithm/gostcoin.h | 10 ++++++++++ 5 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 algorithm/gostcoin.c create mode 100644 algorithm/gostcoin.h diff --git a/Makefile.am b/Makefile.am index 3069bbe6..31e09b25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -84,6 +84,7 @@ sgminer_SOURCES += algorithm/blakecoin.c algorithm/blakecoin.h sgminer_SOURCES += algorithm/decred.c algorithm/decred.h sgminer_SOURCES += algorithm/pascal.c algorithm/pascal.h sgminer_SOURCES += algorithm/lbry.c algorithm/lbry.h +sgminer_SOURCES += algorithm/gostcoin.c algorithm/gostcoin.h bin_SCRIPTS = $(top_srcdir)/kernel/*.cl diff --git a/algorithm.c b/algorithm.c index 9d2f458e..f15d8622 100644 --- a/algorithm.c +++ b/algorithm.c @@ -44,6 +44,7 @@ #include "algorithm/pascal.h" #include "algorithm/lbry.h" #include "algorithm/sibcoin.h" +#include "algorithm/gostcoin.h" #include "compat.h" @@ -80,7 +81,8 @@ const char *algorithm_type_str[] = { "Decred", "Vanilla", "Lbry", - "Sibcoin" + "Sibcoin", + "Gostcoin" }; void sha256(const unsigned char *message, unsigned int len, unsigned char *digest) @@ -492,6 +494,25 @@ static cl_int queue_sibcoin_mod_kernel(struct __clState *clState, struct _dev_bl return status; } +static cl_int queue_gostcoin_mod_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads) +{ + cl_kernel *kernel; + unsigned int num; + cl_ulong le_target; + cl_int status = 0; + + le_target = *(cl_ulong *)(blk->work->device_target + 24); + flip80(clState->cldata, blk->work->data); + status = clEnqueueWriteBuffer(clState->commandQueue, clState->CLbuffer0, true, 0, 80, clState->cldata, 0, NULL, NULL); + + // TODO: + num = 0; + CL_NEXTKERNEL_SET_ARG(clState->padbuffer8); + CL_SET_ARG(clState->outputBuffer); + CL_SET_ARG(le_target); + + return status; +} static cl_int queue_bitblock_kernel(struct __clState *clState, struct _dev_blk_ctx *blk, __maybe_unused cl_uint threads) { @@ -1230,6 +1251,8 @@ static algorithm_settings_t algos[] = { { "pascal", ALGO_PASCAL, "", 1, 1, 1, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 0, 0, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, pascal_regenhash, pascal_midstate, NULL, queue_pascal_kernel, NULL, NULL }, + { "gostcoin-mod", ALGO_GOSTCOIN, "", 1, 256, 256, 0, 0, 0xFF, 0xFFFFULL, 0x0000ffffUL, 2, 4 * 8 * 4194304, 0, gostcoin_regenhash, NULL, NULL, queue_gostcoin_mod_kernel, NULL, NULL }, + // Terminator (do not remove) { NULL, ALGO_UNK, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL } }; diff --git a/algorithm.h b/algorithm.h index d3238a13..092fe360 100644 --- a/algorithm.h +++ b/algorithm.h @@ -41,7 +41,8 @@ typedef enum { ALGO_DECRED, ALGO_VANILLA, ALGO_LBRY, - ALGO_SIBCOIN + ALGO_SIBCOIN, + ALGO_GOSTCOIN } algorithm_type_t; extern const char *algorithm_type_str[]; diff --git a/algorithm/gostcoin.c b/algorithm/gostcoin.c new file mode 100644 index 00000000..b58129cd --- /dev/null +++ b/algorithm/gostcoin.c @@ -0,0 +1,16 @@ +#include "config.h" +#include "miner.h" + +#include +#include +#include + +int gostcoin_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t nonce) +{ + return 0; // TODO +} + +void gostcoin_regenhash(struct work *work) +{ + // TODO: +} diff --git a/algorithm/gostcoin.h b/algorithm/gostcoin.h new file mode 100644 index 00000000..9bc69929 --- /dev/null +++ b/algorithm/gostcoin.h @@ -0,0 +1,10 @@ +#ifndef GOSTCOIN_H +#define GOSTCOIN_H + +#include "miner.h" + +extern int gostcoin_test(unsigned char *pdata, const unsigned char *ptarget, + uint32_t nonce); +extern void gostcoin_regenhash(struct work *work); + +#endif /* SIBCOIN_H */