text
stringlengths
59
71.4k
`timescale 1ns/10ps module jaxa_pll_0( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multiplier("false"), .reference_clock_frequency("100.0 MHz"), ....
/* * 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() { int n, m; cin >> n >> m; int a[n][m]; int b[n]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cin >> a[i][j]; } for (int i = 0; i < n; i++) { b[i] = a[i][0]; for (int j = 1; j < m; j++) b[i] = min(a[...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { vector<int> v; int n; cin >> n; for (int i = 0; i < n; i++) { int t; cin >> t; v.push_back(t); } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); v.erase(remove...
// file: Clock35MHz_exdes.v // // (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; int n, m, k; int p[40]; struct query { int l, r, x; }; struct query q[500005]; int max0[500005], max1[500005]; long long dp[500005]; long long s[500005]; void solve() { cin >> n >> k >> m; p[0] = 1; for ...
#include <bits/stdc++.h> using namespace std; double dpsm[200001][26] = {0}; double dpfm[200001][26] = {0}; double ans = 0; int main() { int n; cin >> n; string s, f; cin >> s >> f; dpsm[0][s[0] - A ] = 1; dpfm[0][f[0] - A ] = 1; for (int i = 0; i < 26; ++i) { char c = A ...
// Copyright 2020-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
/* * 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 law...
#include <bits/stdc++.h> using namespace std; class Piece { public: int up[600]; int down[600]; vector<int> pcs; Piece() {} } pieces[20]; int x[600][600], w, h, p, u; void readPhoto() { cin >> h >> w >> p; for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) cin >> x[i][j];...
//////////////////////////////////////////////////////////////// // File: vga_sync.v // Author: B. Brown (based on Terasic module VGA_Ctrl.v) // About: Same VGA controller from vga_demo except push button // logic has been removed and input RGB data added. ///////////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; class TaskA { public: void solve(istream& in, ostream& out) { int n, m; in >> n >> m; int cell = m - 1; for (int i = 0; i < n; ++i) { if (i & 1) { for (int j = 0; j < m; ++j) out << (j == cell ? # : . ); cell...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int n, m; const int maxN = 42; vector<int> g[maxN]; int deg[maxN]; bool ed[maxN][maxN]; long long f() { return (1LL << n); } const int maxK = 20; bool bad[(1 << maxK) + 10]; int from[(1 << maxK) + 10]; bool other_bad[(1 << ...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; const int inf = 0x3f3f3f3f; const int mod = 1e9 + 7; int con[26][26]; char str1[maxn]; char str2[maxn]; char strans[maxn]; int main() { scanf( %s%s , str1, str2); memset(con, inf, sizeof(con)); for (int i = 0; i < 26; ...
#include <bits/stdc++.h> using namespace std; long long a[100010], b[100010]; int main(int argc, char *argv[]) { int n; long long t, Sum = 0; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %lld , &t); Sum += t; } for (int i = 1; i <= n; ++i) scanf( %lld , &b[i]); so...
#include <bits/stdc++.h> using namespace std; const int MAXN = 4e5 + 10; int n, m, k, t; bool vis[MAXN], ans[MAXN]; int v[MAXN]; set<int> p[MAXN]; priority_queue<pair<int, int> > pq; int main() { cin >> n >> m; memset(vis, false, sizeof(vis)); memset(ans, false, sizeof(ans)); 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 law...
#include <bits/stdc++.h> int main() { int pages, readPages[7]; scanf( %d , &pages); for (int i = 0; i < 7; i++) scanf( %d , &readPages[i]); int day = 1, i = 0; while (pages > 0) { if (day == 8) day = 1; if (i == 7) i = 0; pages -= readPages[i]; day++, i++; } printf(...
#include <bits/stdc++.h> using namespace std; const int maxN = 3e5 + 11, maxlg = 2e1; typedef int i_N[maxN]; typedef long long l_N[maxN]; int N, M, Q, par[maxN][maxlg], umax[maxN][maxlg], umin[maxN][maxlg]; vector<int> adj[maxN], pos[maxN]; vector<pair<int, int> > query[maxN]; pair<int, int> edge[maxN];...
#include <bits/stdc++.h> using namespace std; long long pw(long long x, long long a) { if (a == 0) return 1; long long t = pw(x, a / 2); if (a % 2 == 0) return (t * t); else return (t * t * x); } bool prime(int x) { if (x < 2) return false; for (int i = 2; i <= sqrt(x); i++) ...
#include <bits/stdc++.h> using namespace std; inline int gi() { int data = 0, m = 1; char ch = 0; while (ch != - && (ch < 0 || ch > 9 )) ch = getchar(); if (ch == - ) { m = 0; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { data = (data << 1) + (data << 3) + (ch ^ ...
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2015.1 // Copyright (C) 2015 Xilinx Inc. All rights reserved. // // =========================================================== `timescale 1 ns / 1 ps ...
/** * 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, ind, mini(1000000000); int t[11]; string ans = ; char chr(int x) { return char( 0 + x); } int main() { cin >> n; for (int i = 1; i < 10; i++) { cin >> t[i]; if (t[i] <= mini) { mini = t[i]; ind = i; } } ...
#include <bits/stdc++.h> int a[100005] = {}; int b[100005] = {}; std::vector<int> ans; std::vector<std::pair<int, int> > arr; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); std::cout.tie(NULL); int n, li = -1; std::cin >> n; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5 + 5, inf = 1e18; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int a, b, l, r; cin >> a >> b >> l >> r; l--; r--; long long int ans = 0; long long int d = (l) / (...
/** * 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 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 Apr 09 07:03:52 2017 // Host : GILAMONSTER running 64-bit major release (...
//---------------------------------------------------------------------// // Name: value_buffer.v // Author: Chris Wynnyk // Date: 2/3/2008 // Purpose: Buffers stock values by a single cycle. //---------------------------------------------------------------------// module value_buffer( clk, c0_in, ...
#include <bits/stdc++.h> using namespace std; const int N = 100010; long long a[N]; int n; bool check(long long x) { long long sum = 0; for (int i = 2; i <= n; ++i) { if (x - a[i] < 0) return false; sum += x - a[i]; } return (sum >= a[1]); } int main() { scanf( %d , &n); ...
#include <bits/stdc++.h> using namespace std; long long M = 1000000007; int sum(int n) { int ans = 0; while (n) { ans += n % 10; n = n / 10; } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int k; cin >> k; int an...
#include <bits/stdc++.h> using namespace std; const int N = 110; int n; char s[N][30]; char ss[30]; int p; int len[N]; int in[30]; int nxt[30]; int bf[30][30], ind[30]; void go(int i) { ss[p++] = char(i + a ); if (nxt[i] >= 0) go(nxt[i]); } int main() { scanf( %d , &n); memset...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int list[100000]; for (int i = 0; i < n; i++) { cin >> list[i]; } int max = 1; int temp = 1; for (int i = 0; i < n - 1; i++) { if (list[i] < list[i + 1]) { temp++; } else { i...
#include <bits/stdc++.h> using namespace std; int main() { int n; while (~scanf( %d , &n)) { int t = sqrt(n * 1.0); for (int i = t; i >= 1; i--) { if (n % i == 0) { cout << i << << n / i << endl; break; } } } }
/* Generated by Yosys 0.3.0+ (git sha1 3b52121) */ (* src = "../../verilog/bytemuxquad.v:1" *) module ByteMuxQuad(A_i, B_i, C_i, D_i, SAB_i, SC_i, SD_i, Y_o); (* src = "../../verilog/bytemuxquad.v:20" *) wire [7:0] AB; (* src = "../../verilog/bytemuxquad.v:21" *) wire [7:0] ABC; (* intersynth_conntype = "Byt...
#include <bits/stdc++.h> using namespace std; int n; int k; vector<pair<long double, long double> > vp; const long double PI = 2 * acos(0.0); bool check(long double r) { vector<pair<long double, int> > events; for (int i = 0; i < n; ++i) { long double ang = atan2(vp[i].second, vp[i].first); ...
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018 // Date : Tue Sep 17 15:49:29 2019 // Host : varun-laptop running 64-bit Service Pac...
/** * 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) 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,...
/* * 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...
/* **************************************************************************** -- (C) Copyright 2018 Kevin M. Hubbard - All rights reserved. -- Source file: deep_sump_ram.v -- Date: May 2018 -- Author: khubbard -- Description: Deep Sump extension to sump2.v logic analyzer. This is a -- simpl...
/** * 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 main; string words [$], tmp_word; int nums [$], tmp_num; initial begin words.push_back("Hello"); words.push_back("World"); if (words.size != 2) begin $display("FAILED -- words.size=%0d", words.size); $finish; end if (words[0] != "Hello") begin $display("FAILED...
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); return 0; } void solve() { long long a, b; cin >> a >> b; long long ct = 0; while (a > 0 && b > 0) { if (a > b) { ...
//================================================================================================== // Filename : ceespu_decode.v // Created On : 2018-07-17 17:42:55 // Last Modified : 2018-07-22 19:09:34 // Revision : // Author : Cees Wolfs // // Description : Decoder for the ceespu // // ...
#include <bits/stdc++.h> using namespace std; int n; struct node { int sig; int bz; char s[11]; int get() { int len = strlen(s); int x = 0; if (s[0] == 0 ) return 0; for (int i = 0; i < len; i++) if (s[i] < 0 || s[i] > 9 ) return 0; else ...
#include <bits/stdc++.h> using namespace std; int main() { int n, arr[100]; cin >> n; for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 0; i < n - 1; i++) { for (int j = i; j < n; j++) { if (arr[i] > arr[j]) { int swap = arr[j]; arr[j] = arr[i]; ...
//----------------------------------------------------------------- // FPGA Audio Project SoC IP // V0.1 // Ultra-Embedded.com // Copyright 2011 - 2012 // // Email: // // License: LGPL // // If you wo...
#include <bits/stdc++.h> using LL = long long; const LL inf = 1LL << 60; const int kN = 14; int a[kN], n; int delta[kN]; int cnt[1 << kN]; LL f[1 << kN]; int decode(char c) { if (c >= 0 && c <= 9 ) return c - 0 ; return c - a + 10; } char encode(int x) { if (x < 10) return x + 0 ;...
///////////////////////////////////////////////////////////////////////// // Copyright (c) 2008 Xilinx, Inc. All rights reserved. // // XILINX CONFIDENTIAL PROPERTY // This document contains proprietary information which is // protected by copyright. All rights are reserved. This notice ...
module bsg_rp_clk_gen_coarse_delay_tuner ( input i , input [1:0] sel_i , input we_i , input async_reset_neg_i , output o , output we_o ); wire [1:0] sel_r; wire [7:0] signal; wire [1:0] mux_lo; // synopsys rp_group (bsg_clk_gen_cde) // synopsys rp_fill (0 0 RX) SC7P5T_C...
#include <bits/stdc++.h> using namespace std; const int node_max = 3000; struct network { struct node { int v, c, w, b; node(int _v = 0, int _c = 0, int _w = 0, int _b = 0) : v(_v), c(_c), w(_w), b(_b) {} }; int n, pre[node_max]; vector<node> nd[node_max]; void clear() { ...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference ...
/* * im.v - instruction memory * * Given a 32-bit address the data is latched and driven * on the rising edge of the clock. * * Currently it supports 7 address bits resulting in * 128 bytes of memory. The lowest two bits are assumed * to be byte indexes and ignored. Bits 8 down to 2 * are used to construct t...
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } long long add(long long a, long long b) { long long ret = a + b; if (ret >= 1000000007) ret -= 1000000007; return ret; } long long subtract(long long a, lon...
#include <bits/stdc++.h> int cmp(const void *a, const void *b) { return *((int *)a) - *((int *)b); } int maximum(int a, int b) { if (a > b) { return a; } else { return b; } } int minimum(int a, int b) { if (a < b) { return a; } else { return b; } } int main() ...
module pipeline4_testbench(); // faz o include dos parameters das instrucoes `include "params_proc.v" // indica o numero de testes a serem feitos parameter N_TESTES = 5; // declaracao das input e output reg clk_in, RST; reg [CTRL_WIDTH-1:0] ctrl_in; reg we; reg signed [DATA_WIDTH-1:0] data; reg [MEM_WIDTH-1:0] addr;...
#include <bits/stdc++.h> using namespace std; const int iinf = 1 << 29; const long long inf = 1ll << 60; const long long mod = 1e9 + 7; void GG() { cout << -1 n ; exit(0); } long long mpow(long long a, long long n, long long mo = mod) { long long re = 1; while (n > 0) { if (n & 1) r...
/* * Copyright (c) 2002 Stephen Williams () * * 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) * ...
//Legal Notice: (C)2011 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; const int siz = 1000000 + 10; char a[siz]; int main() { int t, n, m = 0, i, l, k; scanf( %d , &t); scanf( %s , a); int len = strlen(a); int z = 0, o = 0; for (l = 0; l < len; l++) { if (a[l] == 1 ) o++; else if (a[l] == ...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; const double pi = acos(-1.0); const int inf = (int)1e9; const double eps = 1e-4; const int ss = (int)1e6 + 3; const int base = inf; bool pred(const pair<int, int>& i, const pair<int, int>& j) { if (i.first == j....
/* * PicoSoC - A simple example SoC using PicoRV32 * * Copyright (C) 2017 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
#include <bits/stdc++.h> using namespace std; long long INF = (1e19); int n, m; int a[105]; bool cmp(int a, int b) { return a > b; } bool check(int d) { int i = 1, k = 0, ans = 0; while (a[i] - k > 0 && i <= n) { ans += (a[i] - k); if (i % d == 0) { k++; } if (ans >= ...
#include <cstdlib> #include <cstdarg> #include <cassert> #include <cctype> // tolower #include <ctime> #include <cmath> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <stdexcept> #include <map> #include <tuple> #include <unordered_map> #include <s...
`timescale 1ns / 1ps module RX #( parameter stateA = 'b00001, parameter stateB = 'b00010, parameter stateC = 'b00100, parameter stateD = 'b01000, parameter stateE = 'b10000) (input clk, input baud_rate, input rx, output reg [7:0] d_out, output reg rx_done); integer state = stateA; integer next_state ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using vi = vector<int>; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, c; cin >> n >> m >> c; vector<int> v1, v2; for (int i = 0; i < m; i++) { ...
class foo(); int my_field; endclass // foo class temp; extern function test(); extern function test2(); function foo(); foo = 1; endfunction // foo extern function test3(); reg [31:0] b; endclass // temp class short extends temp; logic a; endclass `define vmm_channel(A) A+A module fo...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
/* * 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 Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_ifu_swpla.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it a...
#include <bits/stdc++.h> using namespace std; long long n, memo[100001]; vector<long long> a; long long x; long long rek(int pos) { long long &ret = memo[pos]; if (ret != -1) return ret; ret = rek(pos - 1) + 20; x = upper_bound(a.begin(), a.end(), a[pos] - 90) - a.begin(); if (x) ret...
#include <bits/stdc++.h> using namespace std; int n, q; int b[100000][2]; int a[100000]; int c[5]; int main() { cin >> n >> q; for (int i = 0; i < n; i++) { b[i][0] = 0; b[i][1] = 0; a[i] = 0; } c[0] = n - 1; int s = 0; for (int i = 0; i < q; i++) { int y, x; ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_uart.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // =================================...
#include <bits/stdc++.h> using namespace std; long long n; int main() { ios_base::sync_with_stdio(false); cin >> n; cout << (n - 3) * (n - 1) + 1; return 0; }
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_one_hot (clock, reset, enable, test_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width = 32; parameter property_ty...
#include <bits/stdc++.h> using namespace std; int one, two, three, four; bool check(deque<int> x) { int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0; for (int i = 0; i < x.size(); i++) { if (x[i] == 0) cnt1++; if (x[i] == 1) cnt2++; if (x[i] == 2) cnt3++; if (x[i] == 3) cnt4++; } ...
module xortest(out, a, b); output out; input a, b; parameter tdelay=2; wire a_, b_, i1, i2, i3; supply0 gnd; supply1 vdd; nmos #(tdelay) n5(a_, gnd, a); pmos #(tdelay) p5(a_, vdd, a); nmos #(tdelay) n6(b_, gnd, b); pmos #(tdelay) p6(b_, vdd, b); nmos #(tdelay) n1(out, i1...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:02:19 01/29/2015 // Design Name: // Module Name: vga_bsprite // Project Name: // Target Devices: // Tool versions: // Description: // // Dep...
// This file is part of multiexp-a5gx. // // multiexp-a5gx 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 law...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int MAX = 1e6; int len1, len2, pre[MAX], suf[MAX]; bool can_skip(int skip) { for (int i = 1; i + skip - 1 < len1; i++) if (pre[i - 1] + suf[i + skip] >= len2) return 1; return 0; } int main() { string x, y,...
module MAX6682Mean ( (* intersynth_port="Reset_n_i" *) input Reset_n_i, (* intersynth_port="Clk_i" *) input Clk_i, (* intersynth_port="ReconfModuleIn_s", intersynth_conntype="Bit" *) input Enable_i, (* intersynth_port="ReconfModuleIRQs_s", intersynth_conntype="Bit" *) output reg CpuIntr_o, (* inte...
/* * 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...
//----------------------------------------------------------------------------- // Pretend to be an ISO 14443 tag. We will do this by alternately short- // circuiting and open-circuiting the antenna coil, with the tri-state // pins. // // We communicate over the SSP, as a bitstream (i.e., might as well be // unframed,...
//----------------------------------------------------- // Design Name : hw2_A_testbench // File Name : hw2_A_testbench.v // Function : This program will test hw2_A.v // Coder : hydai //----------------------------------------------------- `timescale 1 ns/1 ns module hw2_A_testbench ; reg in; reg clk, rst_n; wire o...
/* -- ============================================================================ -- FILE : bus_arbiter.v -- SYNOPSIS : ×ÜÏßÖÙ²ÃÆ÷Ä£¿é£¬Ê¹ÓÃÂÖѯ»úÖÆ°´ÇëÇó˳Ðò½øÐÐʹÓÃȨ·ÖÅ䣬ÇÒÆ½µÈ¶Ô´ýËùÓÐ×ÜÏßÖ÷¿Ø -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comm...
#include <bits/stdc++.h> using namespace std; const int MaxN = 100009; unsigned long long a[MaxN], b[MaxN], c[MaxN]; int main() { unsigned long long n, ans = 0, p, sum = 0, sum2 = 0; cin >> n >> p; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { sum += a[i]; b[...
#include <bits/stdc++.h> using namespace std; int piles = 1, heavy = 0, num; int a[110], n; void solve(int x) { if (num == 0) { return; } if (heavy <= a[x]) { a[x] = -1; heavy++; num--; solve(x + 1); } else if (x < n) { solve(x + 1); } else { for (in...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n], ans = 0, maxi = 0; for (int i = 0; i < 7; i++) { cin >> a[i]; maxi += a[i]; } int t; if (maxi >= n) t = 1; else if (n % maxi == 0) { t = n / maxi; } else { t = 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; long long a[100005]; void solve() { long long n; cin >> n; for (long long i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); vector<long long> ans; long long st = 0, end = n - 1; while (end > st) { ans.push_back(a[end]); ans.push_b...
#include <bits/stdc++.h> using namespace std; long long int n, k, ans; long long int check(long long int v) { long long int sum = 0; while (v > 0) { sum += v; v /= k; } return sum; } void BS(long long int l, long long int r) { while (l <= r) { long long int mid = (l + (r ...
/** * 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; template <class T> inline T bigmod(T p, T e, T M) { long long 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 gcd(T a, T b) { if (b == 0) return 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 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...
`timescale 1ns / 1ps module MoleDecoder(mole16bit, mole_position); input [4:0]mole_position; output [15:0]mole16bit; reg [15:0]mole16bit; always @( * )begin case(mole_position) 5'd0: mole16bit = 16'b0000_0000_0000_0001; 5'd1: mole16bit = 16'b0000_0000_0000_0010; 5'd2: mole16bit = 16'b0000_...