text
stringlengths
59
71.4k
/*********************************************************************** Logic Analyzer 1 (base module) This file is part FPGA Libre project http://fpgalibre.sf.net/ Description: Implements an internal logic analyzer of 8/16/32 channels using the FT245 sync FIFO core. Implements 1 stage trigger and suppo...
#include <bits/stdc++.h> using namespace std; const int N = 123, mod = 1e9 + 7; int n, b, p, x; int cnt[N]; vector<vector<int>> t, a, res; void add(int& a, int b) { a = (a + b); if (a >= mod) { a -= mod; } } int mult(int a, int b) { a = (a * 1ll * b) % mod; return a; } vect...
#include <bits/stdc++.h> using namespace std; int uf[55]; int buc[55]; bool chk[55]; int ans[5000][2]; int fh(int idx) { if (uf[idx] != idx) uf[idx] = fh(uf[idx]); return uf[idx]; } vector<int> edge[55]; void dfs(int idx) { if (chk[idx]) return; chk[idx] = true; for (int i = 0; i <...
/***************************************************************************** * File : processing_system7_bfm_v2_0_ddrc.v * * Date : 2012-11 * * Description : Module that acts as controller for sparse memory (DDR). * *****************************************************************************/ module processi...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &k) { k = 0; int flag = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) flag = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { k = k * 10 + c - 0 ; c = getchar...
#include <bits/stdc++.h> using namespace std; struct query { int n, str_l, id; friend bool operator<(query a, query b) { return a.str_l < b.str_l; } }; const long long MOD = 1e9 + 7; const int maxn = 1e5 + 5; int n, str_len; char str[maxn]; long long ans[maxn], fac[maxn], ifac[maxn], inv[maxn], ...
/* * 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...
// Say:He is the Most Merciful,We have believed in him and upon him we have relied [67:29] //#pragma GCC optimize ( Ofast ) //#pragma GCC target ( avx2 ) //#pragma GCC optimize( unroll-loops ) #include<bits/stdc++.h> using namespace std; /...
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long x, y, z, res1 = 0, res2 = 0; cin >> x >> y >> z; unsigned long long a = x % z; unsigned long long b = y % z; res1 = (x + y) / z; if (a == 0 || b == 0) res2 = 0; else { if (a > b) { if ((z - ...
/* * 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 = 1e16; const long long maxn = 128; const long long maxlog = 60; long long a, b; string s, t; long long dp[maxlog][maxn]; long long ans; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cin >> a >> b; cin >> s >> t;...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2015 by Varun Koyyalagunta. // SPDX-License-Identifier: CC0-1.0 // bug1015 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; reg [63:0] crc; r...
/* * Integer multiply/divide 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 * Foun...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int MN = 200010; int N, Q; struct BIT { vector<int> tree; vector<pair<int, int> > lazy; void init() { tree = vector<int>(4 * N, 0); lazy = vector<pair<int, int> >(4 * N, {1, 0}); } void prop(int l, i...
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { if (e == 0) return 1; if (e % 2 == 0) { T t = bigmod(p, e / 2, M); return (t * t) % M; } return (bigmod(p, e - 1, M) * p) % M; } template <class T> inline T gcd(T a, T b) { if (b...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Mon May 26 17:47:23 2014 // Host : macbook running 64-bit Arch Linux // ...
#include <bits/stdc++.h> using namespace std; const int maxn = 100 * 1000; int n, m; int ar1[maxn]; int ar2[maxn]; void read(); int main() { read(); int i, j; int s1, s2; int file; i = j = s1 = s2 = file = 0; while (i < n) { if (s1 == 0) s1 += ar1[i++]; else { ...
#include <bits/stdc++.h> using namespace std; const int size = 100004; char s[size][4]; struct node { int l, r, cnt; long long sum[6]; } tree[size * 4]; int tmp[size], q[size]; void pushup(int rt) { int i; for (i = 0; i < 5; ++i) tree[rt].sum[i] = tree[rt << 1].sum[i] + ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 7; int n, k; string s; bool can_del(char c) { int l = N, r = -1; for (int i = 0; i < n; ++i) { if (s[i] == c) { l = min(l, i); r = max(r, i); } } return r - l + 1 <= k; } string ans1 = tokitsukaz...
#include <bits/stdc++.h> using namespace std; map<string, int> mp; map<int, string> g; int n, k, cnt; char name1[10100][30], name2[10100][30]; int mark[1010][1010]; int x[10100], y[10100], tt[10100]; int ans[10100], num; struct Node { int l, r; } node[10100]; struct Mark { int l, r; Ma...
/* * 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 T; int n, x, i, j; scanf( %d , &T); while (T--) { scanf( %d%d , &n, &x); printf( %d n , 2 * x); } 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; const int mod = 998244353; template <int mod = mod> struct Modular { int val; Modular() { val = 0; } Modular(long long _val) { val = Normalize(_val); } Modular(int _val) { val = Normalize(_val); } inline int Normalize(long long& _val) { if ...
// Quartus Prime Verilog Template // Single port RAM with single read/write address and initial contents // specified with an initial block module phyIniCommand1_and #(parameter DATA_WIDTH=16, parameter ADDR_WIDTH=4) ( input [(DATA_WIDTH-1):0] data, input [(ADDR_WIDTH-1):0] addr, input we, clk, ...
#include <bits/stdc++.h> using namespace std; int Map[15][15] = {0}, ro[15] = {0}, co[15] = {0}; int main() { int r, c, n, k, r1, c1, i, j, l1, l2, l3, l4, ans = 0, sum = 0; scanf( %d%d%d%d , &r, &c, &n, &k); for (i = 1; i <= n; i++) { scanf( %d%d , &r1, &c1); Map[r1][c1] = 1; } fo...
#include <bits/stdc++.h> using namespace std; const int INF = 10000000; const int MAX = 150; string s; int found(string aux) { int ans = 0; int cnt = 0; for (int i = 0; i < s.size(); i++) { for (int j = 0, k = i; j < aux.size(); j++, k++) { if (k == s.size()) break; if (aux[j...
#include <bits/stdc++.h> using namespace std; bool sort_1(pair<int, int> &a, pair<int, int> &b) { return a.first < b.first; } bool sort_2(pair<int, int> &a, pair<int, int> &b) { return a.first > b.first; } int main() { int n, cnt = 0; scanf( %d , &n); vector<vector<pair<int, int>>> a(1001); for ...
`timescale 1ns / 1ps module interface_slice( // gpio type gpio_w_i, gpio_w_o, gpio_w_t, gpio_i, gpio_o, gpio_t, // iic type scl_w_i, scl_w_o, scl_w_t, sda_w_i, sda_w_o, sda_w_t, scl_i, scl_o, scl_t, sda_i, sda_o, sda_t, // spi type spi0_w_i, spi0_w_o, spi0_w_t, spi1_w_i, spi1_w_o, spi1_w_t, sck_w_i, sck_w_o, sck_w...
/* * udp_dff.v * This is based on a bug report from Chacko Neroth. The original * compalint was that the (b0) in the table generated a syntax error * message. */ // Same as udp_dff except use a standard UDP calling syntax. module test; reg dd, clk, notifier; wire qq; dff d1 (qq, clk, dd, notifier); ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; long long sumx = 0; long long sumy = 0; for (long long i = 0; i < n; i++) { long long a, b; cin >> a >> b; sumx += a; sumy += b; ...
/** * 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 define is only used for readability `define NUMBER_OF_INTEGER_BITS_DISCARDED (2*(NUMBER_OF_BLOCKS-i)) `include "math.v" // this module calculates the integer sqrt of an input in floor(N/2)+1 cycles, where N is the number of input bits // it is also fully pipelined, capable of accepting a new integer every clo...
/** * 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...
/** * components-shiftreg.v - Shift register(s) * * Verilib - A Verilog HDL development framework * Copyright (c) 2014, Patrick Dear, All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the ...
#include <bits/stdc++.h> using namespace std; const int maxh = 200 * 1000 + 5; struct item { int pos, hash; item(int pos, int hash) : pos(pos), hash(hash) {} }; bool operator<(item a, item b) { return a.pos < b.pos; } int n, m, h; set<item> S[maxh]; map<int, int> M; int pos[maxh]; int Len[ma...
// -- (c) Copyright 2010 - 2013 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; double probabilitate[150]; double MAX; int N, i, limita; double calcul(int N) { double first = 1.0, second = 0.0; int i; for (i = 0; i < limita; ++i) { second = first * probabilitate[N + i] + second * (1.0 - probabilitate[N + i]); ...
#include <bits/stdc++.h> using namespace std; #define fr(i, a, b) for(int i = a; i < b; ++i) #define rf(i, a, b) for(int i = a - 1; i >= b; --i) #define len(v) size(v) #define all(v) begin(v), end(v) #define int long long #define ff first #define ss second #define ii pair<int, int> #define vi vec...
#include <bits/stdc++.h> using namespace std; int main() { int K; vector<int> a(5, 0); for (int i = 0; i < 5; i++) cin >> a[i]; cin >> K; vector<int> b(K); for (int i = 0; i < K; i++) { string temp; cin >> temp; if (temp == XXL ) b[i] = 4; else if (temp == X...
#include <bits/stdc++.h> using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int n, m; cin >> n >> m; int a[n]; for (__typeof((n)) i = (0); i < (n); i++) cin >> a[i]; int fq[m]; for (__typeof((m)) i = (0); i < (m); i++) fq[i] = 0;...
// soc_system_mm_interconnect_0_avalon_st_adapter.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 16.0 211 `timescale 1 ps / 1 ps module soc_system_mm_interconnect_0_avalon_st_adapter #( parameter inBi...
// by teknohog, replaces virtual_wire by rs232 // Now using fpgaminer's uart code instead of fpga4fun's. Besides // GPL3, the practical difference is that instead of TxD_busy we have // its inverse tx_ready. module serial_receive # ( parameter baud_rate = 115_200, parameter comm_clk_frequency = 100_000_000 ) ...
#include <bits/stdc++.h> #pragma GCC optimize 03 using namespace std; const long long int inf = 1e15; const long long int MOD = 1e9 + 7; const long long int N = 2e5 + 5; struct SegTree { struct data { long long int val; data() : val(0){}; template <typename T> void apply(T v) {...
module test_in ( input clk, input rst, input enable, output reg finished, input [23:0] write_count, input [1:0] ready, output reg [1:0] activate, output reg [31:0] fifo_data, input [23:0] fifo_size, output reg s...
// ---------------------------------------------------------------------- // Copyright (c) 2015, The Regents of the University of California All // rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met:...
#include <bits/stdc++.h> using namespace std; const int size = 100010; const int bound = 100; int n, m, qq; int res[size], arr[size], father[size]; vector<pair<int, int> > edge[size]; pair<int, int> q[size]; map<int, int> ans[size]; int find(int x) { return father[x] == -1 ? x : father[x] = find(fathe...
/* * 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...
`timescale 1ns / 1ps module PCMain(CLK, D, Q, display, AN, DP, BI_RBO); input CLK, D; output [3:0] Q; output reg DP; output reg [3:0] AN; output [7:0] display; inout BI_RBO; reg [31:0] counter; reg [31:0] dis_counter; reg PC_CLK; reg POWER; reg DIS_CLK; pc t(.CLK(PC_CLK), .D(D), .POWER(POWER), ...
/** * Author: Daniel * Created Time: 2021-05-20 00:17:05 **/ // time-limit: 2000 // problem-url: https://codeforces.com/contest/1525/problem/E #include <bits/stdc++.h> using namespace std; #define F first #define S second #define ER erase #define IS insert #define PI acos(-1) #defi...
`include "memory.v" module Memory(input[15:0] in, input clock, load, input[14:0] address, output[15:0] out); wire[15:0] outM, outS, outK, outSK; Not g1(address[14], N14); And g2(N14, load, Mload); And g3(address[14], load, Sload); RAM16K ram16k(in, clock, Mload, address[13:0], outM); RAM8K screen(in,...
////////////////////////////////////////////////////////////////////// //// //// //// RxFifo.v //// //// //// //// This file is part of the usbhos...
/** * 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...
// Directive indicates that 1ns is the time period used when specifying delays // (i.e., #10 means 10ns); 100ps is the smallest unit of time precision that // will be simulated (100ps = .1ns; thus #.1 is meaningful, #.00001 is equivalent // to #0) `timescale 1ns / 100ps module testbench (); reg clk; reg reset_;...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//Legal Notice: (C)2010 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...
#include <bits/stdc++.h> using namespace std; int main() { int m, n; cin >> m >> n; int arr[m]; for (int i = 0; i < m; i++) cin >> arr[i]; int amount = 0; sort(arr, arr + m); int count = 0; for (int j = 0; j < m; j++) { if (arr[j] < 0 && count < n) { amount += (-arr[j])...
#include <bits/stdc++.h> using namespace std; int getint() { unsigned int c; int x = 0; while (((c = getchar()) - 0 ) >= 10) { if (c == - ) return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - 0 ); } while (((c = getchar()) - 0 ) < 10); return x...
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long int ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T modinverse(T a, T M) { return bigm...
#include <bits/stdc++.h> using namespace std; long long mod(long long a, long long b) { long long ans; if (b == 0) return -1; else { ans = (a < 0 ? mod(((a % b) + b), b) : a % b); } return ans; } vector<int> cntl(100003, 0), cntr(100003, 0), cntt(100003, 0), cntb(100003, 0); in...
#include <bits/stdc++.h> using namespace std; const int N = 21; int n, m, k; int ls; bool vis[N]; vector<pair<int, int> > e[N]; void dfs(int u, int sum, int x) { if (u > n) { ls++; return; } if (ls >= k) { return; } dfs(u + 1, sum, x); for (int i = 0; i < (int)e[u...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s, e, t, r; cin >> n >> m; vector<pair<int, int> > sections(n + 1); for (int i = 1; i <= n; i++) sections[i].first = 0x3f3f3f3f; while (m--) { cin >> s >> e >> t >> r; for (int i = s; i <= e; i++) { if (t < ...
//----------------------------------------------------------------------------- // // (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 ...
// -- (c) Copyright 2013 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 proper...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09/10/2017 10:17:14 AM // Design Name: // Module Name: MAIN // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revis...
#include <bits/stdc++.h> using namespace std; unordered_map<long long, int> mpSt; unordered_map<long long, int> mpEnd; set<long long> AllPoints; long long K[200005]; int main() { int N; scanf( %d , &N); for (int i = 0; i < N; i++) { long long st, end; scanf( %lld %lld , &st, &end); ...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; const int inf = 1e9; int main() { ios::sync_with_stdio(false); string s; cin >> s; s = + s; int i; int ans = 0; int sum = 0; for (i = 1; i < (int)s.size(); i++) { if (s[i] == M ) { 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> #pragma GCC optimize( O2 ) using namespace std; const int MXN = 2e5 + 10; const int MXS = MXN * 4; const int INF = 1e9; const int Mod = 998244353; int n, q, num; int Seg[MXS], MUL[MXS], ADD[MXS]; set<pair<pair<int, int>, int> > st[MXN]; void Shift(int id, int s, int e) { ...
////////////////////////////////////////////////////////////////// // // // Wishbone master interface for the Amber 25 core // // // // This file is part of the Amber project ...
/* * These source files contain a hardware description of a network * automatically generated by CONNECT (CONfigurable NEtwork Creation Tool). * * This product includes a hardware design developed by Carnegie Mellon * University. * * Copyright (c) 2012 by Michael K. Papamichael, Carnegie Mellon University * * ...
#include <bits/stdc++.h> using namespace std; pair<long long int, long long int> operator+( pair<long long int, long long int> p0, pair<long long int, long long int> p1) { return pair<long long int, long long int>(p0.first + p1.first, p0.second + p1.seco...
#include <bits/stdc++.h> const int MAXN = 100; char s[MAXN + 5]; int main() { int n, p, q; scanf( %d%d%d , &n, &p, &q); scanf( %s , s); for (int i = 0; p * i <= n; i++) { if ((n - p * i) % q == 0) { int j = (n - p * i) / q; printf( %d n , i + j); int pos = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s1, s2; cin >> s1 >> s2; int len1 = s1.length(), len2 = s2.length(); int a[26] = {0}, mark = 0; multiset<char, greater<int> > st1, st2; for (int i = 0; i < len1; 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 n, m, l, r, x; string s; int main() { cin >> n >> m; r = 0; l = n + 1; for (int i = 0; i < m; ++i) { cin >> s; cin >> s; cin >> s; if (s == left ) { cin >> s >> x; l = min(l, x); } else { cin...
/* * Copyright 2013, Homer Hsing <> * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
#include <bits/stdc++.h> using namespace std; struct vahag { int hor, ver; }; vahag a[25][25]; const int N = 100005; int n, m, i, j, k, q, s, w, v, ans; string t, p; int bfs(int i, int j) { int qanak = 0; bool mark[25][25] = {0}; queue<int> xx, yy; xx.push(i); yy.push(j); mar...
#include <bits/stdc++.h> using namespace std; char s[100010]; int l[100010], r[100010]; struct node { int val, id; }; struct cmp { bool operator()(node a, node b) { return a.val < b.val; } }; priority_queue<node, vector<node>, cmp> q; int main() { scanf( %s , s); int len = strlen(s); ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int t; cin >> t; while (t--) { string s; int ans = 0; cin >> s; int curRow = 0, curCol = 0; map<pair<pair<int, int>, pair<int, int>>, bool> mp; for (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...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
`timescale 1 ns / 1 ps module averager_tb(); parameter FFT_WIDTH = 12; parameter ADC_WIDTH = 14; reg clk; reg [ADC_WIDTH-1:0] adc1; reg [ADC_WIDTH-1:0] adc2; reg [32-1:0] cfg_sub; reg [32-1:0] cfg_fft; reg [32-1:0] demod_data; reg tvalid; wire [32-1:0] m_axis_result_tdata; wire m_axis_result...
/* * 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 top( input REFERENCECLK, output [1:0] PLLOUTCORE, output [1:0] PLLOUTGLOBAL, input EXTFEEDBACK, input [7:0] DYNAMICDELAY, output LOCK, input BYPASS, input RESETB, input LATCHINPUTVALUE, //Test Pins output SDO...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2000005; int at[MAXN]; long long int n, x, y; int main() { cin >> n >> x >> y; int a; long long int f, g; f = y; g = x; for (int i = 0; i < x + y; i++) { if (f < g) { at[i] = 1; f += y; } else if...
/****************************************************************************** * File Name : encode_dp.v * Version : 0.1 * Date : 2008 02 27 * Description: encode datapath * Dependencies: * * * Company: Beijing Soul * * BUG: * ***********************************************...
#include <bits/stdc++.h> using namespace std; const long long mod = (int)1e9 + 7; char s[5010], t[5010]; int n, m; int d[2][5010], ans, cs; int main() { int i, j; gets(s + 1); n = strlen(s + 1); gets(t + 1); m = strlen(t + 1); d[1][m + 1] = 1; for (i = n; i >= 1; i--) { cs ...
module display(CLK, BPM, PLAY, SEGA, SEGD); input CLK; // 100MHz clock input input [7:0] BPM; // 8-bit BPM value //input [5:0] TONE; // 6-bit tone code //input [3:0] DURATION; // 4-bit duration code input PLAY; // Play/Pause Input output reg [3:0] SEGA; // Display-select (common anode) output...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> a(n + 1); vector<vector<int> > inc(n + 1); vector<vector<int> > dec(n + 2); for (int i = 0; i < n; i++) { cin >> a[i + 1]; } for (int i = 0; i <= n; i++) { if (i == 0) ...
#include <bits/stdc++.h> using namespace std; int n, j; std::vector<char> v; int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; cin >> n; int i = 0; while (i < n) { j = 0; while (j < 2 && i < n) { cout << a ; j++; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5; vector<int> g[N]; int deg[N]; int cnt[N]; void dfs(int v, int &l) { for (int i = 0; i < g[v].size(); i++) { cnt[g[v][i]] = l + 1; l++; dfs(g[v][i], l); l--; } } int main() { ios_base::sync_with_stdio(), ...
#include <bits/stdc++.h> using namespace std; const int N = 5005; const int M = 1005; const int K = 15; int n, m; char name[N][K], oper[N][K], val[N][M]; bool isV[N]; int idx1[N], idx2[N]; map<string, int> mp; char ansmx[M], ansmn[M]; int res[N]; int work(int a, int b, char op[]) { if (op[0]...
//----------------------------------------------------- // Design Name : ram_dp_ar_aw // File Name : ram_dp_ar_aw.v // Function : Asynchronous read write RAM // Coder : Deepak Kumar Tala //----------------------------------------------------- module ram_dp_ar_aw ( address_0 , // address_0 Input data_0 , /...
#include <bits/stdc++.h> using namespace std; int oo = (1e9) + 7; int main() { long long n; cin >> n; vector<long long> b(n / 2 + 5, 0); for (int i = 1; i <= n / 2; i++) { scanf( %lld , &b[i]); } vector<long long> out(n + 5, 0); long long l = 0; long long r = 0; for (int ...
//---------------------------------------------------------------------------- //-- Ejemplo de uso del receptor serie //-- Los caracteres recibidos se almacenan en un registro y los 4 bits menos //-- significativos se sacan por los leds rojos de la ICEstick //-----------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int result; string input; cin >> input; set<string> sinput; sinput.insert(input); for (int i = input.size() - 1; i >= 0; --i) { input = input[input.size() - 1] + input; input.pop_back...
/** * 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 solve() { long long a, b; cin >> a >> b; vector<string> A; for (long long i = 0; i < a; i++) { string res = ; for (long long j = 0; j < b; j++) { if (i % 4 == 0 || i % 4 == 2) { res += # ; } else if (i % 4 ==...