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...
/** * 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 int N = 3e5; int n, ans; int Dpos[N + 3]; char str[N + 10], Nstr[N + 10]; int main() { scanf( %d%s , &n, str + 1); int Ncnt = 0, Ned = n, Nmin = 0; for (int i = 1; i <= n; i++) { if (str[i] == ( ) Ncnt++; else Ncnt-...
// This file is part of Verilog-65c816. // // Copyright 2017 by FPGApeeps // // Verilog-65c816 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 version 3 of the License, or (at // your option) any la...
module pr_region_alternate_mm_bridge_0 #( parameter DATA_WIDTH = 32, parameter SYMBOL_WIDTH = 8, parameter HDL_ADDR_WIDTH = 10, parameter BURSTCOUNT_WIDTH = 1, parameter PIPELINE_COMMAND = 1, parameter PIPELINE_RESPONSE = 1 ) ( input wire clk, // cl...
// Copyright (c) 2000-2009 Bluespec, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, pub...
/** * 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...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Instruction TLB //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; double PI = acos(-1); double EPS = 1e-7; int INF = 1000000000; int MOD = 1000000007; int MAXINT = 2147483647; long long INFLL = 1000000000000000000LL; long long MAXLL = 9223372036854775807LL; int mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}; int my[8] = {0, 0, -1...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, p, a[100000], sum = 0; cin >> n >> p; for (int i = 0; i < n; i++) { cin >> a[i]; sum += a[i]; sum %= p; } sum = (sum + p - (a[0] % p)) % p; int cur ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int ls[N << 2], rs[N << 2], rt[N << 2], sum[N << 2]; int rcnt; void update(int &rt, int l, int r, int pos) { if (rt == 0) rt = ++rcnt; if (l == r) { sum[rt]++; return; } int mid = (l + r) >> 1; if (pos <= mid)...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2004 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [67:0] q; reg signed [67:0] qs; ...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
/** * 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; #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define endl n typedef long long ll; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; int main(){ _ int n; cin >> n; vector<int> a(n); for(int& i : a) cin >> i; ...
/* * 16-bit bitwise rotate module for Zet * Copyright (C) 2008-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 License as published by the Free Software * Founda...
#include <bits/stdc++.h> using namespace std; int n, a[27], sum, gcd; int odd; int _gcd(int x, int y) { if (x == 0 or x == y) return y; if (x > y) swap(x, y); while (y % x) { y %= x; swap(x, y); } return x; } int main() { scanf( %d , &n); for (int i = 0; i < n; i++) {...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:34:40 11/07/2015 // Design Name: Encoder // Module Name: C:/Users/Camilo/Documents/Xilinx_Workspace/Transflineal/enconder_tst.v // Project Name: Transflineal // T...
#include <bits/stdc++.h> using namespace std; struct node { int t, n; } a[200005]; int cmp(const void* a, const void* b) { node* aa = (node*)a; node* bb = (node*)b; if (aa->n > bb->n) { return 1; } else if (aa->n == bb->n) { return bb->t - aa->t; } else { return -1; ...
////////////////////////////////////////////////////////////////////////////// /// Copyright (c) 2014, Ajit Mathew <> /// All rights reserved. /// // Redistribution and use in source and binary forms, with or without modification, /// are permitted provided that the following conditions are met: /// /// * Redistribut...
#include <bits/stdc++.h> using namespace std; int n; int num = 0; int cnt[1000] = {0}; int candidate[400005] = {0}; string s; bool check(int added) { if (added % 2) return false; if (n % (added + num)) return false; if ((n / (added + num)) % 2 == 0) return false; return true; } int mai...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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...
module LCD( input clk, input rst, input [127:0] upRow, input [127:0] doRow, output e, output rs, output rw, output [3:0] sf ); reg [23:0] count = 0; reg refresh; reg [5:0] Code; assign {e, rs, rw, sf} = {refresh, Code}; // count always@(posedge clk, posedge rst) begin if(rst)...
#include <bits/stdc++.h> using namespace std; vector<vector<int>> adj; bool vis[200000 + 9]; int cntnode; map<int, int> colorcnt; int c[200000 + 9]; int mx; void dfs(int node) { if (vis[node]) { return; } cntnode++; colorcnt[c[node]]++; mx = max(mx, colorcnt[c[node]]); vis[...
/** * 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...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * for EE577b Troy WideWord Processor Project */ /** * Reference: * Nestoras Tzartzanis, EE 577B Verilog Example, Jan 25, 1996 * http://www-scf.usc.edu/~ee577/tutorial/verilog/counter.v */ // Behavioral model for the 32-bit program counter module p...
#include <bits/stdc++.h> using namespace std; struct seg { vector<int> id; map<pair<int, int>, int> st; int getid(int l, int r) { int L = lower_bound(id.begin(), id.end(), l) - id.begin(); int R = upper_bound(id.begin(), id.end(), r) - id.begin() - 1; if (L > R) return -1; return...
#include <bits/stdc++.h> using namespace std; struct no { int r; int l; int p; }; int main() { int n; double v; double a[110]; double b[110]; cin >> n >> v; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; if (b...
module single_register(datain, dataout, clk, clr, WE); input [31:0] datain; output [31:0] dataout; input clk, clr, WE; reg [31:0] register; always @(posedge clk or posedge clr) begin if(clr) register = 0; else if(WE == 1) register = datain; end assign dataout = register; endm...
/** * 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() { long long int t; cin >> t; while (t--) { long long int n, k; cin >> n >> k; long long int arr[n]; long long int i; for (i = 0; i <= n - 1; i++) { cin >> arr[i]; } long long int temp = k; ve...
#include <bits/stdc++.h> using namespace std; int n; int ar[50][50]; int dp[51][51]; bool leaf[50]; vector<int> adj[50]; vector<int> adjw[50]; vector<int> leafs; int bad; vector<int> pos; int go(int rem, int now) { if (rem == 0) { return 0; } if (dp[rem][now] != -1) { retur...
#include <bits/stdc++.h> using namespace std; int m = 1e9 + 7; int p = 31; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); ; long long t = 1; cin >> t; while (t--) { long long w, h; cin >> w >> h; long long k1, k2, k3, k4; cin >> k1; ...
#include <bits/stdc++.h> using namespace std; int cur[100005]; int mark[100005]; int sol[400005]; int csol; int n, m; vector<int> E[100005]; inline void dfs(int u, int up) { mark[u] = 1; csol++; sol[csol] = u; cur[u] ^= 1; int last = 0; for (int i = 0; i < E[u].size(); i++) ...
#include <bits/stdc++.h> using namespace std; const int maxn = 210; const double eps = 1e-9; int n; int lsh[maxn * 2], ln, K; map<int, int> mt; int To[maxn]; int li[maxn], ri[maxn]; double f[2][maxn][maxn]; double ans[maxn][maxn]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) ...
// File clk.vhd translated with vhd2vl v2.4 VHDL to Verilog RTL translator // vhd2vl settings: // * Verilog Module Declaration Style: 1995 // vhd2vl is Free (libre) Software: // Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd // http://www.ocean-logic.com // Modifications Copyright (C) 2006 Mark Gon...
#include <bits/stdc++.h> using namespace std; int x[4]; int y[4]; int ii[4] = {1, -1, 0, 0}; int jj[4] = {0, 0, -1, 1}; int main() { ios_base::sync_with_stdio(0); int x1, x2, x3, y1, y2, y3; for (int i = 1; i <= 3; i++) { cin >> x[i] >> y[i]; } set<pair<int, int>> s; long long ...
(** * Priqueue: Priority Queues *) (** A _priority queue_ is an abstract data type with the following operations: - [ empty: priqueue ] - [ insert: key -> priqueue -> priqueue ] - [ delete_max: priqueue -> option (key * priqueue) ] The idea is that you can find (and remove) the highest-priority element. Pr...
/* ---------------------------------------------------------------------------------- Copyright (c) 2013-2014 Embedded and Network Computing Lab. Open SSD Project Hanyang University All rights reserved. ---------------------------------------------------------------------------------- Redistribution and use ...
#include <bits/stdc++.h> using namespace std; const int maxn = 10; const int INF = 2147000000; int n, k; int a[maxn][maxn]; int b[maxn], vis[maxn]; int ans = INF; int make(int num) { int res = 0; for (int i = 1; i <= k; i++) { int c = b[i]; res = res * 10 + a[num][c]; } retur...
#include <bits/stdc++.h> using namespace std; int main() { long long n; while (scanf( %I64d , &n) != EOF) { long long x, y, l, h, mid; l = 0, h = 1e18 + 7; while (l < h - 1) { mid = (l + h) >> 1; if (n / (3 * mid) >= mid + 1) l = mid; else h = mi...
Require Import Coq.Program.Basics. Require Import MathClasses.interfaces.canonical_names. Require Import TypeclassHierarchy.Util.FunctionSetoid. (* math-classes uses (=) to denote equivalence, but we will use it for equality *) Infix "=" := eq : type_scope. Notation "(=)" := eq (only parsing) : mc_scope. Notation "( x...
#include <bits/stdc++.h> #pragma warning(disable : 4996) #pragma comment(linker, /STACK:336777216 ) using namespace std; int IT_MAX = 1 << 17; const long long MOD = 1000000007; const int INF = 0x1f3f3f3f; const long long LL_INF = 1034567890123456789ll; const double PI = acos(-1); const double ERR = 1...
#include <bits/stdc++.h> using namespace std; int n, m; char s[1100][1100]; bool a[1100][1010]; bool canDraw(int x, int y, int level) { int i = level; { if (x + i < 0 || x + i >= n) return false; if (y + i < 0 || y + i >= m) return false; if (s[x + i][y] == . ) return false; i...
#include <bits/stdc++.h> using namespace std; vector<int> getPrimes(int n) { vector<bool> sieve(n + 1, true); sieve[0] = sieve[1] = false; for (int i = 2; i * i <= n; i++) if (sieve[i]) for (int j = i * i; j <= n; j += i) sieve[j] = false; vector<int> primes; for (int i = 2; i <= n...
#include <bits/stdc++.h> using namespace std; struct data { int x, y; } v[300005]; inline bool cmp(data d1, data d2) { if (d1.x != d2.x) return d1.x < d2.x; return d1.y < d2.y; } inline bool cmp2(data d1, data d2) { return d1.y < d2.y; } int n; int main() { scanf( %d , &n); for (int ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's Data TLB //// //// //// //// This file is part of the OpenR...
#include <bits/stdc++.h> using namespace std; template <typename T> void __p(T a) { cout << a; } template <typename T, typename F> void __p(pair<T, F> a) { cout << { ; __p(a.first); cout << , ; __p(a.second); cout << } n ; } template <typename T> void __p(std::vector<T> a) {...
#include <bits/stdc++.h> using namespace std; char ans[300][300]; string s; int cnt[300]; int bal[300]; int n, m; void f(int l, int r, int ll, int rr) { if (l + 1 == r) { for (int i = 0; i < n / 2 - bal[r]; ++i) { ans[n / 2 + i][ll] = | ; ans[n / 2 - i][ll] = | ; ans[n ...
/* Copyright (c) 2014-2016 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
#include <bits/stdc++.h> using namespace std; long long n, j, k, a, b; pair<int, int> c[300005]; map<pair<long long, long long>, long long> m; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; c[i] = make_...
#include <bits/stdc++.h> using namespace std; long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); ...
`timescale 1ns/10ps module RotarySim; reg clock; reg reset; reg [11:0] inst; reg inst_en; reg [1:0] rotary; wire rotary_left_status; wire rotary_right_status; initial begin #0 $dumpfile(`VCDFILE); #0 $dumpvars; #10000 $finish; en...
#include <bits/stdc++.h> using namespace std; void Input_Preparing() {} void Processing() { int a, b; cin >> a >> b; cout << min(a, b) << << (max(a, b) - min(a, b)) / 2; } int main() { std::cin.tie(0)->sync_with_stdio(0); ; Processing(); return 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 la...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 23; const int MOD = 1e9 + 7; const int N = 1000 + 10; int brow[N], bcol[N]; int main() { ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; for (int i = 0; i < (m); ++i) { int x, y; cin >> x >> y; brow[...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 0; while (c =...
/** * 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 = (long long)1e18; const long long mod = (long long)1e9 + 7; const double eps = (double)1e-9; const double pi = acos(-1.0); const int dx[] = {0, 0, 1, 0, -1}; const int dy[] = {0, 1, 0, -1, 0}; const int N = 100500; int n, x, y, a, b, T...
#include <bits/stdc++.h> using namespace std; bool done[123][123]; char s[123][123]; vector<pair<pair<long long, long long>, long long int> > v; int main() { long long int n, m; scanf( %lld%lld , &n, &m); for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) { done[i][j] = false; ...
#include <bits/stdc++.h> using namespace std; int n, q; unordered_map<int, pair<int, int>> resi[50 * 3 + 2]; struct FLOW { int n, *pre, *dist; FLOW(int n) : n(n) { pre = (int *)malloc((n + 2) * sizeof(int)); dist = (int *)malloc((n + 2) * sizeof(int)); } ~FLOW() { free(pre); ...
#include <bits/stdc++.h> using namespace std; int qmin(int a, int b) { return (a < b) ? a : b; } int qmax(int a, int b) { return (a > b) ? a : b; } int n, m, k; int x[555], y[555]; int xl[555], xr[555], yl[555], yr[555]; set<int> stx, sty; map<int, int> mpx; int xpos[1010]; vector<int> l[1010], r[10...
module top ( input wire clk, input wire rx, output wire tx, input wire [15:0] sw, output wire [15:0] led ); parameter SRL_COUNT = 4; parameter PRESCALER = 4; // 100000 // Uart loopback assign tx = rx; // ============================================================================ // Reset r...
#include <bits/stdc++.h> using namespace std; int x[505], r[505]; int main() { int i; x[0] = 0; r[0] = 1000000; double dd; int d; for (i = 1; i <= 300; i++) { r[i] = 300 - i + 1; dd = 2 * sqrt(double(r[i - 1])) * sqrt(double(r[i])); d = int(dd + 3); x[i] = x[i - 1] ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, a; cin >> n >> k; list<int> lst; map<int, bool> vis; for (int i = 0; i < n; i++) { cin >> a; if (lst.size() < k) { if (vis.find(a) == vis.end()) { lst.push_front(a); vis[a] = true; ...
////////////////////////////////////////////////////////////////////// //// //// //// usbSlaveCyc2Wrap_usb1t11.v //// //// //// //// This file is part of th...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:51:26 09/02/2013 // Design Name: siete_segmentos_principal // Module Name: C:/Users/Fabian/Documents/Taller Diseno/Xilinx/Lab1/sietesegmentos/pruebaalonso.v // Pro...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
// file: bclk_dll_tb.v // // (c) Copyright 2008 - 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 disclaim...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
#include <bits/stdc++.h> using namespace std; int main() { long long a; cin >> a; cout << (a + a / 2) << endl; return 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 la...
#include <bits/stdc++.h> using namespace std; long long n, ans; string str; long long solve() { long long k; cin >> n >> k; long long t = 3 * n; while (t > k) { t--; ans++; } cout << ans; return 0; } signed main() { ios::sync_with_stdio(0); long long t = 1; ...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); map<int, vector<int>> indices; for (int i = 0; i < n; i++) cin >> a[i], indices[a[i]].push_back(i); map<int, int> dp; int mxn = 0, ans = -1; for (int i = n - 1; i >= 0; i--) { dp[a[i]]...
////////////////////////////////////////////////////////////////////// //// //// //// i2cSlave.v //// //// //// //// This file is part of the i2cSla...
#include <bits/stdc++.h> using namespace std; const long long INF = 0x3f3f3f3f; const long long MAXN = 3e5 + 5; long long n, MOD, k, ans; map<long long, long long> mp; signed main() { scanf( %lld%lld%lld , &n, &MOD, &k); for (long long i = 1; i <= n; i++) { long long x; scanf( %lld , &x)...
// Copyright (C) 2020-2021 The SymbiFlow Authors. // // Use of this source code is governed by a ISC-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/ISC // // SPDX-License-Identifier:ISC module fsm ( clock, reset, req_0, req_1, gnt_0, gnt_1 ); ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; struct node { int vl, mnvl; node *l, *r; node() { mnvl = MAXN; vl = -1; l = r = NULL; } }; vector<node*> dv(MAXN); vector<bool> inarr(MAXN, false); vector<vector<int>> diverse(MAXN); deque<int> dbl(...
#include <bits/stdc++.h> using namespace std; int main() { int h, m, ti; scanf( %d:%d , &h, &m); scanf( %d , &ti); int realh = ti / 60, realmin = ti % 60; while (realh--) { if (h == 23) h = 0; else h++; } while (realmin--) { if (m == 59) { m = 0;...
// ========================================================================== // CRC Generation Unit - Linear Feedback Shift Register implementation // (c) Kay Gorontzi, GHSi.de, distributed under the terms of LGPL // ========================================================================== module sd_crc_16(BITVAL, EN...
// ----------------------------------------------------------------------- // // Copyright 2004,2007-2008 Tommy Thorn - All Rights Reserved // // 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 Foun...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps / 1ps `include "utils/clock_multiplier.v" `include "utils/DCM_sim.v"...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2004 by Wilson Snyder. module t (/*AUTOARG*/ // Outputs ign, // Inputs clk ); input clk; output [31:0] ign; reg [31:0] right; reg [31:0] left; reg ...
/** * 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; const int mod = 1e8 - 3; struct Data { int a, i; bool operator<(const Data& d) const { if (a == d.a) { return i < d.i; } return a < d.a; } }; const int N = 1e5 + 10; int C[N]; int lowbit(int first) { return first & -first;...
#include <bits/stdc++.h> using namespace std; vector<int> e[100005]; int used[100005]; void bfs(int x) { queue<int> q; while (!q.empty()) q.pop(); q.push(x); used[x] = 1; while (!q.empty()) { int p = q.front(); q.pop(); for (int i = 0; i < e[p].size(); i++) { if (e[...
#include <bits/stdc++.h> using namespace std; int main(void) { unsigned long num_bottles = 0; cin >> num_bottles; map<unsigned long, pair<unsigned long, unsigned long> > links; map<unsigned long, unsigned long> counts; for (unsigned long n = 0; n < num_bottles; n++) { unsigned long a = 0, ...
`include "../../../../../vpr/muxes/logic/mux8/mux8.sim.v" `include "../nreg/reg.sim.v" `include "carryin_mux/carryin_mux.sim.v" module CARRYINSEL_LOGIC (CARRYIN, CARRYCASCIN, CARRYCASCOUT, A, B, P, PCIN, CARRYINSEL, CIN, RSTALLCARRYIN, CECARRYIN, CEM, CLK); parameter MREG = 1; parameter CARRYINREG = 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 law...
#include <bits/stdc++.h> using namespace std; class wwj { public: wwj(int x); int klz(); int pdly(int k); private: int x; }; wwj::wwj(int x) { this->x = x; } int wwj::klz() { int i, sum = 0; double SM = 0; if (x == 0) return 0; SM = (-1 + sqrt(1.0 + 8 * abs(x))) / 2; ...
#include <bits/stdc++.h> using namespace std; bool r[1010], c[1010]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; r[a] = 1; c[b] = 1; } int ans = 0; for (int i = 1; i < n - 1; i++) { if (!c[...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long lgput(long long a, long long b, long long mod) { long long ret = 1; while (b) { if (b & 1) ret = (ret * a) % mod; a = (a * a) % mod; b >>= 1; } return (ret % mod); } inline long long inv(lo...
`ifdef __ICARUS__ `define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST `endif // Test array variables inside a constant function module constfunc14(); function [7:0] concat1(input [7:0] value); reg [3:0] tmp[1:2]; begin {tmp[1], tmp[2]} = {value[3:0], value[7:4]}; {concat1[3:0], concat1[7:4]} = {tmp[2], tmp[1]}; end ...
/** * 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; #define forg(i,x) for(register int i=fir[x];i;i=nxt[i]) #define uu unsigned #define scanf a14=scanf #define rint register int #define fre(x) freopen(#x .in , r ,stdin),freopen(#x .out , w ,stdout) typedef long long ll; typedef uu long long ull; typedef pair...