text
stringlengths
59
71.4k
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // Use this file as a template for submitting bugs, etc. // This module takes a single clock input, and should either // $write("*-* All Finished *-*\n"); // $finish; // on success, or $stop. // // The code as shown applies a random vector to the Test // modul...
#include <bits/stdc++.h> using namespace std; int x; char s[100005]; bool flag[500]; int cnt[500]; vector<char> f; int main() { scanf( %d , &x); scanf( %s , s); int len = strlen(s); for (int i = 0; i < len; i++) cnt[s[i]]++; for (int i = a ; i <= z ; i++) { if (cnt[i] == 0) con...
#include <bits/stdc++.h> using namespace std; int main() { int a1, a2, a3, a4; cin >> a1 >> a2 >> a3 >> a4; int a[4]; a[0] = a1; a[1] = a2; a[2] = a3; a[3] = a4; sort(a, a + 4); if (a[0] + a[1] + a[2] == a[3]) { cout << YES ; } else if (a[0] + a[3] == a[1] + a[2]) { ...
#include <bits/stdc++.h> using namespace std; void mex(string &s) { s.back()++; for(int i=s.length()-1;i>=1;i--) { if(s[i]> z ) { s[i]= a ; s[i-1]++; } } if(s[0]> z ) { s.push_back( a ); ...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_always_on_edge (clock, reset, enable, sampling_event, test_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter edge_type = `OVL...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE revB.2 compliant I2C Master controller Top-level //// //// //// //// ...
////////////////////////////////////////////////////////////////////////////// // // Xilinx, Inc. 2009 www.xilinx.com // // XAPP xyz // ////////////////////////////////////////////////////////////////////////////// // // File name : dvi_encoder.v // // Description : dvi_encoder // // Dat...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE DMA WISHBONE Master Interface //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); struct Comp { double re, im; Comp(double x = 0.0, double y = 0.0) : re(x), im(y) {} Comp operator+(const Comp& rhs) const { return Comp(re + rhs.re, im + rhs.im); } Comp operator-(const Comp& rhs) const { ret...
module DramReader( input fclk, input rst_n, //AXI port output M2S_AXI_ACLK, // output reg M2S_AXI_ARVALID, input M2S_AXI_ARREADY, output reg [31:0] M2S_AXI_ARADDR, output [1:0] M2S_AXI_ARBURST, output [3:0] M2S_AXI_ARLEN, output [1:0] M2S_AXI_ARSIZE, // inpu...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 2; bool vis[N]; int trie[N * 20][2], sz; void inser(int n) { int curr = 0; for (int i = 19; i >= 0; i--) { int dir = (n >> i) & 1; if (trie[curr][dir] == -1) trie[curr][dir] = ++sz; curr = trie[curr][dir]; } } ...
#include <bits/stdc++.h> using namespace std; vector<int> edge[200002], col; int vis[200002]; queue<int> q; void bfs(int s) { vis[s] = 1; q.push(s); while (!q.empty()) { int x = q.front(); q.pop(); set<int> st; for (auto y : edge[x]) { if (vis[y]) { st.ins...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; inline int read() { int x = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) ch = getchar(); while (ch <= 9 && ch >= 0 ) x = x * 10 + ch - 0 , ch = getchar(); return x; } int A[maxn], B[maxn], N, MOD, fir, d, l...
#include <bits/stdc++.h> using namespace std; struct Point { double x, y; Point() {} Point(double _x, double _y) { x = _x; y = _y; } Point operator-(const Point &b) const { return Point(x - b.x, y - b.y); } double operator^(const Point &b) const { return x * b.y - y * b.x; } ...
/* * 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 MAXN = 200005; const int inf = 1000000007; int main() { int a, b, c; int x, y, z; cin >> a >> b >> c; cin >> x >> y >> z; int da = a - x; int db = b - y; int dc = c - z; int can = max(0, da / 2) + max(0, db / 2) + max(0, dc ...
//---------------------------------------------------------------------// // Name: am_put_fpga.v // Author: Chris Wynnyk // Date: 2/3/2008 // Purpose: Top-level file for implementing the American Put in an FPGA. //---------------------------------------------------------------------// module amer_put( clk_f...
`timescale 1 ns / 1 ps module averager_counter_tb(); parameter FAST_COUNT_WIDTH = 5; parameter SLOW_COUNT_WIDTH = 10; reg restart; reg clken; reg [FAST_COUNT_WIDTH-1:0] count_max; reg clk; reg avg_on...
module ps2 ( input Rx, input CLKOUT, output reg Rx_error, output [7:0] DATA, output reg DONE ); reg [8:0] regis; reg [7:0] regis0; reg [3:0] i; reg [3:0] j; reg [1:0] k; reg init; reg DoIt; //reg NoDoIt; //reg MakeIt=(DoIt && ~NoDoIt); initial begin i=0; j=0; init=0; regis=0; reg...
module shiftRegister(clk, peripheralClkEdge, parallelLoad, parallelDataIn, serialDataIn, parallelDataOut, serialDataOut,peripheralClk8Edge); parameter width = 8; input clk; input peripheralClkEdge; input peripheralClk8Edge; input parallelLoad; output[width-1:0] ...
/* * 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...
`define WIDTH_P 2 /**************************** TEST RATIONALE ******************************* 1. STATE SPACE An internal counter keeps track of the count which is compared with the output of the DUT. This test continues for 2**WIDTH_P cycles and hence tests the DUT exhaustively. 2. PARAMETERIZATION A min...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } long long lcm(long long a, long long b) { return (a * (b / gcd(a, b))); } long long bigmod(long long b, long long p, long long m) { if (p == 0) return 1; if (p % 2 == 0) { ...
#include <bits/stdc++.h> using namespace std; int d, m, n, x[25], a[30005]; vector<long long> ok; long long L, R; map<long long, vector<long long> > ans; map<long long, vector<long long> > zip; vector<long long> calc(long long lim) { if (zip.find(lim) != zip.end()) return zip[lim]; vector<long lon...
module ula( opcode, // codigo da instrucao data1, // operando 1 data2, // operando 2 out, // saida de dados rflags // saida - registrador de flags do processador ); // faz o include dos parameters das instrucoes `include "params_proc.v" // entr...
#include <bits/stdc++.h> using namespace std; int x1, x2, x3; int Y1, y2, y3; int main() { cin >> x1 >> Y1 >> x2 >> y2; x3 = (x1 <= x2 ? x2 + 1 : x2 - 1); y3 = (Y1 <= y2 ? y2 + 1 : y2 - 1); int r = 0; if (x1 == x2 || Y1 == y2) r = 2; cout << r + 2 * abs(x1 - x3) + 2 * abs(Y1 - y3); r...
#include <bits/stdc++.h> using namespace std; unordered_map<int, int> mp; bool f(int mid) { if (mp.size() < mid) return false; int a = 0, b = 0; bool fl = 0; for (auto it = mp.begin(); it != mp.end(); it++) { if (it->second > mid) { a = mid; if (fl == 0) { b++; ...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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 Foundation, version 3 of the License. * * This program is distributed ...
/** * 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; using li = long long; int get_num(string s) { istringstream is(s); int x; if ((is >> x) && to_string(x) == s) return x; return -1; } void solve(bool read) { int n; cin >> n; vector<pair<string, int>> s(n); int n_e = 0; for (int ...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; signed main() { cin.tie(0); std::ios_base::sync_with_stdio(0); long long n; cin >> n; long long cnt = 10; vector<long long> ans; ans.push_back(10); if (n < 2) { cout << 10; return 0; } ...
#include <bits/stdc++.h> using namespace std; int cho[30]; char str[1005]; int main() { int a, b, ans = 0; cin >> a >> b; for (int i = 0; i < a; i++) { cin >> str[i]; cho[str[i] - 96]++; } int tot = b; for (int i = 1; i <= 26; i++) { if (tot == 0) { break; ...
#include <bits/stdc++.h> using namespace std; int n, a[300005], pre[300005], L[300005], R[300005]; int st[300005][19], f[300005], ans; int Max(int l, int r) { int s = f[r - l]; return a[st[l][s]] > a[st[r - (1 << s)][s]] ? st[l][s] : st[r - (1 << s)][s]; } void solve(int l, int r) { if (l > r) r...
#include <bits/stdc++.h> unsigned long long int p[64][2][2], m, pi[64]; void mul_matrix(int size, unsigned long long int (*a)[2], unsigned long long int (*b)[2], unsigned long long int (*dest)[2]) { int i, j, k; for (i = 0; i < size; i++) for (j = 0; j < 2; j++) { ...
#include <bits/stdc++.h> using namespace std; int a[1000 * 1000]; int main() { int t; cin >> t; double s = 0; for (int i = 0; i < t; i++) { cin >> a[i]; s += a[i]; } vector<int> ind; for (int i = 0; i < t; i++) { double p = ((s - a[i]) / (t - 1)); if (a[i] == p)...
#include <bits/stdc++.h> using namespace std; int a[5005], cnt, tmp, nxt, V[5005], j, n, i; long long dp[2][5005], ans; struct LS { int pos, val; } ls[5005]; inline bool cmp(LS aa, LS bb) { return aa.val < bb.val; } int main() { cin >> n; for (i = 1; i <= n; ++i) cin >> a[i], ls[i].val = a[i],...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 85 - 69; long long int a[maxn], su[maxn], dp[maxn]; int n; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 1; i < n; i++) cin >> a[i]; for (int i = n - 1; i > 0; i--) { su[i] = su[i...
#include <bits/stdc++.h> using namespace std; const string ALICE = Alice , BOB = Bob ; void solve_case() { int N, K; cin >> N >> K; if (K % 3 != 0) { cout << (N % 3 != 0 ? ALICE : BOB) << n ; return; } N %= K + 1; cout << (N % 3 == 0 && N < K ? BOB : ALICE) << n ; } i...
/* * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 30.06.2017 11:21:41 // Design Name: // Module Name: memoryaccess // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // ...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << { << p.first << , << p.second << } ; return os; } const int N = 3e5 + 5; const int oo = 1e9 + 7; vector<pair<int, pair<int, int> > > g[N]; int f[N]; ...
`timescale 1ns / 1ps //Source: http://www.bigmessowires.com/2009/06/21/fpga-pong/ // // ----------------------------------------------- // updates the ball and paddle positions, and // determines the output video image // ----------------------------------------------- module game_module2015(input clk25, input Reset, ...
/* * 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 MAXN = 1010; long long c[2][2][MAXN][MAXN] = {0}; int n, m; long long val; int lowbit(int x) { return x & -x; } void add(int a, int b) { for (int i = a; i <= n; i += lowbit(i)) for (int j = b; j <= n; j += lowbit(j)) c[a & 1][b & 1][i][j] ^...
#include <bits/stdc++.h> using namespace std; int main() { string arr[11] = { ABSINTH , BEER , BRANDY , CHAMPAGNE , GIN , RUM , SAKE , TEQUILA , VODKA , WHISKEY , WINE }; int n; cin >> n; int counter = 0; string str; int num_convert; for (int i = ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 != 0) cout << -1 << endl; else { for (int i = 1; i <= n; i++) { if (i % 2 == 0) cout << i - 1 << ; else cout << i + 1 << ; } } return 0; }
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; template <class X, class Y> void amax(X& x, const Y& y) { if (x < y) x = y; } template <class X, class Y> void amin(X& x, const Y& y) { if (x > y) x = y; } const int INF = 1e9 + 10; const long long INFL = (long long)1e18 + 10; const int MAX = 2e5...
`timescale 1ps/1ps `default_nettype none (* DowngradeIPIdentifiedWarnings="yes" *) module axi_protocol_converter_v2_1_9_b2s_aw_channel # ( /////////////////////////////////////////////////////////////////////////////// // Parameter Definitions //////////////////////////////////////////////////////////////////////////...
/** * 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> int a[105], stor[105]; int main() { int n; scanf( %d , &n); int i; for (i = 0; i < n; i++) scanf( %d , &a[i]); int j, k = 0, max; max = a[2] - a[0]; for (i = 1; i < n - 1; i++) { if (i == 1) { max = a[2] - a[0]; for (j = 2; j < n - 1; j++) {...
#include <bits/stdc++.h> using namespace std; int n, m, k, s, x, y, cur, pr, cans, tot, a[2005][2005], dp[4][2005][2005]; vector<pair<int, int> > all[10]; int ans[10][10]; int dist(int x2, int y2, int x3, int y3) { return abs(x2 - x3) + abs(y2 - y3); } int main() { ios_base::sync_with_stdio(0); cin ...
#include <bits/stdc++.h> using namespace std; const int N = 1e4 + 5; long long int dp[N][102]; int main() { int n, k, m; scanf( %d%d%d , &n, &k, &m); for (int i = 1; i <= 9; i++) dp[1][i % k]++; long long int wynik = 0, p = 1; for (int x = 1; x <= n - 1; x++) { p = (p * 10) % k; ...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T& x) { bool fu = 0; char c; for (c = getchar(); c <= 32; c = getchar()) ; if (c == - ) fu = 1, c = getchar(); for (x = 0; c > 32; c = getchar()) x = x * 10 + c - 0 ; if (fu) x = -x; }; template <...
/* File: earb.v This file is part of the Parallella Project. Copyright (C) 2014 Adapteva, Inc. Contributed by Fred Huettig <> 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 Foundation, either v...
module count_hours( twentyfour_mode, manual_inc, automatic_inc, ones_digit, tens_digit, am, pm, count_out ); // port declarations input twentyfour_mode; input manual_inc; input automatic_inc; output [3:0] ones_digit; output [3:0] tens_digit; output reg am; output reg pm; output reg count_out;...
module ALU(clk, control, data_input1, data_input2, data_output, zero); input clk; input [3:0] control; input signed [31:0] data_input1, data_input2; output reg signed [31:0] data_output; output reg zero; // Control signal definitions, taken from textbook page 260 // High zero to indicate when output is zero (beq and...
/* * 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 : Sat Jun 03 23:38:44 2017 // Host : GILAMONSTER running 64-bit major release (...
/* * 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, k; int a[105]; map<int, bool> q; int main() { while (~scanf( %d %d , &n, &k)) { q.clear(); for (int i = 0; i < k; i++) scanf( %d , &a[i]); int t = 1; int t2 = n; for (int i = 0; i < k; i++) { int t3 = (a[i] %= t2); ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { if (x > y) swap(x, y); if (x <= 0) return y; if (y % x == 0) return x; return gcd(y % x, x); } int main() { vector<long long> a; long long b[400000]; bool c[400000]; for (long long i = 0; i < ...
#include <bits/stdc++.h> using namespace std; struct fastIO { inline fastIO operator>>(int& num) { num = 0; char c = getchar(); while (c != - && (c < 0 || c > 9 )) c = getchar(); bool foo = 0; if (c == - ) { foo = 1; c = getchar(); } while (c >= 0...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void read(T& x) { int f = 0, c = getchar(); x = 0; while (!isdigit(c)) f |= c == - , c = getchar(); while (isdigit(c)) x = x * 10 + c - 48, c = getchar(); if (f) x = -x; } template <typename T, typename... Args> ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: MossbauerLab // Engineer: EvilLord666 (Ushakov MV) // // Create Date: 21:01:28 08/30/2017 // Design Name: messbauer_test_environment // Module Name: messbauer_diff_discriminator_si...
#include <bits/stdc++.h> using namespace std; template <class T> void operator>>(istream& is, vector<T>& v) { for (auto& e : v) { is >> e; } } template <class T> void operator<<(ostream& os, const vector<T>& v) { for (const auto& e : v) { os << e << ; } os << n ; } l...
#include <bits/stdc++.h> using namespace std; using LL = long long; using PII = pair<int, int>; int main() { int n; scanf( %d , &n); LL ansx, ansy; ansx = ansy = 0; n *= 2; for (int i = 1; i <= n; i++) { int x, y; scanf( %d%d , &x, &y); ansx += x; ansy += y; }...
// ================================================================== // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< // ------------------------------------------------------------------ // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // -------...
/** * 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...
////////////////////////////////////////////////////////////////////////////////// // NPCG_Toggle_SCC_N_poe for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. /...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100000; const int D[4][2] = {{1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; set<pair<int, int> > s; set<pair<pair<int, int>, int> > vis; char dir[10]; int sx, sy, h, w, d, tar; inline void update(int& a, int b) { if (b < a) a = b; } int main(...
/** * 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 n, i, j, k, m; char ss[111], c; bool a[111]; string s[111], t; bool eq(string a, string b) { for (int i = 0; i < a.length(); i++) if (a[i] <= Z ) a[i] = a[i] - A + a ; for (int i = 0; i < b.length(); i++) if (b[i] <= Z ) b[i] = b[i] ...
// Verify that a zero width signal replication is handled correctly. module top; reg pass; reg [31:0] in_full; wire [31:0] pa_out_full, ca_out_full; reg [29:0] in_part; wire [31:0] pa_out_part, ca_out_part; initial begin pass = 1'b1; in_full = {16{2'b10}}; in_part = {15{2'b01}}; #1; if ...
////////////////////////////////////////////////////////////////// // // // Multiplication Module for Amber 2 Core // // // // This file is part of the Amber project ...
#include <bits/stdc++.h> using namespace std; int main() { long long a[100005]; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { printf( %I64d , a[i] + a[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...
#include <bits/stdc++.h> using namespace std; int N, P[1005], D[1005]; int main() { scanf( %d , &N); for (int i = 1; i <= N; i++) { scanf( %d , &P[i]); } D[1] = 1; for (int i = 2; i <= N; i++) { int p = P[i]; D[i] = 1; for (int j = p; j < i; j++) { D[i] += D[j] ...
`include "../../../rtl/verilog/gfx/gfx_line.v" module line_bench(); parameter point_width = 16; parameter subpixel_width = 16; reg clk_i; reg rst_i; reg signed [point_width-1:-subpixel_width] pixel0_x_i; reg signed [point_width-1:-subpixel_width] pixel1_x_i; reg signed [point_width-1:-subpixel_width] pixel0_y_i; re...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Lane Brooks. // // This implements a 4096:1 mux via two stages of 64:1 muxing. // change these two parameters to see the speed differences //`define DATA_WIDTH 12 //`define MU...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int s; cin >> s; int k, ans = 0; for (k = 1; s > 0 && s >= k; k += 2) s -= k, ++ans; for (k = min(s, k - 1); s > 0 && k >= 1; k--) { ...
#include <bits/stdc++.h> using namespace std; const int sz = (1 << 22); bool ar[sz], us[2][sz]; int n, m, bg; void dfs(int v, int t) { us[t][v] = 1; if (t == 0) { if (us[1][bg ^ v] == 0) dfs(bg ^ v, 1); } else { if (ar[v] and us[0][v] == 0) dfs(v, 0); for (int i = 0; i < n; i++) ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2003 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk, fastclk ); input clk; input fastclk; reg reset_l...
#include <bits/stdc++.h> using namespace std; bool done[1010]; int l[1010], r[1010], ans[1010]; int main() { int n, i, j, k; scanf( %d , &n); int rem = n; for (i = 0; i < n; i++) { scanf( %d , &l[i]); done[i] = 0; } for (i = 0; i < n; i++) scanf( %d , &r[i]); int maxx = n...
// (c) Copyright 1995-2017 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 // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; vector<int> P[2]; int n; int mark[100011]; int cnt[100011]; int cor(int p, int n) { return 2 * n + p; } int main() { int k, x; cin >> n; for (int i = 0; i < 2; i++) { cin >> k; for (int j = 0; j < k; j++) { cin >> x; P[i...
/* * 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...
//Device: Virtex-5 LXT //Design Name: speed_neg_control //Purpose: // This module handles the SATA Gen1/Gen2 speed negotiation /* Speed negotiation is accomplished by changing the internal shared phase-locked loop (PLL) divider settings of the GTP transceiver during runtime to eliminate the need for reconfiguration. ...
`timescale 1ns / 1ps /********************************************************************** * Felix Winterstein, Imperial College London * * File: fifo.v * * Revision 1.01 * Additional Comments: distributed under a BSD license, see LICENSE.txt * **********************************************************************/ ...
module VGA_NIOS_CTRL ( // Host Side iDATA, oDATA, iADDR, iWR, iRD, iCS, iRST_N, iCLK, // Host Clock // Export Side VGA_R, VGA_G, VGA_B, VGA_HS, VGA_VS, VGA_SYNC, VGA_BLANK, VGA_CLK, iCLK_25 ); ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const long long inf = 1e18 + 10; long long dis[N], sid[N], mark[N], h[N], dp[N], c[N]; pair<pair<long long, long long>, long long> E[N]; vector<pair<long long, long long> > adj[N], jda[N], g[N]; priority_queue<pair<long long, long long>...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; void DBG() { cerr << ] << endl; } template <class H, class... T> void DBG(H h, T... t) { cerr << to_string(h); if (sizeof...(t)) cerr << , ; DBG(t...); } int main(void) { ios_base::sync_with_stdio(false); ...
#include list #include <iostream> #include <utility> #include <vector> #include fstream #include <fstream> #include <map> #include algorithm #include <iomanip> #include cmath #include set #include <climits> #include queue #include complex #define all(x) (x).begin(), (x).end(...
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; int n; string rakh1, rakh2, rakh, ch, ch_min; while (test--) { cin >> n; cin >> ch; ch_min = ch; int pos = 1; for (int i = 1; i < (n - 1); i++) { rakh1 = ch.substr(0, i); ...
#include <bits/stdc++.h> const int INF_INT = 0x3f3f3f3f; const long long INF_LL = 0x7f7f7f7f; const int MOD = 1e9 + 7; const double eps = 1e-10; const double pi = acos(-1); using namespace std; vector<int> g[100010]; int n; double ans; void dfs(int fa, int u, int cnt) { ans += 1.0 / cnt; for...
/** * 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; set<string> setao; string s; const int N = 10010; int pd[N][4], n; char solve(int k, int last) { if (k == n) return 1; if (n - k == 1 or k > n) return 0; if (pd[k][last] != -1) return pd[k][last]; string ant; for (int i = last; i >= 1; i--) {...
// -- (c) Copyright 2010 - 2011 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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...