text stringlengths 59 71.4k |
|---|
// nios_tester_mm_interconnect_0_avalon_st_adapter_009.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 18.1 625
`timescale 1 ps / 1 ps
module nios_tester_mm_interconnect_0_avalon_st_adapter_009 #(
para... |
#include <bits/stdc++.h> using namespace std; char x, y, t; struct node { char c; int p; } ans[4]; inline bool cmp(const node &a, const node &b) { return a.p < b.p; } int main() { for (register int i = 1; i <= 3; i++) { ans[i].c = A + i - 1; cin >> x >> t >> y; if (t == > ) ... |
#include <bits/stdc++.h> using namespace std; const int inf = 5000; const int MAXN = 200, MAXE = 2 * MAXN; int src, snk, nNode, nEdge; int Q[MAXN], fin[MAXN], pro[MAXN], dist[MAXN]; int flow[MAXE], cap[MAXE], Next[MAXE], to[MAXE]; inline void init(int _src, int _snk, int _n) { src = _src, snk = _snk, ... |
#include <bits/stdc++.h> using namespace std; int main() { long long xa, ya; long long xb, yb; long long xc, yc; cin >> xa >> ya >> xb >> yb >> xc >> yc; long long x = xa; long long y = ya; long long X = xb; long long Y = yb; for (int i = 0; i < 4; ++i) { if (i == 0) { ... |
//////////////////////////////////////////////////////////////////
// //
// Co-processor module for Amber 2 Core //
// //
// This file is part of the Amber project ... |
/**
* 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.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Mon Sep 18 12:31:40 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; int xs[2123], ys[2123], bs[2123]; long long fat[2123], prefix[2123][2123]; long long fatinv[2123]; long long sum(int row1, int row2, int col1, int col2) { if (row1 > row2 || col1 > col2) return 0ll; row2 = min(row2, 2000); col2 = min(col2, 2000); -... |
/**
* 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 = 1000000007; long long int inverse(long long int i) { if (i == 1) return 1; return (MOD - ((MOD / i) * inverse(MOD % i)) % MOD + MOD) % MOD; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long m, n, x; ... |
module Conf(
input wire ACLK,
input wire ARESETN,
//AXI Inputs
input wire [31:0] S_AXI_ARADDR,
input wire [11:0] S_AXI_ARID,
output wire S_AXI_ARREADY,
input wire S_AXI_ARVALID,
input wire [31:0] S_AXI_AWADDR,
input wire [11:0] S_AXI_AWID,
output wire S_AXI_AWREADY,
input wi... |
//-----------------------------------------------------------------------------
//
// (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
... |
/************************************************
* *
* Derek Prince *
* ECEN 2350: Digital Logic *
* 2n-bit Comparator on the terasiC DE0 board *
* Altera Cyclone 3 EP3C16F484 *
* ... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( O3 ) bool a[2000][2000], use[2000][2000][6][6]; vector<pair<int, int> > go; void dfs(int x, int y, int way, int cnt) { if (cnt == 3) return; use[x][y][way][cnt] = 1; for (int i = 1; i <= 4; i++) if (i == way) { if (a... |
#include <bits/stdc++.h> using namespace std; const int N = 30; long long n, a[N], ans, limit = 1e9 + 10; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); reverse(a, a + n); for (int i = 0; i < n; i++) { ans += min(a[i], limit); limit = min(limit - ... |
#include <bits/stdc++.h> using namespace std; int comp[212345], ptr; int idx[212345]; map<int, int> place; int h, m, n; int merge(int x, int y) { if (x == -1) { return y; } return x; } struct segtree { int n; vector<int> tree; segtree(vector<int> base) { n = base.size... |
//Com2DocHDL
/*
:Project
FPGA-Imaging-Library
:Design
Graying
:Function
Covert RGB images to gray-scale images.
Users can configure the multipliers by themselves.
Give the first output after mul_delay + 2 cycles while the input enable.
:Module
Main module
:Version
1.0
:Modified
2015-05-12
Copyright (C) 2015 Tia... |
// DESCRIPTION: Verilator: SystemVerilog interface test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
logic rst = 1'b1; // reset
integer rs... |
/**
* 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 "bsg_defines.v"
// MBT
// 11/9/14
//
// a fifo with only one read or write port,
// using a 1RW *synchronous read* ram.
//
// NOTE: read results appear on next cycle
//
module bsg_fifo_1rw_large #(parameter `BSG_INV_PARAM(width_p )
, parameter `BSG_INV_PARAM(els_p )... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007LL; long long dp[64]; long long solve(long long k) { if (dp[k] != -1) return dp[k]; if (k == 0) return 1LL; return ((16LL * solve(k - 1) % mod) * (solve(k - 1) % mod) % mod + mod) % mod; } int main() { ios::sync_wi... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int n, k, x, sum, a[24], BadPoint[2], dp[(1 << 24)]; int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; cin >> k; for (int i = 0; i < k; i++) cin >> ... |
//This file define some functions used in the simple cpu.
/************alu module *************/
module alu (opa, opb, aluc, result, z);
//define the ports
input [31:0] opa, opb;
input [3:0] aluc;
output [31:0] result;
output z;
wire [31:0] r_and = opa & opb;
wire [31:0] r_or = opa | opb;
wire [31:0] r_xor = opa ^ op... |
//======================================================================
//
// sha256_w_mem_regs.v
// -------------------
// The W memory. This version uses 16 32-bit registers as a sliding
// window to generate the 64 words.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2013, Secworks Sweden AB
// All rights ... |
`include "../lib/full_adder.v"
module add (
output cout,
output [31:0] sum,
input [31:0] a, b,
input cin
);
wire [30:0] carry;
full_adder addr0 (.cout(carry[ 0]), .sum(sum[ 0]), .a(a[ 0]), .b(b[ 0]), .cin(cin ));
full_adder addr1 (.cout(carry[ 1]), .sum(sum[ 1]), .a(a[ 1]), .b(b[ 1]), .cin(carry[ 0]))... |
/*
* Copyright (c) 2002 Stephen Rowland
*
* 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)
* a... |
#include <bits/stdc++.h> using namespace std; struct node { int v, w; node() {} node(int V, int W) { v = V; w = W; } }; vector<node> G[105]; int n, m; int dp[105][105][30]; int dfs(int first, int second, int s) { if (dp[first][second][s] != -1) return dp[first][second][s]; ... |
#include <bits/stdc++.h> using namespace std; const double PI = 3.141592653589793238; const double E = 2.718281828459045235; const int MOD = 1000000007; const long long INF = 1000000000; int main() { ios_base::sync_with_stdio(0); string s; cin >> s; cout << s; reverse((s).begin(), (s).en... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
#include <bits/stdc++.h> using namespace std; void init() { ios_base::sync_with_stdio(false); cin.tie(NULL); } void skipInputLine() { cin.ignore(numeric_limits<streamsize>::max(), n ); } template <typename TYPE> TYPE readNum() { TYPE item; cin >> item; return item; } template <type... |
/**
* 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... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_b
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: wi... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, n; cin >> a >> b >> n; bool exist(false); for (int i = 0; i < 10; i++) { if ((a * 10 + i) % b == 0) { cout << a * 10 + i; string s(n - 1, 0 ); cout << ... |
#include <bits/stdc++.h> const int S = 103; int n, m, a[S], b[S]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { if (2 * n + 2 * (i - 1) + 1 <= m) printf( %d , 2 * n + 2 * (i - 1) + 1); if (2 * i - 1 <= m) printf( %d , 2 * i - 1); if (2 * (n + i) <= m) printf( %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> #pragma comment(linker, /STACK:134217728 ) using namespace std; int main() { int p[4], a, b; for (int i(0); i <= (4 - 1); ++i) scanf( %d , &p[i]); scanf( %d%d , &a, &b); int res(0); for (int i = a; i <= b; ++i) { int perm[] = {0, 1, 2, 3}; int k(0); ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1100000; int p[MAXN], f[MAXN], g[MAXN]; int main() { int n; scanf( %d , &n); f[1] = 1, g[1] = 0; for (int i = 2; i <= n + 1; i++) { scanf( %d , &p[i]); f[i] = 1, g[i] = 0; for (int v = i; v != 1; v = p[v]) { ... |
#include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const int maxn = 105; int n, m, k; vector<set<int>> mp(maxn); vector<int> g, ans; int vis[maxn], pre[maxn], pres[maxn][maxn*maxn]; ll dp[maxn][maxn*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 la... |
module fpga_row(
input clk,
input [fpga_width*wire_width*12-1:0] brbselect,
input [(fpga_width-1)*(wire_width*wire_width*12)-1:0] bsbselect,
input [((fpga_width-1)*5)-1:0] lbselect,
inout [wire_width-1:0] left,
inout [wire_width-1:0] right,
inout [fpga_width*wire_width-1:0] top,
inout [fpga_width*wire_width-1:0... |
#include <bits/stdc++.h> using namespace std; int wrapper(int n) { while (n) { int a = n % 3; n = n / 3; if (a == 2) return 0; } return 1; } void solve() { int n; cin >> n; while (wrapper(n) == 0) n++; cout << n << n ; } int main() { ios::sync_with_stdio(0... |
#include <bits/stdc++.h> char map[55][55]; int cov[55][55]; int fx[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}}; int ok, sx, sy; int steps[55][55]; int n, m; int in(int x, int y) { if (x >= 1 && x <= n && y >= 1 && y <= m) return 1; return 0; } void dfs(int x, int y, int step) { steps[x][y] ... |
/*
*******************************************************************************
* File Name : ada_id_stage.v
* Project : ADA processor
* Version : 0.1
* Date : Aug 7th, 2014
* Author : Angel Terrones <>
*
* Disclaimer : Copyright © 2014 Angel Terrones
* ... |
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { if (a > b) return true; else return false; } struct pack { long long t, T, x, cost; }; int main() { long long ans = 0, n, m; cin >> n >> m; vector<pack> data; for (int i = 0; i < (n); ++i) { ... |
/*
Project: RECON 2017
Author: Jeff Lieu <>
Description: Timer module to support delay function
*/
module buttonDebouncer
#( /* Debounce time - Count in nanosecond */
parameter pDEBOUNCE_PERIOD = 100_000_000,
/* Clock Input period - Count in nanosecond */
parameter pCLKIN_PERIOD ... |
/*
Anthony De Caria - March 17, 2014
This module creates a Shift Register with a seperate enable signal.
This specific module creates an output that is 14-bits wide.
*/
module ShiftRegisterWEnableFourteen(clk, resetn, enable, d, q);
//Define the inputs and outputs
input clk;
input resetn;
input enable;
input d... |
/* This example is an FSM that interacts with the lcd_control.v module.
It first sends the string "18545" to the LCD module
It then waits for the nextString input to be asserted
It then sends the string "ECE" to the LCD module
It then waits forever.
*/
module testFSM(clkFSM,
resetFSM,
... |
#include <bits/stdc++.h> using namespace std; int main() { int x, y; while (scanf( %d %d , &x, &y) != EOF) { while (x >= 0 && y >= 0) { if (x >= 2 && y >= 2) { x -= 2; y -= 2; } else if (x == 1 && y >= 12) { x -= 1; y -= 12; } else if (x ... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* FIFO-based VC Free Pool
* ===========... |
/*
* 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() { string s1, s2; long long int n, c11 = 0, c00 = 0, c10 = 0, c01 = 0, p1 = 0, p2 = 0; cin >> n >> s1 >> s2; n *= 2; for (int i = 0; i < n; i++) { if (s1[i] == s2[i]) { if (s1[i] == 1 ) c11++; else ... |
module PressCount(clock0,clock180,reset,countu,countd,nr_presses,vga_hsync,vga_vsync,vga_r,vga_g,vga_b);
input wire clock0;
input wire clock180;
input wire reset;
input wire countu;
input wire countd;
output wire [7:0] nr_presses;
output wire vga_hsync;
... |
#include <bits/stdc++.h> using namespace std; long long int fun(long long int x, long long int y, long long int p) { long long int s = x / p; if (x % p) s++; long long int e = y / p; return e - s + 1; } void solve() { long long int n, p; cin >> n >> p; vector<pair<long long int, long... |
// ledtest_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 17.0 595
`timescale 1 ps / 1 ps
module ledtest_mm_interconnect_0_avalon_st_adapter #(
parameter inBitsPerS... |
// Generated by DDR3 High Performance Controller 11.0 [Altera, IP Toolbench 1.3.0 Build 208]
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
// ************************************************************
// Copyright (C) 1991-2011 Altera Corpor... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; int N, M; int ar[MAXN]; char s[MAXN]; int dn[MAXN][2]; int used[MAXN][2]; int f(int k, int flag) { if (k == -1) return 0; if (used[k][flag]) return dn[k][flag]; used[k][flag] = 1; if (!flag) return dn[k][flag] = f(k -... |
#include <bits/stdc++.h> using namespace std; class graph { int v; list<int>* adj; public: graph(int x) { this->v = x; adj = new list<int>[v]; } void add_edge(int a, int b) { adj[a].push_back(b); adj[b].push_back(a); } void count_colors(int a, int& n, int co... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; template <typename T> void printvec(vector<T>& vec) { for (long long int i = 0; i < vec.size(); i++) { cout << vec[i] << ; } cout << endl; } int main() { ios_base::sync_with_stdio(false); long long int n; cin >> n; vector<pair<... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> adj[1001]; int vis[1001]; int main() { long long k, b, n, t, m = 1; cin >> k >> b >> n >> t; while (n >= 1 && k * m + b <= t) m = k * m + b, n--; cout << n << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; vector<long long> v; int main() { long long pl, pr, vl, vr, k; double ans = 0; cin >> pl >> pr >> vl >> vr >> k; for (int h = 1; h <= 9; h++) { for (int i = 0; i < (1 << h); i++) { int x = 0, y = 1; for (int j = 0; j < h; j++) { ... |
#include<bits/stdc++.h> using namespace std ; #define ll long long #define pb push_back #define all(v) v.begin(),v.end() #define sz(a) (ll)a.size() #define F first #define S second #define INF 2000000000000000000 ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/12/2016 06:26:54 PM
// Design Name:
// Module Name: shift_mux_array
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
/... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Mon Sep 18 12:52:54 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true... |
#include <bits/stdc++.h> using namespace std; class Timer { clock_t start; public: Timer() : start(clock()) {} double now() { return (double)(clock() - start) / CLOCKS_PER_SEC; } } timer; struct node { int u, v, l; friend bool operator<(const node& a, const node& b) { return a.l < b.l;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; long long sum1[maxn]; long long sum2[maxn]; long long a[maxn]; long long pos[maxn]; int n; long long lowbit(long long x) { return x & -x; } void add(long long *sum, long long x, long long v) { while (x <= n) { sum[x] += ... |
module one0_handler (oh1,control,literal);
input [13:0] oh1;
output reg [15:0] literal;
output reg [25:0] control;
always begin
case (oh1[13:9])
5'b110xx: begin assign control = {8'b01100000,oh1[10:8],14'b000101};
assign literal={oh1[7],oh1[7],oh1[7],oh1[7],oh1[7],oh1[7],oh1[7],oh1[7],oh1[7:0]}; end //brz
5'b11... |
#include <bits/stdc++.h> using namespace std; const int lim = 10; char ch[11]; int i, j, k, n, m, a[21], t; int main() { scanf( %d , &n); memset(a, 0, sizeof(a)); for (i = 1; i <= n; i++) { scanf( %s%d , ch, &k); if (ch[0] == & ) { for (j = 0; j < lim; j++) { t = ((k... |
#include <bits/stdc++.h> using namespace std; const int maxn = 6e4, maxm = 2e6; int g[maxm]; int a[maxn], L[maxn], R[maxn], dp[maxn], ans[maxn]; int n, m, i, j, k; int main() { scanf( %d%d , &n, &m); for (i = 1; i <= 1e6; i++) g[i] = g[i - 1] ^ i; for (i = 1; i <= n; i++) scanf( %d , &a[i]); ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; const int N = 5e3 + 7, M = 2e6 + 7, p = 1e9 + 7; bool fp[M], gt[N]; vector<int> h[N], vt[N]; int n, a, b, tot, f[N], op[N], f1[N], f2[N], fl[N], st[N], va[N], cnt[N], ft[N][N]; char s[N][N]; vector<char> t[N]; inline int read() { int num = 0; 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... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> const long long INF = (1 << 30) - 1; const int MAXN = 100001; struct Node { int l, r; long long num; long long num2; long long delta; }; int n, m; long long t[MAXN]; int l[MAXN], r[MAXN]; long long q[MAXN]; Node tree[MAXN << 2]; void build(int cur, int l, int... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; struct Matrix { long long coef[105][105]; Matrix() { for (int i = (0); i <= (101); ++i) for (int j = (0); j <= (101); ++j) coef[i][j] = 0; } Matrix operator*(Matrix a) { Matrix res; for (int i... |
/*
* Data memory test bench for five stage MIPS CPU.
*
* Currently only runs for several cycles and
* dumps a .vcd for Gtkwave.
*/
`include "dm.v"
module dm_tb;
reg clk;
reg [6:0] addr;
reg rd, wr;
reg [31:0] wdata;
wire [31:0] rdata;
dm dm1(.clk(clk), .addr(addr), .rd(rd), .wr(wr),
.rdata(rdata),... |
#include <bits/stdc++.h> using namespace std; int main() { string org; cin >> org; int n; cin >> n; map<string, int> mp; for (int i = 0; i < n; i++) { string s, t; cin >> s >> t; string name; string trash; if (t[0] == p || t[0] == c ) { string trash; ... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 4;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bo... |
// Title : 32-Bit Register with Synchronous Reset
// Project : ECE 313 - Computer Organization
//-----------------------------------------------------------------------------
// File : reg32.v
// Author : John Nestor <>
// Organization : Lafayette College
//
// Created : October 2... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int N; vector<int> adj[MAXN]; map<int, int> dp[MAXN]; int cid; map<vector<int>, int> idmp; int getid(vector<int> v) { if (idmp.count(v)) { return idmp[v]; } return idmp[v] = cid++; } int dfs(int x, int p); v... |
module bfm (/*AUTOARG*/
// Inputs
name
);
input [8*5:1] name ;
endmodule
module tb;
// -------------------------------------------------------------------------
/*AUTOOUTPUT*/
// Beginning of automatic outputs (from unused autoinst outputs)
// End of automatics
// ---------------------------... |
module GenericSDAccelWrapperTop(input ap_clk, input ap_rst_n,
output s_axi_control_AWREADY,
input s_axi_control_AWVALID,
input [63:0] s_axi_control_AWADDR,
input [2:0] s_axi_control_AWPROT,
output s_axi_control_WREADY,
input s_axi_control_WVALID,
input [31:0] s_axi_control_WDATA,
input... |
#include <bits/stdc++.h> using namespace std; bool o[30]; int main() { int m, n, i, x, mid; cin >> m >> n; for (i = 0; i < n; i++) { cout << m << endl; cin >> x; if (!x) return printf( %d n , m), 0; o[i] = x == -1; } i = -1; int l = 1, r = m - 1; while (l <= r) ... |
#include <bits/stdc++.h> using namespace std; const int Y = 10; int n; string fcol = ; bool place(int y, int x) { cout << x << << y << endl; string ret; cin >> ret; return (ret == fcol); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; cout << 0... |
#include <bits/stdc++.h> using namespace std; int n, a[100010], g, cnt; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]), g = g == 0 ? a[i] : gcd(a[i], g), cnt += a[i] & 1; printf( %d n , cnt > 1 ? 0 : g);... |
#include <bits/stdc++.h> using namespace std; const long double PI = 3.14159265358979323846264338; const long long INF = 1000000000000000000; const long long INF1 = 1000000000; const long long MOD = 1000000007; long long mpow(long long a, long long b) { a %= MOD; if (!b) return 1; long long temp... |
/**
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { char str[100005]; cin >> str; int flag = 0, i; char checkString[100005]; for (i = 0; str[i] != 0 ; i++) { checkString[i] = a ; } checkString[i] = 0 ; if (strcmp(str, checkString) == 0) { checkString[strlen(ch... |
#include <bits/stdc++.h> using namespace std; long long n, ans = 3; int main() { cin >> n; while (n % ans == 0) { ans *= 3; } cout << n / ans + 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... |
#include <bits/stdc++.h> using namespace std; class PriorityQueue { private: vector<pair<int, int> > d1, d2; int l1 = 0, l2 = 0, r1 = 0, r2 = 0; inline bool takeFirst() { return l1 != r1 && (l2 == r2 || d1[l1] < d2[l2]); } public: inline void prepare() { swap(d1, d2); swap(l1, l... |
#include <bits/stdc++.h> using namespace std; const double pi = 3.1415926535897932384626433832795; double eps = 1e-14; char ch[1 << 20]; inline string gs() { scanf( %s , ch); return string(ch); } inline int gi() { int x; scanf( %d , &x); return x; } void error() { int ttt = 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 (c) 1995/2011 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; void optimise() { ios_base::sync_with_stdio(false); cin.tie(NULL); } long long int mod = 998244353; void normalize(long long int &a) { a = (a + mod) % mod; } long long int modmul(long long int a, long long int b) { a = a % mod; b = b % mod; n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.