text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int maxn = (int)1e5 + 1, maxs = 21; int n, m, q, stot, etot, que[maxn], rnk[maxn]; long long bit[maxn], ans[maxn]; struct Point { int x, y; void read() { scanf( %d%d , &x, &y); } bool operator<(Point const &t) const { return x < t.x || (x =...
//***************************************************************************** // (c) Copyright 2008 - 2013 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property /...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: stratix_pmem.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===========================...
#include <bits/stdc++.h> using namespace std; long long n, l, k, ultim; map<int, int> cnt; int main() { cin >> n >> k; for (int i = 0; i <= 63; i++) if ((n >> i) & 1) cnt[i]++, l++; if (l > k) { cout << No ; return 0; } for (int i = 63; i >= -63; i--) { if (l + cnt[i...
#include <bits/stdc++.h> using namespace std; int main() { int x, i; int a[100]; while (cin >> x && x) { if (x == 1) { cout << x << endl; } else { cout << x << ; for (i = 1; i < x; i++) cout << i << ; cout << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; long long power(long long base, long long e) { long long answer = 1; while (e) { if (e % 2 == 1) { answer *= base; } base *= base; e /= 2; } return answer; } int main() { long long i, n, m, k, j; cin >> n >> m;...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 1e3 + 10; long long dis[N][N][4]; int dx[] = {0, 0, -1, 1}; int dy[] = {1, -1, 0, 0}; char c[N][N]; queue<pair<int, int>> q[4]; int n, m; long long check(int o) { long long d[4] = {0, INF * INF, INF * INF,...
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, ans = 1e9 + 1; string s; cin >> n >> s; vector<double> x(n); for (int i = 0; i < n; i++) { cin >> x[i]; } for (int i = 0; i < n; i++) { if (i < n + 1 && s[i] == R && s[i + 1] == L && (x[i + 1]...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long int test = 1; for (int loop = 0; loop < test; loop++) { long long int num, val; cin >> num >> val; vector<long long int> arr; long ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, m, n, k, a[1100], b[1100][10], count = 0; cin >> n >> m >> k; for (i = 0; i <= m; i++) a[i] = 10000000; for (i = 1; i <= n; i++) { for (j = 0; j < 2; j++) cin >> b[i][j]; if (a[b[i][0]] > b[i][1]) a[b[i][0]] = b[i][1]; ...
module decode(inst, opndC, opndA, opndB, arithmetic, slowArithmetic, logic, memory, reg_bank_control, control, arith_cntl, control_mask ); // The instruction to be decoded input [15:0] inst; // The respective operands output [3:0] opndC, opndA, opndB; output [4:0] reg_bank_control;// Control signal...
module ControlUnit (output reg IR_CU, RFLOAD, PCLOAD, SRLOAD, SRENABLED, ALUSTORE, MFA, WORD_BYTE,READ_WRITE,IRLOAD,MBRLOAD,MBRSTORE,MARLOAD,output reg[4:0] opcode, output reg[3:0] CU, input MFC, Reset,Clk, input [31:0] IR,input [3:0] SR); reg [4:0] State, NextState; task registerTask; input [17:0] signals; //6 7 8 ...
#include <bits/stdc++.h> int main() { int i, j, l = 0, a, A[6], n[6], m = 0; for (i = 0; i < 6; i++) { scanf( %d , &a); for (j = 0; j < l; j++) { if (A[j] == a) break; } if (j == l) { n[l] = 1; A[l++] = a; } else n[j]++; } for (i = 0; i < l...
#include <bits/stdc++.h> using namespace std; int main() { long long x, y; cin >> x >> y; cout << (x + x % 2) * (y + y % 2) * (x / 2) / 2 * (y / 2) / 2; }
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// -------------------------------------------------------------------- // ng_SEQ.v - Sequence generator module // // Sequence generator module contains the stage registers and branch // registers that (along with the time pulse generator) control // execution of the microinstruction sequence. // ------------------...
/* * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int N = 100100; inline long long int gcd(long long int ga, long long int gb) { if (!gb) return ga; return gcd(gb, ga % gb); } inline long long int lcm(long long int a, long long int b, long long int c) { long long int ans = a * b / gcd(a, b); ...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
module ddr3_init_sm (rst, clk, init_done, init_start); input wire rst; input wire clk; input wire init_done; output reg init_start; reg [7:0] init_dly_cnt; parameter IDLE = 3'b000, START_CNT = 3'b001, WAITFOR_CNT = 3'b010, INIT_DDR = 3'b011, INIT_DONE = 3'b100; reg [2:0] state, next; ...
#include <bits/stdc++.h> using namespace std; double dist(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } int main() { double r, x1, y1, x2, y2; cin >> r >> x1 >> y1 >> x2 >> y2; if (dist(x1, y1, x2, y2) >= r) { printf( %.12f %.12...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2017 Xilinx, Inc. // // 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 // /...
#include <bits/stdc++.h> using namespace std; const int maxt = 1000000, maxn = maxt + 7; int h[7][7]; char s[5][maxn]; void output(int n) { for (int i = 1; i <= 4; i++) { for (int j = 1; j <= n; j++) printf( %c , s[i][j]); puts( ); } } bool DoIt_2(int I, int n, int tot) { for (int...
#include <bits/stdc++.h> const double eps = (1e-9); using namespace std; int dcmp(long double a, long double b) { return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1; } int getBit(int num, int idx) { return ((num >> idx) & 1) == 1; } int setBit1(int num, int idx) { return num | (1 << idx); } long long s...
#include <bits/stdc++.h> using namespace std; string s, t, x; vector<int> lcp; vector<bool> match; constexpr int mxn = int(2e5) + 10; int dp[mxn][3]; int pref[mxn]; const int mod = 1e9 + 7; int ans(int start) { if (dp[start][2] != -1) return dp[start][2]; if (start >= x.size()) return dp[start...
/* * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; int n, m, mid, rt, res, a[200010], f[200010], sz[200010]; vector<int> e[200010]; void dfs(int u, int fa) { f[u] = sz[u] = 1; int m1 = 0, m2 = 0; for (auto v : e[u]) { if (v == fa) continue; dfs(v, u); sz[u] += sz[v]; if (f[v] == s...
#include <bits/stdc++.h> using namespace std; int tc = 0; long long a, b, c, d; inline long long sum(long long i) { return -a * i + b * (d - 1) * i + i * (i - 1) / 2 * b * d; } inline long long calc(long long i) { if (i < 0) return 0; long long ans = 0; if (i < (c + 1) / d) { ans = min...
#include <bits/stdc++.h> using namespace std; int main() { unsigned int n, m, l; cin >> n >> m >> l; int s = 0; while (l--) { s += 2 * (n + m - 2); n -= 4; m -= 4; } cout << s; }
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; int main() { int k, rt, i, j; char a[] = { a , e , i , o , u }; cin >> k; rt = (int)sqrt(k); for (; k % rt != 0; rt--) ; if (rt > 4) { for (i = 0; i != k / rt; i++) { for (j = 0; j != rt; j++) { cout << a[(i + j)...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:52:19 03/03/2014 // Design Name: // Module Name: flash_spi // Project Name: // Target Devices: // Tool versions: // Description: /...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; int main() { int h1, t1, h2, t2, ansh, anst; scanf( %2d:%2d , &h1, &t1); scanf( %2d:%2d , &h2, &t2); if (t1 < t2) { h1--, t1 += 60; } anst = t1 - t2; ansh = h1 - h2; if (ansh < 0) ansh += 24; printf( %02d:%02d n , ansh, anst); ...
// // Copyright 2014-2015 Ettus Research LLC // module noc_block_synthese #( parameter NOC_ID = 64'h11F5_0000_0000_0000, parameter STR_SINK_FIFOSIZE = 11) ( input bus_clk, input bus_rst, input ce_clk, input ce_rst, input [63:0] i_tdata, input i_tlast, input i_tvalid, output i_tready, output [63:0] o_tda...
#include <bits/stdc++.h> using namespace std; const int N = 500010; struct E { int u, v, w, I; } e[N]; int n, m, F[N], T[N], q, k, a[N], A[N], V, d, L[N], C[N]; vector<int> G[N]; bool M(E a, E b) { return a.w < b.w; } int P(int x) { return x == A[x] ? x : A[x] = P(A[x]); } void D(int b, int x) { ...
#include <bits/stdc++.h> int Pos(int a) { if (a < 0) { return 0; } return a; } int main() { int n = 0, p1 = 0, t1 = 0, p2 = 0, t2 = 0, p3 = 0; int energy = 0; std::vector<int> timeDatal; std::vector<int> timeDatar; std::cin >> n >> p1 >> p2 >> p3 >> t1 >> t2; for (int i =...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10, OO = 0x3f3f3f3f; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; int tc, n, m; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> tc; while (tc--) { cin >> n >> m; ...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e6 + 3; const int INFI = 1e9 * 2; const long long LINFI = 1e17; const double pi = acos(-1.0); const int N = 111; const int M = 11; const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1}; double mabs(double x) { retur...
#include <bits/stdc++.h> using namespace std; template <class t> t mag(t a) { return a > 0 ? a : -a; } template <class T, class U> T cdiv(T num, U den) { return (num / den) + ((num % den) > 0); } std::ifstream term( /dev/tty ); std::string tempstring; using ll = int_fast64_t; using ii = pa...
#include <bits/stdc++.h> const int maxN = 1000005, p = 998244353; int n, ans, fac[maxN], inv[maxN]; inline int power(int x, long long y) { int res = 1; for (; y; y >>= 1, x = (long long)x * x % p) { if (y & 1) { res = (long long)res * x % p; } } return res; } inline int bin...
#include <bits/stdc++.h> using namespace std; int main() { int a; string b; cin >> a >> b; while (a++) { int i = a; string comp = ; while (i > 0) { int c = i % 10; if (c == 4 || c == 7) { comp = to_string(c) + comp; } i /= 10; } ...
#include <bits/stdc++.h> int main() { using namespace std; int c, m, i; cin >> c >> m; int a = 0; for (i = 1; i <= 9; i++) { if (i * c % 10 == 0) { cout << i; break; } if (c == m) { cout << i; break; } if (i * c % 10 == m) { cou...
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int N = 300001; int dp[82][82][82][82], n, k, m, u, v, c; vector<pair<int, int> > g[83]; int calc(int idx, int l, int r, int rem) { if (rem == 0) return 0; if (l > r) return 1e9; int &ret = dp[idx][l][r][rem]; if (r...
`timescale 1ns / 1ps //************************************************************************* // > ÎļþÃû: data_mem.v // > ÃèÊö £ºÒì²½Êý¾Ý´æ´¢Æ÷Ä£¿é£¬²ÉÓüĴæÆ÷´î½¨¶ø³É£¬ÀàËÆ¼Ä´æÆ÷¶Ñ // > ͬ²½Ð´£¬Òì²½¶Á // > ×÷Õß : LOONGSON // > ÈÕÆÚ : 2016-04-14 //***********************************************...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Single channel counter of 8254 timer simplified for Zet SoC * Copyright (c) 2010 YS <> * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public Lice...
#include <bits/stdc++.h> using namespace std; long long n, k, a, b; vector<long long> v; long long rec(long long l, long long r) { long long i = lower_bound(v.begin(), v.end(), l) - v.begin(); long long j = upper_bound(v.begin(), v.end(), r) - v.begin(); j--; long long na = j - i + 1; long l...
#include <bits/stdc++.h> using namespace std; const int maxsize = 100005; const int inf = 1061109567; vector<int> edge[maxsize]; vector<pair<int, int> > base[maxsize]; int nnext[maxsize]; int n; int deepth[maxsize]; int siz[maxsize]; int last = 0; int ans[10 * maxsize]; int cnt = 0; void dfs1(...
#include <bits/stdc++.h> using namespace std; int l, n, a[55], b[55], c[55], d[55]; int main() { cin >> n >> l; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 1; i < n; i++) c[i] = a[i] - a[i - 1]; c[0] = a[0] + l - a[n - 1]; for (int i = 1; ...
#include <bits/stdc++.h> const int Mod = 1001943197; const int Base = 34300; const int MN = 100005, MQ = 100005, S = 500, MS = S + 5; char s[MN], t[MN]; int N, lt, Lim, per[MN]; int pBase[MN]; int Hs[MN], Ht[MN]; inline int Hmerge(int h1, int h2, int l2) { return (int)(((long long)h1 * pBase[l2] + h...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/13/2016 05:51:29 PM // Design Name: // Module Name: Testbench_Barrel_Shifter // Project Name: // Target Devices: // Tool Versions: // Description: // // Depende...
#include <bits/stdc++.h> using namespace std; const int maxn = 105; const long long INF = (long long)0x7fffffffffff; long long dp[maxn][maxn][maxn], wi[maxn], c[maxn]; long long min(long long a, long long b) { return a > b ? b : a; } int main() { int n, m, k, temp, flag = 1, ans1 = 0; cin >> n >> m ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; const int M = 1000000000; const int INF = 1e18; int a[N], b[N], s1[N], s2[N]; int n, m, k, d, top1, top2, ansr, ansl, sum[N], pos[N], t[N], mn[N]; map<int, int> mp; void reset(int x) { mn[x] = INF; for (int i = (x - 1) * m + 1...
#include <bits/stdc++.h> using namespace std; const int N = 2005; char mp[N][N]; int deg[N][N]; int cnt[2], n, m; int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0}; string str = ><v^ , tmp = <>^v ; bool check(int x, int y) { return x >= 1 && x <= n && y >= 1 && y <= m; } int main() { ios ::sync_wit...
//This module maps physical 512KB blocks of every memory chip to different memory ranges in Amiga module minimig_bankmapper ( input chip0, // chip ram select: 1st 512 KB block input chip1, // chip ram select: 2nd 512 KB block input chip2, // chip ram select: 3rd 512 KB block input chip3, // chip ram s...
////////////////////////////////////////////////////////////////////////////// // // Filename: wbpriarbiter.v // // Project: Zip CPU -- a small, lightweight, RISC CPU soft core // // Purpose: This is a priority bus arbiter. It allows two separate wishbone // masters to connect to the same bus, while also guaranteein...
#include <bits/stdc++.h> using namespace std; struct segment_tree { long long a[1 << 20][5]; int sz[1 << 20]; int N; void initi(int x) { N = 1; while (N < x) N <<= 1; } void pushup(int x) { int pos = x + N - 1; while (x > 0) { x = (x - 1) >> 1; sz[x] =...
`timescale 1 ps / 1 ps (* CORE_GENERATION_INFO = "zynq_1,IP_Integrator,{x_ipVendor=xilinx.com,x_ipLanguage=VERILOG,numBlks=2,numReposBlks=2,numNonXlnxBlks=0,numHierBlks=0,maxHierDepth=0,da_axi4_cnt=1}" *) module zynq_1 (DDR_addr, DDR_ba, DDR_cas_n, DDR_ck_n, DDR_ck_p, DDR_cke, DDR_cs_n, ...
// Test implicit casts during procedural continuous (reg) assignments. module implicit_cast(); real src_r; bit unsigned [7:0] src_u2; bit signed [7:0] src_s2; logic unsigned [7:0] src_u4; logic signed [7:0] src_s4; logic unsigned [7:0] src_ux; logic signed [7:0] src_sx; real ...
#include <bits/stdc++.h> const int N = 1e5 + 10, M = 26; template <typename T = int> inline T read() { T x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f |= ch == - , ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return f ? -x : x; } char s[N]; int ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const int INF = 1e6; namespace IO { const int MAXSIZE = 1 << 20; char buf[MAXSIZE], *p1, *p2; inline int gc() { return (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2) ...
#include <bits/stdc++.h> using namespace std; int main() { long long int l, r, k; cin >> l >> r >> k; if (k == 1 || l == r || (r - l == 1 && l % 2 && (l ^ r) >= l)) { cout << l << n1 n << l << endl; return 0; } long long int num = 1, ind; for (int i = 0;; i++) { if (num ...
#include <bits/stdc++.h> using namespace std; struct node { struct node* left; struct node* right; int vl; node() { vl = 0; left = NULL; right = NULL; } }; int a[300005]; int ans = 0; void query(node* n, int v, int i, int j) { if (n == NULL || j == 0) return; in...
/* * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Thu May 25 15:28:56 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; double power(float x, int y) { float temp; if (y == 0) return 1; temp = power(x, y / 2); if (y % 2 == 0) return temp * temp; else { if (y > 0) return x * temp * temp; else return (temp * temp) / x; } } bool i...
//-------------------------------------------------------------------------------- // // sram_interface.v // Copyright (C) 2011 Ian Davis // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Founda...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const long double PI = 3.141592653589793238462643383279502884197; long long fac[1] = {1}, inv[1] = {1}; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long mp(long long a, long long b) { ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: California State University San Bernardino // Engineer: Bogdan Kravtsov // Tyler Clayton // // Create Date: 15:58:00 10/31/2016 // Module Name: I_EXECUTE_tb // Project Name: M...
//deps: core.v, sdram_controller3.v, IS42S16160.v `timescale 1ns/1ps module top_tb; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire [12:0] DRAM_ADDR; // From controller of sdram_controller3.v wire [1:0] DRAM_BA; //...
#include <bits/stdc++.h> using namespace std; vector<int> v[20001]; struct triplet { int x, y, z, sum; }; int a, b, c; void init() { for (int i = 1; i <= 20000; ++i) { for (int j = i; j <= 20000; j += i) v[j].push_back(i); } } triplet calc(int n) { triplet res; int ans = 100000...
#include <bits/stdc++.h> int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, -1, 0, 1}; int n; int map[2010][2010]; int vis[2010][2010]; int as, ac; int go(int x, int y) { vis[y][x] = 1; int r = 1; for (int i = 0; i < 4; ++i) { int nx = x + dx[i], ny = y + dy[i]; if (map[ny][nx] == 0 || vis...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2015 by Iztok Jeras. `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0...
#include <bits/stdc++.h> using namespace std; const long double pi = 3.14159265358979323846; const long long mod = 1e9 + 7; const long long N = 5e5; const long long INF = 1e9 + 1; long long n, m, ans; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); ci...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//========================================================== // Copyright (c) 2014 by Cuong-TV //========================================================== // Project : Video and Image Processing Design Using FPGAs // File name: CCD_Capture.v // Author : Cuong-TV // Email : - //===================================...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale ...
#include <bits/stdc++.h> using namespace std; long long a, b, n, k, h; int main() { int arr[3]; cin >> arr[0] >> arr[1] >> arr[2]; int y = 1, b = 2, r = 3; while (y < arr[0] && b < arr[1] && r < arr[2]) { y++; r++; b++; } cout << y + b + r; }
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, flag = 1; char ch = getchar(); for (; ch > 9 || ch < 0 ; ch = getchar()) if (ch == - ) flag = -1; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = (x << 3) + (x << 1) + ch - 0 ; return x * flag; } ...
module Memory_TestBench; reg clk, cs, we; reg [31:0] addr, data_i; integer i; parameter mem_size = 5; DRAM #(.mem_size(mem_size), .delay(0)) mem_dut ( .clk (clk), .addr_i (addr), .cs (cs), .we (we), .data_i (data_i), .data_o (), .ack () ); // The clock pulse. initial begin...
`include "senior_defines.vh" module operand_select #(parameter nat_w=`SENIOR_NATIVE_WIDTH, parameter ctrl_w=`OPSEL_CTRL_WIDTH) ( input wire [nat_w-1:0] imm_val_i, input wire [nat_w-1:0] rf_a_i, input wire [nat_w-1:0] rf_b_i, input wire [ctrl_w-1:0] ctrl_i, output reg [nat_w-1:0] op_a...
`define bsg_dff_en_macro(bits,womp) \ if (harden_p && width_p==bits && (strength_p==womp)) \ begin: macro \ bsg_rp_tsmc_250_EDFFX``womp``_b``bits dff(.i0(data_i) \ ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:30:50 05/08/2015 // Design Name: // Module Name: hazard // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
/** * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* * Copyright 2020 The SkyWater PDK Authors * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; template <typename... T> void read(T &...args) { ((cin >> args), ...); } template <typename... T> void write(T... args) { ((cout << args << ), ...); cout << n ; } long long gcd(long long a, long long b) { if (b > a) { return gcd(b,...
#include <bits/stdc++.h> int main() { long int a, i, s; scanf( %ld , &a); s = a; if (a != 1) { for (i = 2;; i++) { s = s + 1 + i * (a - i); if ((a - i) == 0) { break; } } printf( %ld , s); } else { printf( 1 ); } }
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Sun Apr 09 09:37:58 2017 // Host : GILAMONSTER running 64-bit major release (...