text
stringlengths
59
71.4k
module vga_game( input CLK, input up_switch, input dn_switch, input left_switch, input right_switch, output HS, output VS, output [2:0] RED, output [2:0] GREEN, output [1:0] BLUE ); wire [9:0] x, y; wire blank; reg [15:0] prescaler; vga v(.CLK (CLK), .HS (H...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:22:35 11/06/2014 // Design Name: four_adder_gate // Module Name: /home/varun/Desktop/eld/ass9/fouraddergate/four_adder_gate_fixture.v // Project Name: fouradderga...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
// // Copyright (c) 1999 Steven Wilson () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
/* * 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 boss = 2e5; map<int, int> used; queue<int> q; int n, k, c[2], a[boss + 10]; int main() { int i, answer = 0; cin >> n >> k; for (i = 1; i <= n; i++) { scanf( %d , &a[i]); if (used[a[i]] || c[a[i] % 2] == n / 2) q.push(i);...
#include <bits/stdc++.h> using namespace std; int X; vector<int> v[100010]; int all, all2; bool used[800 + 10]; int dp[800 + 10], dp2[800 + 10]; void calc(int x) { int i; for ((i) = 0; (i) < (int)(800); (i)++) used[i] = false; for ((i) = 0; (i) < (int)(v[x].size()); (i)++) used[v[x][i]] = true...
//issue stage: if the instruction is a store, store in the head //execute: if the instruction is a load, check if there's store in the store queue that has address match, if yes forwarding //store will complete in the same stage as the load and other instructions to make the ROB design easier //if a load and a store 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...
/** * 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...
// megafunction wizard: %RAM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: fb_block.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============================...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const int oo = 1e9 + 5; struct seg { seg(int a, int x, int y) : A(a), first(x), second(y) {} int A; int first; int second; }; bool operator<(const seg &M, const seg &N) { return M.A < N.A; } set<seg> segs; int main()...
// cog_vid /* ------------------------------------------------------------------------------- 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 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; vector<pair<int, long long>> v[63]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; long long sum = 0; for (int i = 0; i < n; i++) { int val; long long mask; cin >> val >> mask; sum += val; ...
#include <bits/stdc++.h> using namespace std; unordered_map<char, long long> store; class thisway { public: bool operator()(const char& a, const char& b) { if (store[a] > store[b]) return true; return false; } }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; y--; if ((y > x) || y == -1 || (x - y) % 2 != 0 || (!y && x)) cout << NO ; else cout << YES ; return 0; }
// // Designed by Qiang Wu // 16K bytes, 32bit interface `timescale 1ns/1ps module lr0(clk, addr, data_in, data_out, we, en, reset); input clk; input [13:2] addr; input [31:0] data_in; output [31:0] data_out; input [3:0] we; input en; input reset; RAMB16_S4_altera localram0( .aclr (reset), .address (addr[13:2]...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const int N = 1e5 + 5; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; long long nem = 0, ans = 0; for (int i = 0; i < n; i++) { cin...
`include "Constants.v" module StageWriteback ( clk, reset, dp, dce, da, dq, cq, cwre, cbsy, a_in, operation_in, ack_in, operation, ack ); parameter A_WIDTH = 12; parameter D_WIDTH = 8; input clk; input reset; input [A_WIDTH - 1:0] dp; output dce; output [A_WI...
/* * 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 long inf = 1e18; int main(void) { ios_base::sync_with_stdio(false); int N; cin >> N; long long minx = inf, maxx = -inf, miny = inf, maxy = -inf; vector<pair<long long, long long>> A(N); for (int i = 0; i < N; ++i) { cin >> A[i]...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 5; int main() { ios_base::sync_with_stdio(0); long long q; cin >> q; while (q--) { long long n; cin >> n; long long cnt = 0; long long flag = 1; while (n != 1) { if (n % 2 == 0) { n ...
/** * This is written by Andrew Mattheisen * and Zhiyang Ong */ module conv_encoder (output [1:0] c, input b, input clk, input reset); // Output signals for the design module // Input signals for the design module // Declare "reg" signals... // Output bus that will be assigned values reg [1:0] c; /* ...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( -Ofast ) #pragma GCC optimize( trapv ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native ) #pragma GCC optimize( -ffast-math ) #pragma GCC optimize( -funroll-loops ) #pragma GCC optimize( -funroll...
#include <bits/stdc++.h> using namespace std; std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count()); constexpr int MAXN = 1e9 + 7; constexpr int INF = 0x3f3f3f3f; constexpr long long INFLL = 0x3f3f3f3f3f3f3f3f; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullp...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: franp.com // Engineer: Fran Pregernik <> // // Create Date: 12/29/2016 08:04:28 PM // Design Name: // Module Name: radar_statistics // Project Name: // Target Devices: // Tool Versions: // Description: //...
// -------------------------------------------------------------------- // Copyright (c) 2005 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; parameter NPAD = 4; tri pad ...
#include <bits/stdc++.h> using namespace std; struct Dev { int p; int e; long double t; } d[100000]; int n, p; bool fun(long double midTime) { long double energy = 0, t; for (int i = 0; i < n; i++) { t = midTime - d[i].t; if (t > 0) energy += t * d[i].p; } return midTim...
#include <bits/stdc++.h> using namespace std; int cache[1005][20][2]; int ret[1005]; int n; vector<int> ans(1005, INT_MAX); void query(vector<int> &arr) { if (!arr.empty()) { printf( %lu n , arr.size()); for (auto &x : arr) printf( %i , x); printf( n ); fflush(stdout); fo...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: sram.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===================================...
#include <bits/stdc++.h> using namespace std; const int N = 200005, MOD = 1e9 + 7; long long fact[N], inv[N]; long long qpow(long long a, int b) { long long ans = 1; do { if (b & 1) ans = ans * a % MOD; a = a * a % MOD; } while (b /= 2); return ans; } int main() { int n; ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 23, MAXM = 2e4 + 10, LIM = (1 << MAXN), mod = 998244353; int n, f[1 << MAXN], g[1 << MAXN], F[1 << MAXN]; long long ans; int pcnt[1 << MAXN], psum[1 << MAXN], tag[1 << MAXN]; char s[MAXN][MAXM]; int cnt[MAXN][26]; int main() { for (int i...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/05/26 17:37:19 // Design Name: // Module Name: add_two_values_task_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies...
#include <bits/stdc++.h> using namespace std; const int MAXN = 11, MAXL = 100000 + 10; struct State { int len, fa, num[MAXN], tr[26]; State() : len(0), fa(0) { memset(num, 0, sizeof(num)); memset(tr, 0, sizeof(tr)); } State(int len, int fa, int numr, int ref) : len(len), fa(fa) { ...
module regfile_tb; reg clock; reg reset; reg [1:0] read_address; reg [1:0] write_address; reg [7:0] write_data; reg write_en; wire [7:0] read_data; initial begin $monitor ("we=%b, wa=%b, wd=%b, ra=%b, rd=%b", write_en, write_address, write_data, read_address, read_data); cl...
// Chuck Benz, Hollis, NH Copyright (c)2002 // // The information and description contained herein is the // property of Chuck Benz. // // Permission is granted for any reuse of this information // and description as long as this copyright notice is // preserved. Modifications may be made as long as this // notice i...
#include <bits/stdc++.h> using namespace std; int findLengthOfLNDS(vector<pair<int, float> > &plants_data) { if (plants_data.size() == 0) return 0; vector<int> m; m.push_back(0); for (int i = 1; i < plants_data.size(); i++) { if (plants_data[m.back()].first <= plants_data[i].first) { 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...
////////////////////////////////////////////////////////////////// // // // Testbench UART // // // // This file is part of the Amber project ...
// 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...
#include <bits/stdc++.h> using namespace std; const int MAXN = 105; const int mod = 1e9 + 7; vector<int> e[MAXN]; int n, sz[MAXN], f[MAXN][MAXN][2], tmp[MAXN][2], c[MAXN][MAXN]; inline int add(int x, int y) { return x + y >= mod ? x + y - mod : x + y; } inline void inc(int &x, int y) { x = x + y >= mod ? ...
#include <bits/stdc++.h> const long long md = 998244353; const int Inf = 1e9; const long long Inf64 = 1e18; const long long MaxN = 2e5 + 10; const long long MaxM = 11; const long double eps = 1e-15; const long long dx[4] = {0, 1, 0, -1}; const long long dy[4] = {1, 0, -1, 0}; const long long ddx[4] = ...
/* 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,...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:51:58 11/02/2015 // Design Name: Sidharth Sharma // Module Name: Booth_Multiplier_1 // Project Name: // Target Devices: // Tool versions: // Description: ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
/** * 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...
`define ADDER_WIDTH 016 `define DUMMY_WIDTH 128 `define 2_LEVEL_ADDER module adder_tree_top ( clk, isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1, sum, ); input clk; input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_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; int n; int a[200005]; int b[200005]; long long sum; int res[200005]; int ge[35]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]), sum += a[i]; for (int i = 1; i <= n; i++) scanf( %d , &b[i]), sum += b[i]; if (n =...
/** * 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, m, jj = 0; long long a[22], b[22]; long long dp[10000][1000]; long long memo(int idx, int cnt) { long long res = (long long)(1e18); if (idx == 2 * n - 1) { if (cnt == 1) res = b[((idx + jj) % n)]; return dp[idx][cnt] = res; } if ...
#include <bits/stdc++.h> using namespace std; int block(long int x) { vector<long int> v; while (x > 0) { v.push_back(x % 2); x = x / 2; } int ret = 0; for (int i = 0; i < v.size(); i++) { if (v[i] == 1) { ret++; } } return ret; } void pprint(long int ...
#include <bits/stdc++.h> using namespace std; long long C[1007][1007]; int main() { long long n, m, k; memset(C, 0, sizeof(C)); C[0][0] = 1; for (long long i = 1; i <= 1000; i++) { C[i][0] = 1; for (long long j = 1; j <= i; j++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 10000...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ns / 1ps module clk_gen ( input CLKIN, output wire BUS_CLK, output U2...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long MOD = 1000000007; long double EPS = 1e-9; mt19937 rng(chrono::steady_clock::now().time_since_epoch().coun...
// // Copyright (c) 1999 Thomas Coonan () // // This source code is free software; you can redistribute it // and/or modify it in source code form under the terms of the GNU // General Public License as published by the Free Software // Foundation; either version 2 of the License, or (at your option) // ...
#include <bits/stdc++.h> using namespace std; const int K = 10; const int NQ = 160000; int n, k, q; int v[NQ]; pair<int, int> lg[K]; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); cin >> n >> k >> q; for (int i = 0; i < n; i++) { cin >> v[i]; } for (i...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 5e3 + 10; const int MOD = 1e9 + 7; int n; char s[MAX_N]; int dp[26][MAX_N]; int sum[MAX_N]; int cb[MAX_N][MAX_N]; int main() { int i, l, j; scanf( %d , &n); scanf( %s , s + 1); cb[0][0] = 1; for (i = 1; i <= n; i++) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 100; int vis[N]; int p[N]; int sum[N]; int main() { int t = 0; for (int i = 2; i <= 1000010; i++) { if (vis[i] == 0) p[++t] = i; for (int j = 1; j <= t && (i * p[j] <= 1000010); j++) { vis[i * p[j]] = 1; if...
#include <bits/stdc++.h> using namespace std; vector<int> vc[200007]; int main() { int n; scanf( %d , &n); int res = 0; for (auto i = (1); i <= (n); ++i) { int m; scanf( %d , &m); vc[i].resize(m); for (auto j = (0); j <= (m - 1); ++j) scanf( %d , &vc[i][j]); sort(vc[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; int options[] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2}; int main(void) { string s; cin >> s; int total = 1; for (int i = 0; i < 2; ++i) { total *= options[s[i] - 0 ]; } cout << total << 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 law...
#include <bits/stdc++.h> using namespace std; int n, ma, a1; long long ans; char ch; struct point { int a, b; } s[1000005]; struct node { int l, r; long long add, sum, ma; node *ch[2]; } * nil, *root; long long gets() { long long v = 0; bool f = 0; char ch; while (!isdi...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n], odd = 0, evenindex; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] % 2 == 1) odd++; if (a[i] % 2 == 0) evenindex = i + 1; } ...
#include <bits/stdc++.h> char bar[1000002]; int main() { scanf( %s , bar); int n = strlen(bar); long long int left = 0, mid = 0, right = 0; for (int i = 0; bar[i] != ^ ; i++) mid = i + 1; for (int i = 0; bar[i] != ^ ; i++) if (bar[i] != = ) left += (mid - i) * (bar[i] - 0 ); for (i...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps ...
#include <bits/stdc++.h> using namespace std; int main() { long long k; cin >> k; long long cnt = 0; for (double a = 2 + 2. / 3; a < (2 * k) / sqrt(3); a += 2) { double b = 1e-8 + (-a + sqrt((16 * k * k) / 3. - (3 * a * a))) / 2. - 2. / 3; if (b > 0) cnt += ((int)b + 2) / 2; ...
#include <bits/stdc++.h> using namespace std; long long a[100005], c[100005]; int main() { long long n; cin >> n; for (long long i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n; i++) { c[i] = c[i - 1] + 20; long long x = upper_bound(a + 1, a + 1 + n, a[i] - 90) - ...
#include <bits/stdc++.h> using namespace std; const int N = 205; int mem[N][N]; int asol[N]; bool query(int i, int j) { i = asol[i]; j = asol[j]; if (mem[i][j] != -1) return mem[i][j]; if (i == j) return false; cout << ? << i << << j << endl; char c; cin >> c; mem[i][j] ...
#include <bits/stdc++.h> using namespace std; const long long MAX = 1000000000; const int N = 100005; struct Edge { int to, next, w, vis; }; struct Edge e[N << 1]; int head[N], E, f[N]; struct P { long long val; int idx; P(long long val, int idx) : val(val), idx(idx) {} bool operator...
// hub_mem /* ------------------------------------------------------------------------------- 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 (c) 1995/2014 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ Vers...
// megafunction wizard: %LPM_CONSTANT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_constant // ============================================================ // File Name: lpm_constant0.v // Megafunction Name(s): // lpm_constant // // Simulation Library Files(s): // lpm // ===========================...
module write(clk, vsel, write, writenum, C, mdata, sximm8, PC, reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7); parameter width= 1; input clk, write; input [1:0] vsel; input [2:0] writenum; input [7:0] PC; input [15:0] C, mdata, sximm8; output [15:0] reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7; reg [15: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 main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cerr << Time : << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << ms n ; string s; cin >> s; int l = 0, r = s.length() - 1; int cnt = 0; set<int> s1; ...
module testbench; localparam test_early_yumi_lp = 1; `include "test_bsg_clock_params.v" localparam cycle_time_lp = 20; wire clk; wire reset; localparam width_lp = 16; localparam els_lp = 4; bsg_nonsynth_clock_gen #(.cycle_time_p(cycle_time_lp)) clock_gen (.o(clk)); bsg_nonsynth_res...
//Legal Notice: (C)2017 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 do...
/* * 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...
//deps: mem.v `timescale 1ns/1ps module mem_tb; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire [15:0] data_out; // From mem of mem.v wire mem_wait; // From mem of mem.v // End of automatics /*AUTOREGINPUT*/ // Beg...
#include <bits/stdc++.h> using namespace std; const int maxn = 101010 * 2; vector<int> vec[maxn]; vector<int> mp[maxn]; bool vis[maxn]; int arr[maxn]; int dfs(int x) { vis[x] = true; int ans = vec[x].size(); int siz = mp[x].size(); for (int i = 0; i < siz; i++) { int y = mp[x][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; int main() { char s[1000000]; cin >> s; int l = strlen(s); int a[26][2]; char x = 0; int diff = 0; for (int i = 0; i < 26; i++) { a[i][0] = 0; a[i][1] = 0; } for (int i = 0; s[i] != 0 ; i++) { x = (int)s[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...
//----------------------------------------------------------------- // RISC-V Core // V1.0.1 // Ultra-Embedded.com // Copyright 2014-2019 // // // // License: BSD //-----------------------...
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = RDLU ; long long ln, lk, lm; int r, c; vector<int> v[3105]; multiset<int> ms; int pos[30]; void fmain() { scanf( %d%d%d%d , &r, &c, &n, &k); for (int...
/*module xor3(input a ,input b,input c,output x); assign x=a^b^c; endmodule module alu2(input wire [31:0] srca,input wire [31:0]srcb, input wire [1:0] alucontrol, output reg[31:0] aluresult,output reg[3:0]aluflags); reg [31:0]sum; reg cout; wire [31:0]srcbc=~srcb; wire xa; xor3 aa(alucontrol[0],srca[31...
#include <bits/stdc++.h> struct Data { std::vector<int> nums; std::string str; }; struct Interval { int start; int end; std::string* data; }; bool compareIntervals(const Interval& a, const Interval& b) { if (a.start < b.start) return true; if (a.start > b.start) return false; r...
module PhaseDelayMain(clk, progIn, sigIn, sigOut); /*** This module is the master control for a phase delay board. Its operation is as follows: 1. Read sigIn every clock cycle a. create a period counter which counts one period. 2. sigOut is a delayed version of sigIn - state changes are delayed by an amount contained...
#include <bits/stdc++.h> char data[41][41]; int t[41][41][41][41]; int chk[41][41][41][41]; int main() { int a, b, c, d, i, j, k, l, p, q, sum = 0; scanf( %d %d %d , &a, &b, &q); for (i = 0; i < a; ++i) { scanf( %s , data[i]); for (j = 0; j < b; ++j) { if (data[i][j] == 0 ) { ...
module basic_checker import bsg_cache_pkg::*; #(parameter `BSG_INV_PARAM(data_width_p) , parameter `BSG_INV_PARAM(addr_width_p) , parameter `BSG_INV_PARAM(mem_size_p) , parameter data_mask_width_lp=(data_width_p>>3) , parameter cache_pkt_width_lp= `bsg_cache_pkt_width(addr_width_p,data_width_p) )...
/* * 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> int main() { int ans = 1, n, mod = 1000003; scanf( %d , &n); for (int i = 0; i < n - 1; i++) { ans *= 3; ans %= mod; } printf( %d n , ans); return 0; }
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12/09/2014 02:40:26 PM // Design Name: // Module Name: fsm_ADC // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Re...
#include <bits/stdc++.h> using namespace std; string s[50005]; bool cmp(const string &a, const string &b) { return a + b < b + a; } int main() { int n, i; cin >> n; for (i = 0; i < n; i++) cin >> s[i]; sort(s, s + n, cmp); string ans = accumulate(s, s + n, string()); cout << ans; ret...
#include <bits/stdc++.h> using namespace std; const long long int INF = 1e18; const int inf = 1e9; const int MOD = 1e9 + 7; const int nax = 1000000 + 10; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, s; cin >> n >> s; int a, b, c, d; cin >> a >> b; if (a * 60 ...