text
stringlengths
59
71.4k
module counterDiagnosticVersion (clk,sig,f,n_clk_out); /*This module takes an input signal and implements a period counter, taking the reciprocal to deliver the frequency in kHz. USAGE: counter c(clk,sig,f); clk and sig are 1-bit inputs representing the clock and RF signal whose frequency is to be measured. f is a 4...
/** * 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 = 30; class Solution; class LinearBasis { public: friend class Solution; LinearBasis() : size(0) { fill(begin(bs), end(bs), 0); } LinearBasis& operator=(const LinearBasis& other) { copy(begin(other.bs), end(other.bs), begin(bs)); ...
#include <bits/stdc++.h> using namespace std; const int mod = 256; int getNum(char tch) { int num = tch; char ch[10]; int cnt = 0; while (cnt < 8) { ch[cnt++] = num % 2 + 0 ; num /= 2; } num = 0; for (int i = 0; i < 8; i++) { num = num * 2 + (ch[i] - 0 ); } ...
// binary_vga.v // This file was auto-generated as part of a generation operation. // If you edit it your changes will probably be lost. `timescale 1 ps / 1 ps module binary_vga ( input wire iCLK, // clk.clk output wire [9:0] VGA_R, // avalon_slave_0_export.export output wire...
#include <bits/stdc++.h> using namespace std; int n, t; int dp[22][7][7][12][12]; int main() { cin >> n >> t; if (n <= 2) { cout << 0 << endl; return 0; } for (int i = 1; i <= 4; i++) for (int j = 1; j <= 4; j++) if (i != j) dp[2][i][j][0][0] = 1; for (int i = 2; i ...
#include <bits/stdc++.h> using namespace std; inline int read() { int l = 0, f = 1; char a = getchar(); for (; a < 0 || a > 9 ; a = getchar()) if (a == - ) f = -1; for (; a >= 0 && a <= 9 ; a = getchar()) l = l * 10 + a - 48; return l * f; } const int N = 300005; int n, ans = ...
/* * 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...
/************************************************************************** Sync FIFO -parameter P_N Queue data vector width Example : DATA[3:0] is P_N=4 -parameter P_DEPTH Queue entry depth Example P_DEPTH 16 is P_DEPTH=16 -parameter P_DEPTH_N Queue entry depth n size Example PARAMETER_DEPTH16 is 4 -Make :...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long INF = (long long)1000000007 * 1000000007; const long double eps = 1e-8; const long double pi = acos(-1.0); int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; int n, m, t[200010]; set<int> se[200010]; i...
(* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* Mainly borrowed from Sofware Foundations, v.4 $Date: 2015-12-11 17:17:29 -0500 (Fri, 11 Dec 2015) $ Last Update: Tue, 30 May 2017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *) (* ****************************...
// -- (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...
#include <bits/stdc++.h> using namespace std; int main() { long long t1, n, zero, one, cnt, cnt1, i, j; string s; cin >> t1; while (t1--) { cin >> n; cnt = 0, zero = 0, one = 0; for (i = 0; i < n; i++) { cin >> s; for (j = 0; j < s.length(); j++) { if (s[j...
#include <bits/stdc++.h> using namespace std; int k; int n1, n2, n3; int t1, t2, t3; int v1[3000]; int v2[3030]; int v3[3030]; int main() { ios::sync_with_stdio(false); cin >> k >> n1 >> n2 >> n3 >> t1 >> t2 >> t3; int time = t1 + t2 + t3 - 1; int pos = 0; int res = 0; for (int i...
#include <bits/stdc++.h> using namespace std; const double g = 9.8; const double eps = 1e-9; int n, m, v; struct Ques { double angle; int id; } ques[10010]; struct Wall { double x, y; } wall[100010]; double ans_x[10010], ans_y[10010]; bool cmp(const Ques &a, const Ques &b) { return a.ang...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { long long int n, a, b, x, y; cin >> n; x = 1 + (n - 1) / 3; long long int sum = 0, k = 1; while (sum < x) { sum += k; ...
#include <bits/stdc++.h> using namespace std; struct Node { pair<int, int> A; int x, y; Node() {} Node(pair<int, int> A, int x, int y) { this->A = A; this->x = x; this->y = y; } }; char s[1001][1001]; int sp[10], cur, ans[10]; Node heap[1000001]; void swap(Node& a, No...
#include <bits/stdc++.h> using namespace std; int b[10][10]; char c[10][4][4]; int main() { char ch; int x = 1, y = 1, x1, y1, l, z, i, j, r; x1 = 3, y1 = 3; for (i = 1; i <= 9; ++i) { if (i > x1) ++x, x1 += 3; y1 = 3; y = 1; for (j = 1; j <= 9; ++j) { if (j % 3 =...
////////////////////////////////////////////////////////////////// // // // Register Bank for Amber Core // // // // This file is part of the Amber project ...
// cog_ctr /* ------------------------------------------------------------------------------- Copyright 2014 Parallax Inc. This file is part of the hardware description for the Propeller 1 Design. The Propeller 1 Design is free software: you can redistribute it and/or modify it under the terms of the GNU Ge...
//Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2016.2 (lin64) Build Thu Jun 2 16:32:35 MDT 2016 //Date : Wed Jul 20 13:44:49 2016 //Host : andrewandrepowell2-desktop running 64-bit Ubuntu...
`timescale 1 ns / 1 ps module myip_v1_0 # ( // Users to add parameters here // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S00_AXI parameter integer C_S00_AXI_DATA_WIDTH = 32, parameter integer C_S00_AXI_ADDR_WIDTH = 4, // Paramete...
#include <bits/stdc++.h> const long long MOD1 = 998244353, MOD2 = 1000000007; long long POWER_MOD1[300001], POWER_MOD2[300001]; struct node { long long hash1_MOD1, hash1_MOD2, hash2_MOD1, hash2_MOD2; int len; } T[1048576], single[2] = {(node){0, 0, 0, 0, 1}, (node){1, 1, 1, 1, 1}}; inline node operato...
#include <bits/stdc++.h> using namespace std; int main() { int x, y, z; cin >> x >> y >> z; if (x > y + z) cout << + << endl; else if (y > x + z) cout << - << endl; else if (x == y && z == 0) cout << 0 << endl; else cout << ? << endl; return 0; }
// MBT 11/10/14 // // bsg_round_robin_n_to_1 // // this is intended to merge the outputs of several fifos // together to act as one. // // assumes a valid yumi interface // // strict_p: determines whether the round_robin // module blocks until the head FIFO is valid, or if it just // goes to the next one. // // `inclu...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n == 1) { cout << 1 n0 1 n0 n1 ; return 0; } vector<long long> p1, p2; p1.push_back(1); p1.push_back(0); p2.push_back(1); for (long long i = 1; i < n; i++) { vector<long long>...
#include <bits/stdc++.h> using namespace std; int t, a, b; void fn() { cin >> a >> b; if (a < b) swap(a, b); a -= b; int ans = a / 5; a %= 5; if (a == 1 || a == 2) ans++; else if (a == 3 || a == 4) ans += 2; cout << ans << endl; } int main() { cin >> t; whil...
/* * 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 long double eps = 1e-9; const int inf = (1 << 30) - 1; const long long inf64 = ((long long)1 << 62) - 1; const long double pi = acos(-1); template <class T> T sqr(T x) { return x * x; } template <class T> T abs(T x) { return x < 0 ? -x : x;...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; /*AUTOWIRE*/ // Beginning of au...
module c3dClkGen2 ( input CLKIN, output SYSTEM_CLK, output SYNC_CLK, output C2C_CLK, output C2C_CLK180, output PLL0_LOCK // Other clocks i.e. for DDR if required ); // PLL for C2...
// Ten basic tests in here: // 1. byte must be initialised before any initial or always block // 2. assignments to (unsigned) bytes with random numbers // 3. assignments to (unsigned) bytes with random values including X and Z // 4. converting unsigned integers to unsigned bytes // 5. converting signed integers to unsi...
/*------------------------------------------------------------------------ Purpose - Data serializing; - bit staffing; - nrzi encoding; - remote wakeup signaling. ------------------------------------------------------------------------*/ module usb_encoder ( input clk, ...
/** * 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 a, b, n, k, y, x, i, j, h, ans, c, d[100005], f[10]; char s[105], s1[105]; int main() { scanf( %d%d%s , &n, &k, s); for (i = 1; i <= k; i++) { int f[1000] = {0}; scanf( %d %d , &a, &b); x = 0; int DP = 1, CP = 0, lens1 = 0; ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int idata = 2e5 + 7; int i, j, k; int judge, flag; long long step[idata]; long long temp; int n, m, t; double maxx = 0, minn = inf; long long cnt, len, sum, ans; long long high, wigh; map<long long, int> pre[2]; si...
#include <bits/stdc++.h> using namespace std; const int mxN = 302; bool ar[mxN]; int p, n; void solve() { cin >> p >> n; for (int i = 0; i < n; i++) { int a; cin >> a; int temp = a % p; if (ar[temp] == 0) { ar[temp] = 1; } else { cout << i + 1; ret...
#include <bits/stdc++.h> using namespace std; long long add(int a, int b) { return (a % 1000000007 + b % 1000000007 + ((8000000000000000064LL) / 1000000007) * 1000000007) % 1000000007; } long long sub(long long a, long long b) { return (a % 1000000007 - b % 1000000007 + ...
/* * 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 m[120], n, k = 0; int main() { cin >> n; char a, b; getchar(); for (int i = 1; i < n; i++) { a = getchar(); b = getchar(); m[a - a ]++; if (m[b - A ] > 0) { m[b - A ]--; } else { k++; } } ...
/** * 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 = 32005; int n, m, i, j, f; int a[N]; long long ans; int main() { scanf( %d%d , &n, &m); for (i = m + 1; i <= (n + 1) / 2; i++) { for (j = m + 1; j < 2 * i; j++) { f = (i * (2 * i - j) + (n + 1) * (2 * j - i)) / (i + j); ...
#include <bits/stdc++.h> using namespace std; char str[100003]; struct Node { int val; int val2; Node* pt[26]; } node[100003]; int cnt; int mex(Node* node) { if (node->val != -1) return node->val; int f[30] = {}; for (int i = 0; i < 26; ++i) if (node->pt[i]) f[mex(node->pt[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; double cooy1, cooy2, cooyw, cooxb, cooyb, r; double s1, s2; int main() { ios_base::sync_with_stdio(false); cin >> cooy1 >> cooy2 >> cooyw >> cooxb >> cooyb >> r; cooy1 += r; cooy2 -= r; cooyw -= r; s1 = 2 * cooyw - cooy1; s2 = 2 * cooyw -...
/** * 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; void solution() { int n, k; cin >> n >> k; vector<long long> v(n * k + 1, 0), brr(n * k + 1, 0); long long sum = 0; for (int i = 1; i <= n * k; i++) { cin >> v[i]; brr[i] = v[i]; } brr[0] = INT_MAX; sort(brr.rbegin(), brr.rend...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll t; cin >> t; while (t--) { ll cnt3, cnt2; cnt2 = cnt3 = 0; ll n; cin >> n; while (n % 2 == 0) { n = n / 2; cnt2++; } while (n % 3 == 0) { n = n / 3; ...
// megafunction wizard: %LPM_MULT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_mult // ============================================================ // File Name: mult16.v // Megafunction Name(s): // lpm_mult // // Simulation Library Files(s): // lpm // ==============================================...
#include <bits/stdc++.h> using namespace std; int n, m; vector<vector<int> > G; double dfs(int u, int p = -1) { double res = 0; int cnt = 0; for (int i = 0; i < G[u].size(); ++i) { int v = G[u][i]; if (v == p) continue; cnt++; res += dfs(v, u); } return (cnt ? res / 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 int MOD = 1e9 + 7; const int maxn = 222222; int main(int argc, char const *argv[]) { long long s, x; cin >> s >> x; if (s < x || (s - x) % 2) { puts( 0 ); } else { long long c = (s - x) / 2; long long ans = 1; for (int i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:23:14 11/09/2016 // Design Name: // Module Name: Sprite // Project Name: // Target Devices: // Tool versions: // Description: // // Dependen...
`timescale 1 ns / 1 ps module esaxi_v1_0 # ( // Users to add parameters here parameter [11:0] C_READ_TAG_ADDR = 12'h810, // User parameters ends // Do not modify the parameters beyond this line // Parameters of Axi Slave Bus Interface S00_AXI parameter integer C_S00_AXI_ID_WIDTH = 1, paramete...
#include <bits/stdc++.h> using namespace std; int t[200001]; int main() { memset(t, 0x3f, sizeof(t)); int n, k; string str; cin >> n >> k >> str; for (int x = 0; x < n; x++) if (str[x] == str[(x + 1) % n] || str[x] == str[(x - 1 + n) % n]) t[x] = 0; for (int x = 0; x < 2 * n; x++) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, s, ans, x, y, a; bool flag = false; cin >> n >> s; s = s * 100; ans = -1; for (int i = 0; i < n; i++) { cin >> x >> y; a = x * 100 + y; if (a <= s) { ans = max(ans, (100 - a % 100) % 100); } ...
#include <bits/stdc++.h> const int INF = 0x3f3f3f3f; int n, m; int f[55][405][405], s[405]; void DP() { int i, j, k, mx, my, ans = 0; memset(f, 0, sizeof(f)); for (i = 1, s[0] = 0; i <= n; i++) { scanf( %d , &s[i]); s[i] += s[i - 1]; } for (k = 2; k <= m; k++) { mx = my = -...
// (C) 2001-2013 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...
//top file module Floating_Point_Addition(clk,reset,x,y); input clk,reset; input [31:0] x,y; //??????????????? wire[8:0] exp_diff; //???????????? wire mux_1_en; //???1 ???? wire mux_2_en; //???2 ???? wire mux_3_en; //???3 ???? wire[7:0] mux_1_output; //???1 ????? wire[31:0] mux_2_output; //???2 ????? wire[31:0] mux...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Sun Apr 3 12:37:39 2016 //Host : ubuntu-desktop running 64-bit Ubuntu 14.04.4 LTS...
/* * University of Illinois/NCSA * Open Source License * * Copyright (c) 2007-2014,The Board of Trustees of the University of * Illinois. All rights reserved. * * Copyright (c) 2014 Matthew Hicks * * Developed by: * * Matthew Hicks in the Department of Computer Science * The University of Illinois at...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int a, b, c; cin >> a >> b >> c; cout << a + b + c - (2 * (min(min(a, b), min(b, c)))) << endl; } }
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; const int N = 2e5 + 1; const int oo = 1e9; const double pi = acos(-1); int main() { int t; cin >> t; while (t--) { int a, b, n; cin >> a >> b >> n; if (b < a) swap(a, b); int ans = 0; while (a <= n...
////////////////////////////////////////////////////////////////////// //// //// //// Generic Single-Port Synchronous RAM //// //// //// //// This file is part of memory li...
#include <bits/stdc++.h> int main() { float h, l; scanf( %f %f , &h, &l); float x = (l * l + h * h) / (2 * h) - h; printf( %f n , x); return 0; }
`timescale 1ns / 1ps module PS2_Controller #(parameter INITIALIZE_MOUSE = 0) ( // Inputs CLOCK_50, reset, the_command, send_command, // Bidirectionals PS2_CLK, // PS2 Clock PS2_DAT, // PS2 Data // Outputs command_was_sent, error_communication_timed_out, received_data, received_data_en // ...
#include <bits/stdc++.h> using namespace std; char s[5050], t[5050], goal[5050]; int cnt[200], l, l2; bool dfs(int p, bool v) { if (p == l2) { if (v) return puts(goal), 1; else return 0; } if (v) { for (int i = a ; i < z + 1; i++) if (cnt[i] > 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...
/** * 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) 1995/2018 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; int main() { string s; cin >> s; int a = 0; for (int i = 0; i < s.size(); i++) { if (s[i] == a ) a++; } for (int i = s.size(); i >= a; i--) { if (a > (i / 2)) { cout << i << endl; exit(0); } } }
module example; reg [7:0] vec; reg [3:0] ix; wire vix = vec[ix]; initial begin $display( " time ix vix vec" ); $display( " ---- ---- --- --------" ); $monitor( "%T %b %b %b", $time, ix, vix, vec ); vec = 8'b00000000; ...
#include <bits/stdc++.h> using namespace std; int q, n; int par[1 << 20][32], dep[1 << 20]; int da[500000]; void add(int v) { par[n][0] = par[n + 1][0] = v; dep[n] = dep[n + 1] = dep[v] + 1; for (int i = (int)(0); i < (int)(20); i++) par[n][i + 1] = par[n + 1][i + 1] = par[par[n][i]][i]; }...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
/******************************************************************* *****串口发送模块 ***** ***** *******************************************************************/ module Uart_tx( input clk, input rst_n, input [3:0] num, //一帧数据有几位由num来决定 input sel_data, //波特率技计数中心点(采集数据的使能信...
#include <bits/stdc++.h> using namespace std; int type[100005]; int lead[100005], degree[100005]; vector<int> go(int n) { vector<int> v; while (true) { if (degree[n] > 1) { return v; } else if (lead[n] == -1) { v.push_back(n); return v; } v.push_back(n); ...
#include <bits/stdc++.h> using namespace std; void smain(); int main() { ios::sync_with_stdio(false); smain(); return 0; } const int maxn = 300000 + 10; int num[maxn]; int num1[maxn], num2[maxn]; int tot = 1; int min1[maxn], min2[maxn]; int la1[maxn], la2[maxn]; int flo(int a, int b) {...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int n, p[4], bx[N], wx, by[N], wy, sum[N][4]; vector<int> wh[N]; struct node { int x, y, c; } sh[N]; bool cmp(node a, node b) { return a.x < b.x; } inline int read() { int f = 1, x = 0; char s = getchar(); while (s < ...
#include <bits/stdc++.h> using namespace std; long long ans[60]; int main() { long long t, a, n, m, b, v, xmin, xmax, act, sum, i, vmi; cin >> t; while (t--) { cin >> a >> b >> m; if (a == b) { cout << 1 << a << n ; continue; } for (n = 2; n <= 50; n++) { ...
/* * University of Illinois/NCSA * Open Source License * * Copyright (c) 2007-2014,The Board of Trustees of the University of * Illinois. All rights reserved. * * Copyright (c) 2014 Matthew Hicks * * Developed by: * * Matthew Hicks in the Department of Computer Science * The University of Illinois at...
module signed_logic_operators_bug(); reg [7:0] a, b; wire [15:0] yuu, yus, ysu, yss; wire [15:0] zuu, zus, zsu, zss; initial begin // Example vector a = 8'b10110110; b = 8'b10010010; // Wait for results to be calculated #1; // Display results $display("a = %b", a); $display("b ...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ /* * rcn bus slave interface - zero cycle read delay (aka "fast") * */ module rcn_slave_fast ( input rst, input clk, input [68:0] rcn_in, output [68:0] rcn_out, output cs, output wr, outp...
#include <bits/stdc++.h> using namespace std; const signed long long Infinity = 1000000100; const long double Epsilon = 1e-9; template <typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << ( << p.first << , << p.second << ) ; } template <typename T> ostre...
// 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 May 28 20:04:14 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 la...
/////////////////////////////////////////////////////////////////////////////// // // File name: axi_protocol_converter_v2_1_7_b2s_r_channel.v // // Description: // Read data channel module to buffer read data from MC, ignore // extra data in case of BL8 and send the data to AXI. // The MC will send out the read data a...
/* * 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 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...
#include <bits/stdc++.h> using namespace std; long long n, q; const long long MXN = 200005; long long arr[MXN]; long long seg[MXN * 4]; void build(long long ind, long long l, long long r) { if (l == r) { seg[ind] = arr[l]; return; } long long m = (l + r) / 2; build(ind << 1, l, m...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<ll, ll>; inline int get_state(ll s, int x) { return ((s >> (5 * x)) & 0x1f); } inline ll set_state(ll s, ll v, int x) { return ((s & ~(0x1fLL << (5 * x))) | (v << (5 * x))); } int cs[10]; map<ll, int> st; map<ll, i...
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e5 + 5, mod = 1e9 + 7, inf = 1e18; long long n, m, ans[maxn], h[maxn], par[20][maxn], mx[20][maxn], pw2[20], p[maxn], sz[maxn], ip[maxn]; vector<pair<long long, long long>> v1[maxn], v2[maxn]; vector<pair<long long, pair<long long, lo...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (win64) Build 881834 Fri Apr 4 14:15:54 MDT 2014 // Date : Thu Jul 24 13:39:23 2014 // Host : CE-2013-124 running 64-bit Service Pa...
/** * 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...
module encoder(in,out); input [39:0] in; output [5:0] out; assign out = (in[0]==1'b1)?6'd0: (in[1]==1'b1)?6'd1: (in[2]==1'b1)?6'd2: (in[3]==1'b1)?6'd3: (in[4]==1'b1)?6'd4: (in[5]==1'b1)?6'd5: (in[6]==1'b1)?6'd6: (in[7]==1'b1)?6'd7: (in[8]==1'b1)?6'd8: ...
#include <bits/stdc++.h> using namespace std; int main() { int h, m, m2; char c; scanf( %d %c %d , &h, &c, &m); scanf( %d , &m2); m2 += m; int h2 = (int)(m2 / 60); h2 += h; h2 %= 24; m2 = m2 % 60; if (h2 >= 0 && h2 <= 9) printf( 0 ); printf( %d: , h2); if (m2 >= 0 && ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 40; const int MAXM = 210; int n, m, A[MAXN]; double p[MAXM][MAXN][MAXN]; void lucky() { scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &A[i]); } int main() { lucky(); for (int i = 1; i <= n; i++) for (...
//flash interface module flash_int(reset, clock, op, address, wdata, rdata, busy, flash_data, flash_address, flash_ce_b, flash_oe_b, flash_we_b, flash_reset_b, flash_sts, flash_byte_b); parameter access_cycles = 5; parameter reset_assert_cycles = 1000; parameter reset_recovery_cycles = 30; ...
#include <bits/stdc++.h> using namespace std; string removeZero(string s) { int i = 0, m = 0, j = s.size() - 1; if (s[i] == 0 ) { while (s[i] == 0 ) { i++; } } s.erase(0, i); if (s[j] == 0 ) { while (s[j] == 0 ) { m++; j--; } } s.erase(...
/* Copyright (c) 2019 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, distribute,...
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; vector<pair<int, int> > v; v.resize(n * m); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { v[m * (i - 1) + j - 1] = {i, j}; } } bool low = true; int l = 0, r = m *...