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... |
/**
* 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... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distribut... |
// (C) 2001-2015 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 simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int main() { long long t, n; string s; cin >> t; while (t--) { cin >> n >> s; long long ans = 0, o = 0, ans1 = 0; for (long long i = 0; i < n; i++) { if ((s[i] - 48) % 2 == 1) { ans = (ans * 10) + (s[i] - 48); ... |
#include <bits/stdc++.h> using namespace std; vector<int> p; vector<int> t; int main() { int n, c, a, ans1 = 0, ans2 = 0, t1 = 0, t2 = 0; cin >> n >> c; for (int i = 0; i < n * 2; i++) { cin >> a; if (i < n) { p.push_back(a); } else { t.push_back(a); } } ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = s.size(); string r; int i = 0; while (i < n) { if (n - i >= 3) { if (s.substr(i, 3) == WUB ) { if (r.size() && r.back() != ) r += ; i += 3; } else ... |
#include <bits/stdc++.h> using namespace std; int n, m; char A[200006]; int S[200006], T[200006]; void solve() { cin >> n >> m; scanf( %s , A + 1); long long re = 0; for (int i = (1), iend = (n); i <= iend; ++i) { S[i] = (A[i] != A[i + 1]) + S[i - 1]; if (i >= 2 && A[i] == A[i - 2]... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, c1, c2; cin >> n; int x, y; x = n / 3; y = n % 3; if (y == 1) { c1 = x + 1; c2 = x; } else if (y == 2) { c1 = x; c2 = x + 1; } ... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distribut... |
#include <bits/stdc++.h> using namespace std; bool a[5][5]; int main() { for (int i = 1; i < 4; ++i) { for (int j = 1, x; j < 4; ++j) { a[i][j] ^= 1; cin >> x; a[i][j] ^= (x & 1); a[i + 1][j] ^= (x & 1); a[i - 1][j] ^= (x & 1); a[i][j + 1] ^= (x & 1); ... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { char str[105]; cin.getline(str, 104); for (unsigned i = 1; i < strlen(str) + 1; i++) { if ((str[i] == str[i - 1]) && (str[i - 1] == / )) { for (unsigned j = i; j < strlen(str); j++) { str[j] = str[j... |
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long int #define ld long double #define pii pair<ll,ll> #define pb push_back #define rep(i,a,b) ... |
/*
* Copyright (c) 2011, Stefan Kristiansson <>
* All rights reserved.
*
* Redistribution and use in source and non-source forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, th... |
/**
* 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... |
/*------------------------------------------------------------------------------
Purpose
Multicycle division.
------------------------------------------------------------------------------*/
module mips_div (
input acompl,
input bcompl,
input ... |
module dummy;
parameter [TSTBITS-1:0] // synopsys enum tstate_info
TIDLE = 3'b000,
TCN1 = 3'b001,
TCN2 = TCN1+1, // must be numbered consecutively
TCN3 = TCN2+1,
TCN4 = TCN3+1,
TCN5 = TCN4+1,
IOCLR = TCN5+1,
TUNU1 = 3'b111;
// state and output logic
always @... |
#include <bits/stdc++.h> int arr[500005], st[500005][25], fa[500005][25], bit[500005]; inline int calc(int x, int y) { if (arr[x] <= arr[y]) return x; return y; } inline int query(int l, int r) { if (l < 0 || l > r) return 0; int len = bit[r - l + 1]; return calc(st[l][len], st[r - (1 << len... |
#include <bits/stdc++.h> using namespace std; int n, m, k, ta, tb, i, ans[100005], tc, ca[2][1005]; vector<int> va[2][1005], vb[2], ve; int main() { scanf( %d%d%d , &n, &m, &k); for (int a = 0; a < k; a++) { scanf( %d%d , &ta, &tb); ta--; tb--; vb[0].push_back(ta); vb[1].pu... |
#include <bits/stdc++.h> using namespace std; void setIO(string str, bool dbg) { ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); if (!dbg) { freopen((str + .in ).c_str(), r , stdin); freopen((str + .out ).c_str(), w , stdout); } } const int MAX = 5e3 + 5; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:06:02 05/29/2015
// Design Name:
// Module Name: UART_TX
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; bool seat[100][100] = {0}; int main() { int n, k; scanf( %d %d , &n, &k); while (n--) { int num, x, l, r, min_sum; min_sum = 100000; scanf( %d , &num); for (int i = 1; i <= k; i++) { for (int j = 1; j <= k - num + 1; j++) { ... |
/**
* 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> const int INF = INT_MAX; using namespace std; const int N = 3e5 + 10; int arr[N]; int main() { ios_base::sync_with_stdio(false); stringstream ss; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } map<int, bool> ma; vector<pair<int, 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 la... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; long long n, m, a, d; long long t[N]; int main() { cin >> n >> m >> a >> d; for (int j = 1; j <= m; j++) { scanf( %lld , &t[j]); } t[m + 1] = 8e18; long long i = 1, ans = 0, last = -1; for (int j = 1; j <= m + 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... |
//------------------------------------------------------------------------------
// YF32 -- A small SOC implementation based on mlite (32-bit RISC CPU)
// @Taiwan
//------------------------------------------------------------------------------
//
// ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 66, maxm = 200006, maxs = 65536, pr[] = {2, 3, 5, 7, 11, 13, 17, 19}; int n, P, a[maxm], b[maxm], f[maxs], s1[maxn], s2[maxn]; long long X, Y, ans, p[maxn]; long long mul(long long x, long long y, long long MOD) { x %= MOD; y %... |
/*------------------------------------------------------------------------------
Purpose
Wishbone wrrapper for synchronous RAM.
------------------------------------------------------------------------------*/
`include "tenv_ssram.v"
module tenv_4ssram_wishbone #(parameter WADDR=10,
... |
// fpgaTop_alder.v - ssiegel 2009-03-17
module fpgaTop(
input wire sys0_clkp, // sys0 Clock +
input wire sys0_clkn, // sys0 Clock -
input wire pci0_clkp, // PCIe Clock +
input wire pci0_clkn, // PCIe Clock -
input wire pci0_rstn, // PCIe Reset
out... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(time(0)); uniform_int_distribution<int> uid(-1e9, 1e9); long double f[51]; vector<vector<vector<long double>>> dp; pair<long double, long double> solve(vector<int> v, int l, int r) { dp.assign(v.size() + 1, vector<vector<long double>>( ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { while (a > 0 && b > 0) { if (a < b) swap(a, b); a %= b; } return a + b; } const int maxN = (int)1e6 + 10; long long a[maxN]; long long k; vector<long long> factor(long long x) { vector<long ... |
/*!
* @copyright Copyright (c) 2014, Tymoteusz Blazejczyk - www.tymonx.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyrig... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ram_16x512.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline string toString(T a) { ostringstream os( ); os << a; return os.str(); } template <typename T> inline long long toLong(T a) { long long res; istringstream os(a); os >> res; return res; } template <type... |
//-----------------------------------------------------------------------------
//
// (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 pro... |
/**
* 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; char p[][20] = { vaporeon , jolteon , flareon , espeon , umbreon , leafeon , glaceon , sylveon }; char s[20]; int main() { int n, k, i; scanf( %d , &n); scanf( %s , s); for (k = 0; k < 8; k++) { int fl = 1; 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 law... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
module m26_rx_ch
(
input wire RST,
input wire CLK_RX,
input wire MKD_RX,
inpu... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 version 3 of the License, or
// (at your option) any later version.
//
// This program is dis... |
/**
* 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... |
module matrix_mul
(
input clk,
input normalize,
input t_mode,
input nd,
input invert_v_nd,
input signed [31:0] v0,
input signed [31:0] v1,
input signed [31:0] v2,
input signed [31:0] v3,
input signed [31:0] m00,
input si... |
#include <bits/stdc++.h> using namespace std; const int INF = (1u << 31) - 1; const int MAXN = 100086; int mice[MAXN], arr[MAXN], chese[MAXN]; int main() { for (int n, m; ~scanf( %d%d%*d%*d , &n, &m);) { for (int i = 0; i < n; i++) { scanf( %d , &mice[i]); } for (int i = 0; i < 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... |
/*
* 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 ... |
#include <bits/stdc++.h> using namespace std; int podch[1100]; int newp[1100]; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, x; cin >> n >> k >> x; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; podch[tmp]++; } for (int i = ... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n, k, count, x, y, sum; cin >> n >> k; count = 2; x = (n - 1) / k; y = (n - 1) % k; if (y == 0) { sum = 2 * x; } else if (y == 1) { sum = 2 * x + 1; } else { sum = 2 * (x + 1); } cout << sum ... |
/**
* 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, k, q; int it[35][800005]; struct point { int a[10]; point(){}; int &operator[](int x) { return a[x]; } }; point p[200005]; int sign(point &p, int bit) { int ans = 0; for (int i = 0; i < k; i++) { if (bit & 1 == 1) { ans... |
#include <bits/stdc++.h> using namespace std; char s1[5010], s2[5010], str[5010]; int num[30]; int len1, len2; int dfs(int k, int m) { if (!s1[k]) return m; for (int i = 0; i < 26; i++) if (num[i] && (m || (i >= s2[k] - a ))) { str[k] = i + a ; num[i]--; if (dfs(k + 1, ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; using ll = long long; using pii = pair<ll, int>; const int INF = 1e9 + 1e2; void fin() {} const bool flag = 0; const int N = 1e5 + 10; int MOD; int mult(ll a, ll b) { return a * 1ll * b % MOD; } ll binpow(ll a, int b) { l... |
// (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; int main() { int n; cin >> n; string a, b; cin >> a >> b; n *= 2; int n1 = 0, n2 = 0, q = 0; for (int i = 0; i < n; ++i) if (a[i] == 1 ) if (b[i] == 1 ) q = !q; else ++n1; else if (b[i] == 1 ... |
#include <bits/stdc++.h> using namespace std; int t[1000005], r = 1000004; int dp[1000005]; int main() { memset(dp, 0, sizeof(dp)); memset(t, 0, sizeof(t)); int n, ans = 0, x; cin >> n; for (int i = 0; i < n; i++) { cin >> x; cin >> t[x]; } dp[0] = 0; if (t[0] != 0) d... |
/*
* 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 start, ed = 0, sz = 130000000; long long marked[(130000000 / 64) + 5]; vector<int> primes; inline bool check(int pos) { return !(marked[pos / 64] & (1LL << (pos % 64))); } int pos; bool isPrime(int n) { if (n != 2 and n % 2 == 0) return false; int ... |
`timescale 1ns / 1ps
// Documented Verilog UART
// Copyright (C) 2010 Timothy Goddard ()
// Distributed under the MIT licence.
//
// 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 re... |
#include <bits/stdc++.h> using namespace std; void read() { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); } string a1, a2, b1, b2; void check() { if (a1[0] == X ) swap(a1[0], a1[1]); else if (a1[1] == X ) swap(a1[1], a2[1]); else if (a2[1] == X ) ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: rain.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============================... |
#include <bits/stdc++.h> using namespace std; set<char> Set; pair<int, int> p[181]; string s, sn; int i, k, sum; bool pole[181]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> s; cin >> k; for (i = 0; i < s.size(); i++) p[s[i] - 96].first++; for (i = 1; i <= 26; i++) p[i]... |
#include <bits/stdc++.h> using namespace std; struct node { int x, y, z; }; int n, a[1001][1001], b[10001]; vector<node> v; int main() { int br = 0, i, j, x, y, in, mx, c; node el; cin >> n; for (i = 1; i < n; i++) { cin >> x >> y; a[x][y] = 1; } for (i = 1; i <= 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 la... |
#include <bits/stdc++.h> using namespace std; bool f[9000000]; int a[30]; bool check(int sta, int i) { if (sta & (1 << (i - 1))) ; else return false; for (int j = 0; j < i; j++) if (sta & (1 << j)) for (int k = j; k < i; k++) if (sta & (1 << k)) if (a[... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int imax = 2147483647; const int imin = -2147483647; const long long lmax = 9223372036854775807; const long long lmin = -9223372036854775807; long long power(long long a, long long b, long long m) { long long p = 1; ... |
#include <bits/stdc++.h> using namespace std; inline const int getint() { int r = 0, k = 1; char c = getchar(); for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) k = -1; for (; c >= 0 && c <= 9 ; c = getchar()) r = r * 10 + c - 0 ; return k * r; } const int N = 1e5 + 10; ch... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.4
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1... |
#include <bits/stdc++.h> using namespace std; int a[100500]; int v[100500]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; v[0] = -1; int ans = 0; for (int i = 0; i < n; i++) { int l = 0, r = ans + 1; while (r - l > 1) { int j = (l + r) / 2; ... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: tpram_128x32.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
/*
* 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; long long dd[200000], h[200000]; int a, b; int aaa[100000], bbb[100000]; long long d[200000]; long long mmin[200000][18], mmax[200000][18]; long long xxx(int x) { return h[x] - d[x]; } long long yyy(int y) { return h[y] + d[y]; } long long xval... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, temp, count = 0; cin >> a >> b; while (a >= 1 && b >= 1) { if (a > b) { count += a / b; a %= b; } else if (b > a) { count += b / a; b %= a; } else { count++; break... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, flag; cin >> n >> m; int l[m], ans[n], check[n]; memset(ans, 0, sizeof(ans)); memset(check, 0, sizeof(check)); for (int i = 0; i < m; i++) cin >> l[i]; for (int i = 0; i < m - 1; i++) { if (l[i + 1] > l[i]) { ... |
// Copyright (c) 2000-2012 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... |
// $Header: $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2009 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ ... |
// (c) Copyright 1995-2016 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 ... |
module automatic_events();
reg [5:1] any;
integer k;
initial begin
any = 5'b00000;
#200;
for (k = 1; k <= 5; k = k + 1) begin
#10 any[k] = 1;
#10 any[k] = 0;
end
end
task automatic report_events;
input integer n;
begin:task_body
reg [5:1] pos;
reg [5:1] neg;
#n;
pos = 5'b00000;
neg = 5'... |
/////////////////////////////////////////////////////////////////////
//// ////
//// SPI Slave Model ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; multiset<int> a, b; int c[300010], d[300010]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> c[i] >> d[i]; a.insert(c[i]); b.insert(d[i]); } int ans = 0; for (int i = 1; i <= n; i++) { a.erase(a.fi... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n, q; char s[N]; struct node { int s, x, z, xz, zy, d; } tr[N << 2]; void upd(int o) { int S = tr[(o << 1)].s, lx = tr[(o << 1)].x, lz = tr[(o << 1)].z, lxz = tr[(o << 1)].xz, lzy = tr[(o << 1)].zy; int rx = tr[(o... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200010, maxm = 2 * maxn; int n, m, a[maxn], L[maxn], R[maxn], dn, dep[maxn]; struct edge { int j, d; edge *nx; } e[maxm], *v[maxn]; int en; inline void add_e(int i, int j, int d) { e[++en].nx = v[i]; v[i] = e + en; v[i]->j ... |
`timescale 1ns/10ps
module soc_system_pll_0(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'outclk1'
output wire outclk_1,
// interface 'outclk2'
output wire outclk_2,
// interface 'locked'
output wire locked
);... |
`include "bsg_defines.v"
`include "config_defs.v"
// This module reads a stream of {0, 1}* bits from a file
// "config_file_setter.in", and feeds a single bit to its output port every
// clock cycle. The setter vector in file "config_file_setter.in" has varying
// length, and the author doesn't figure out a way to us... |
`timescale 1ns / 1ps
// vga controller module that generates signals to drive a monitor
// pixel and line counts are the current position on the display that should be output
module vga_controller(pixel_clock, reset, hsync, vsync, pixel_count, line_count);
input pixel_clock;
input reset;
output hsync;
... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.3 (lin64) Build Mon Sep 28 20:06:39 MDT 2015
// Date : Mon Nov 16 15:47:09 2015
// Host : roba-OptiPlex-7010 running 64-bit Ubuntu 15... |
// take some random amount of time before taking and returning data.
module remote_node
#(parameter `BSG_INV_PARAM(width_p)
, parameter `BSG_INV_PARAM(max_delay_p)
, parameter `BSG_INV_PARAM(id_p)
)
(
input clk_i
, input reset_i
, input v_i
, input [width_p-1:0] data_i
, output yumi... |
//
// Paul Gao 02/2021
//
// This is an output SDR PHY
//
// clk_o is center-aligned to data_o and is inverted from clk_i
// Waveform below shows the detailed behavior of the module
//
// WARNING:
// Source of clk_o is combinational logic instead of a register
// Duty-cycle of clk_o may not be ideal under c... |
module handshake(error, clk, req, ack, reset);
output reg error;
input clk, req, ack, reset;
reg [2:0] state;
initial
begin
state = 3'b000;
error = 1'b0;
end
always @(posedge clk)
begin
case (state)
3'b000:
begin
if (~req && ~ack)
state = 3'b000;
else if (req && ~ack)
state = 3'b001;
else
... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int N = 1200031; int n, ar[N], w[N]; int gcd(int a, int b) { while (a && b) a > b ? a %= b : b %= a; return a + b; } vector<pair<int, int> > edges; vector<int> entries[N]; int sz[N]; long long ANS[N]; vector<int... |
#include <bits/stdc++.h> unsigned bactery_count(unsigned num) { unsigned res = 0; while (num > 0) { (num & true) ? ++res, --num : num >>= 1; } return res; } int main() { unsigned num; std::cin >> num; std::cout << bactery_count(num) << std::endl; return 0; } |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
/******************************************************************************
*
* File Name : decode_ctl.v
* Version : 0.1
* Date : Feb 20, 2008
* Description :
* Dependencies :
*
* Company : Beijing Soul
* Author :
*
**********... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; long long n, s, ans, ans2, ret; struct Node { long long val, tmp; int id; } node[N]; bool cmp(Node A, Node B) { return A.tmp < B.tmp; } bool check(int x) { for (int i = 1; i <= n; i++) { node[i].tmp = node[i].val + nod... |
#include <bits/stdc++.h> using namespace std; int main() { int m, n; cin >> m >> n; cout << ((m % 2) ? m * (n / 2) + (n % 2) * (m / 2) : n * (m / 2) + (m % 2) * (n / 2)); return 0; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:12:47 05/12/2015
// Design Name:
// Module Name: sbox2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
/*
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.